1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-08-08 19:02:07 +03:00

configure: Add support for building with mbedtls

This commit is contained in:
Keno Fischer
2016-09-26 17:13:59 -04:00
committed by Daniel Stenberg
parent 3e6de50a24
commit dc8f7ca3ab
4 changed files with 24 additions and 2 deletions

View File

@@ -88,8 +88,8 @@ coverage: init-coverage build-coverage gen-coverage
# DSP/VCPROJ generation adapted from libcurl # DSP/VCPROJ generation adapted from libcurl
# only OpenSSL and WinCNG are supported with this build system # only OpenSSL and WinCNG are supported with this build system
CRYPTO_CSOURCES = openssl.c wincng.c CRYPTO_CSOURCES = openssl.c wincng.c mbedtls.c
CRYPTO_HHEADERS = openssl.h wincng.h CRYPTO_HHEADERS = openssl.h wincng.h mbedtls.h
# Makefile.inc provides the CSOURCES and HHEADERS defines # Makefile.inc provides the CSOURCES and HHEADERS defines
include Makefile.inc include Makefile.inc

2
Makefile.mbedTLS.inc Normal file
View File

@@ -0,0 +1,2 @@
CRYPTO_CSOURCES = mbedtls.c
CRYPTO_HHEADERS = mbedtls.h

View File

@@ -93,6 +93,9 @@ AC_ARG_WITH(libgcrypt,
AC_ARG_WITH(wincng, AC_ARG_WITH(wincng,
AC_HELP_STRING([--with-wincng],[Use Windows CNG for crypto]), AC_HELP_STRING([--with-wincng],[Use Windows CNG for crypto]),
use_wincng=$withval,use_wincng=auto) use_wincng=$withval,use_wincng=auto)
AC_ARG_WITH(mbedtls,
AC_HELP_STRING([--with-mbedtls],[Use mbedTLS for crypto]),
use_mbedtls=$withval,use_mbedtls=auto)
AC_ARG_WITH(libz, AC_ARG_WITH(libz,
AC_HELP_STRING([--with-libz],[Use zlib for compression]), AC_HELP_STRING([--with-libz],[Use zlib for compression]),
use_libz=$withval,use_libz=auto) use_libz=$withval,use_libz=auto)
@@ -163,11 +166,25 @@ AM_CONDITIONAL(WINCNG, test "$ac_cv_libbcrypt" = "yes")
AM_CONDITIONAL(OS400QC3, false) AM_CONDITIONAL(OS400QC3, false)
# Look for libmbedtls
if test "$found_crypto" = "none" && test "$use_mbedtls" != "no"; then
AC_LIB_HAVE_LINKFLAGS([mbedtls], [], [#include <mbedtls/version.h>])
fi
if test "$ac_cv_libmbedtls" = "yes"; then
AC_DEFINE(LIBSSH2_MBEDTLS, 1, [Use mbedtls])
LIBSREQUIRED= # mbedtls doesn't provide a .pc file
LIBS="$LIBS -lmbedtls -lmbedcrypto"
found_crypto=libmbedtls
support_clear_memory=yes
fi
AM_CONDITIONAL(MBEDTLS, test "$ac_cv_libmbedtls" = "yes")
# Check if crypto library was found # Check if crypto library was found
if test "$found_crypto" = "none"; then if test "$found_crypto" = "none"; then
AC_MSG_ERROR([No crypto library found! AC_MSG_ERROR([No crypto library found!
Try --with-libssl-prefix=PATH Try --with-libssl-prefix=PATH
or --with-libgcrypt-prefix=PATH or --with-libgcrypt-prefix=PATH
or --with-libmbedtls-prefix=PATH
or --with-wincng on Windows\ or --with-wincng on Windows\
]) ])
fi fi

View File

@@ -14,6 +14,9 @@ endif
if OS400QC3 if OS400QC3
include ../Makefile.os400qc3.inc include ../Makefile.os400qc3.inc
endif endif
if MBEDTLS
include ../Makefile.mbedTLS.inc
endif
# Makefile.inc provides the CSOURCES and HHEADERS defines # Makefile.inc provides the CSOURCES and HHEADERS defines
include ../Makefile.inc include ../Makefile.inc