Skip to content

Commit 48aa485

Browse files
committed
configure: check for min required version (1.8) of libssh2. Closes #420
Signed-off-by: Stefan Widgren <stefan.widgren@gmail.com>
1 parent 163d62a commit 48aa485

File tree

2 files changed

+22
-85
lines changed

2 files changed

+22
-85
lines changed

configure

Lines changed: 16 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -5142,12 +5142,12 @@ if test -n "$libssh2_CFLAGS"; then
51425142
pkg_cv_libssh2_CFLAGS="$libssh2_CFLAGS"
51435143
elif test -n "$PKG_CONFIG"; then
51445144
if test -n "$PKG_CONFIG" && \
5145-
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libssh2\""; } >&5
5146-
($PKG_CONFIG --exists --print-errors "libssh2") 2>&5
5145+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libssh2 >= 1.8\""; } >&5
5146+
($PKG_CONFIG --exists --print-errors "libssh2 >= 1.8") 2>&5
51475147
ac_status=$?
51485148
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
51495149
test $ac_status = 0; }; then
5150-
pkg_cv_libssh2_CFLAGS=`$PKG_CONFIG --cflags "libssh2" 2>/dev/null`
5150+
pkg_cv_libssh2_CFLAGS=`$PKG_CONFIG --cflags "libssh2 >= 1.8" 2>/dev/null`
51515151
test "x$?" != "x0" && pkg_failed=yes
51525152
else
51535153
pkg_failed=yes
@@ -5159,12 +5159,12 @@ if test -n "$libssh2_LIBS"; then
51595159
pkg_cv_libssh2_LIBS="$libssh2_LIBS"
51605160
elif test -n "$PKG_CONFIG"; then
51615161
if test -n "$PKG_CONFIG" && \
5162-
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libssh2\""; } >&5
5163-
($PKG_CONFIG --exists --print-errors "libssh2") 2>&5
5162+
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"libssh2 >= 1.8\""; } >&5
5163+
($PKG_CONFIG --exists --print-errors "libssh2 >= 1.8") 2>&5
51645164
ac_status=$?
51655165
$as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
51665166
test $ac_status = 0; }; then
5167-
pkg_cv_libssh2_LIBS=`$PKG_CONFIG --libs "libssh2" 2>/dev/null`
5167+
pkg_cv_libssh2_LIBS=`$PKG_CONFIG --libs "libssh2 >= 1.8" 2>/dev/null`
51685168
test "x$?" != "x0" && pkg_failed=yes
51695169
else
51705170
pkg_failed=yes
@@ -5185,9 +5185,9 @@ else
51855185
_pkg_short_errors_supported=no
51865186
fi
51875187
if test $_pkg_short_errors_supported = yes; then
5188-
libssh2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libssh2" 2>&1`
5188+
libssh2_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "libssh2 >= 1.8" 2>&1`
51895189
else
5190-
libssh2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libssh2" 2>&1`
5190+
libssh2_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "libssh2 >= 1.8" 2>&1`
51915191
fi
51925192
# Put the nasty error message in config.log where it belongs
51935193
echo "$libssh2_PKG_ERRORS" >&5
@@ -5208,71 +5208,12 @@ $as_echo "yes" >&6; }
52085208
fi
52095209
fi
52105210
5211-
if test "x${have_ssh2}" = xno; then
5212-
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing libssh2_version" >&5
5213-
$as_echo_n "checking for library containing libssh2_version... " >&6; }
5214-
if ${ac_cv_search_libssh2_version+:} false; then :
5215-
$as_echo_n "(cached) " >&6
5216-
else
5217-
ac_func_search_save_LIBS=$LIBS
5218-
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
5219-
/* end confdefs.h. */
5220-
5221-
/* Override any GCC internal prototype to avoid an error.
5222-
Use char because int might match the return type of a GCC
5223-
builtin and then its argument prototype would still apply. */
5224-
#ifdef __cplusplus
5225-
extern "C"
5226-
#endif
5227-
char libssh2_version ();
5228-
int
5229-
main ()
5230-
{
5231-
return libssh2_version ();
5232-
;
5233-
return 0;
5234-
}
5235-
_ACEOF
5236-
for ac_lib in '' ssh2; do
5237-
if test -z "$ac_lib"; then
5238-
ac_res="none required"
5239-
else
5240-
ac_res=-l$ac_lib
5241-
LIBS="-l$ac_lib $ac_func_search_save_LIBS"
5242-
fi
5243-
if ac_fn_c_try_link "$LINENO"; then :
5244-
ac_cv_search_libssh2_version=$ac_res
5245-
fi
5246-
rm -f core conftest.err conftest.$ac_objext \
5247-
conftest$ac_exeext
5248-
if ${ac_cv_search_libssh2_version+:} false; then :
5249-
break
5250-
fi
5251-
done
5252-
if ${ac_cv_search_libssh2_version+:} false; then :
5253-
5254-
else
5255-
ac_cv_search_libssh2_version=no
5256-
fi
5257-
rm conftest.$ac_ext
5258-
LIBS=$ac_func_search_save_LIBS
5259-
fi
5260-
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_libssh2_version" >&5
5261-
$as_echo "$ac_cv_search_libssh2_version" >&6; }
5262-
ac_res=$ac_cv_search_libssh2_version
5263-
if test "$ac_res" != no; then :
5264-
test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
5265-
have_ssh2=yes
5266-
fi
5267-
5268-
fi
5269-
52705211
if test "x${have_ssh2}" = xno; then
52715212
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING:
52725213
---------------------------------------------
5273-
Unable to find the LibSSH2 library on this
5274-
system. Building a version without support
5275-
for SSH transport.
5214+
Unable to find the LibSSH2 (ver >= v1.8)
5215+
library on this system. Building git2r
5216+
without support for SSH transport.
52765217
52775218
To build with SSH support, please install:
52785219
libssh2-1-dev (package on e.g. Debian and Ubuntu)
@@ -5288,9 +5229,9 @@ if test "x${have_ssh2}" = xno; then
52885229
---------------------------------------------" >&5
52895230
$as_echo "$as_me: WARNING:
52905231
---------------------------------------------
5291-
Unable to find the LibSSH2 library on this
5292-
system. Building a version without support
5293-
for SSH transport.
5232+
Unable to find the LibSSH2 (ver >= v1.8)
5233+
library on this system. Building git2r
5234+
without support for SSH transport.
52945235
52955236
To build with SSH support, please install:
52965237
libssh2-1-dev (package on e.g. Debian and Ubuntu)
@@ -6959,11 +6900,11 @@ CPPFLAGS="${CPPFLAGS} -DGIT2R_HAVE_GIT_ERROR"
69596900
69606901
69616902
6962-
PKG_CFLAGS="${PKG_CFLAGS} ${LIBSSH2_CFLAGS}"
6903+
PKG_CFLAGS="${PKG_CFLAGS}"
69636904
69646905
PKG_CPPFLAGS="${CPPFLAGS}"
69656906
6966-
PKG_LIBS="${LIBS} ${LIBSSH2_LIBS} ${LIBICONV}"
6907+
PKG_LIBS="${LIBS} ${LIBICONV}"
69676908
69686909
69696910
ac_config_files="$ac_config_files src/Makevars_libgit2"

configure.ac

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -337,22 +337,18 @@ esac
337337
# Check for LibSSH2
338338
have_ssh2=no
339339
if test [ -n "$PKG_CONFIG" ] ; then
340-
PKG_CHECK_MODULES([libssh2], [libssh2],
340+
PKG_CHECK_MODULES([libssh2], [libssh2 >= 1.8],
341341
[CPPFLAGS="${libssh2_CFLAGS} ${CPPFLAGS}"
342342
LIBS="${libssh2_LIBS} ${LIBS}"
343343
have_ssh2=yes], [ ])
344344
fi
345345

346-
if test "x${have_ssh2}" = xno; then
347-
AC_SEARCH_LIBS([libssh2_version], [ssh2], [have_ssh2=yes])
348-
fi
349-
350346
if test "x${have_ssh2}" = xno; then
351347
AC_MSG_WARN([
352348
---------------------------------------------
353-
Unable to find the LibSSH2 library on this
354-
system. Building a version without support
355-
for SSH transport.
349+
Unable to find the LibSSH2 (ver >= v1.8)
350+
library on this system. Building git2r
351+
without support for SSH transport.
356352
357353
To build with SSH support, please install:
358354
libssh2-1-dev (package on e.g. Debian and Ubuntu)
@@ -480,9 +476,9 @@ CPPFLAGS="${CPPFLAGS} -DGIT2R_HAVE_GIT_ERROR"
480476

481477
AC_SUBST(GIT2R_SRC_REGEX)
482478
AC_SUBST(GIT2R_SRC_SHA1DC)
483-
AC_SUBST([PKG_CFLAGS], ["${PKG_CFLAGS} ${LIBSSH2_CFLAGS}"])
479+
AC_SUBST([PKG_CFLAGS], ["${PKG_CFLAGS}"])
484480
AC_SUBST([PKG_CPPFLAGS], ["${CPPFLAGS}"])
485-
AC_SUBST([PKG_LIBS], ["${LIBS} ${LIBSSH2_LIBS} ${LIBICONV}"])
481+
AC_SUBST([PKG_LIBS], ["${LIBS} ${LIBICONV}"])
486482

487483
AC_CONFIG_FILES([src/Makevars_libgit2])
488484

0 commit comments

Comments
 (0)