configure: make the --with-* options override the OpenSSL default
... previously it would default to OpenSSL even with the --with-[crypto] options used unless you specificly disabled OpenSSL. Now, enabling another backend will automatically disable OpenSSL if the other one is found.
Этот коммит содержится в:
родитель
1b808234e3
Коммит
42941b44f8
83
acinclude.m4
83
acinclude.m4
@ -382,3 +382,86 @@ AC_DEFUN([CURL_CONFIGURE_REENTRANT], [
|
||||
#
|
||||
])
|
||||
|
||||
AC_DEFUN([LIBSSH2_CHECKFOR_MBEDTLS], [
|
||||
|
||||
old_LDFLAGS=$LDFLAGS
|
||||
old_CFLAGS=$CFLAGS
|
||||
if test -n "$use_mbedtls" && test "$use_mbedtls" != "no"; then
|
||||
LDFLAGS="$LDFLAGS -L$use_mbedtls/lib"
|
||||
CFLAGS="$CFLAGS -I$use_mbedtls/include"
|
||||
fi
|
||||
|
||||
AC_LIB_HAVE_LINKFLAGS([mbedtls], [], [
|
||||
#include <mbedtls/version.h>
|
||||
])
|
||||
|
||||
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
|
||||
else
|
||||
# restore
|
||||
LDFLAGS=$old_LDFLAGS
|
||||
CFLAGS=$old_CFLAGS
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([LIBSSH2_CHECKFOR_GCRYPT], [
|
||||
|
||||
old_LDFLAGS=$LDFLAGS
|
||||
old_CFLAGS=$CFLAGS
|
||||
if test -n "$use_libgcrypt" && test "$use_libgcrypt" != "no"; then
|
||||
LDFLAGS="$LDFLAGS -L$use_libgcrypt/lib"
|
||||
CFLAGS="$CFLAGS -I$use_libgcrypt/include"
|
||||
fi
|
||||
AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [
|
||||
#include <gcrypt.h>
|
||||
])
|
||||
|
||||
if test "$ac_cv_libgcrypt" = "yes"; then
|
||||
AC_DEFINE(LIBSSH2_LIBGCRYPT, 1, [Use libgcrypt])
|
||||
LIBSREQUIRED= # libgcrypt doesn't provide a .pc file. sad face.
|
||||
LIBS="$LIBS -lgcrypt"
|
||||
found_crypto=libgcrypt
|
||||
else
|
||||
# restore
|
||||
LDFLAGS=$old_LDFLAGS
|
||||
CFLAGS=$old_CFLAGS
|
||||
fi
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN([LIBSSH2_CHECKFOR_WINCNG], [
|
||||
|
||||
# Look for Windows Cryptography API: Next Generation
|
||||
|
||||
AC_LIB_HAVE_LINKFLAGS([bcrypt], [], [
|
||||
#include <windows.h>
|
||||
#include <bcrypt.h>
|
||||
])
|
||||
AC_LIB_HAVE_LINKFLAGS([crypt32], [], [
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
])
|
||||
AC_CHECK_HEADERS([ntdef.h ntstatus.h], [], [], [
|
||||
#include <windows.h>
|
||||
])
|
||||
AC_CHECK_DECLS([SecureZeroMemory], [], [], [
|
||||
#include <windows.h>
|
||||
])
|
||||
|
||||
if test "$ac_cv_libbcrypt" = "yes"; then
|
||||
AC_DEFINE(LIBSSH2_WINCNG, 1, [Use Windows CNG])
|
||||
LIBSREQUIRED= # wincng doesn't provide a .pc file. sad face.
|
||||
LIBS="$LIBS -lbcrypt"
|
||||
if test "$ac_cv_libcrypt32" = "yes"; then
|
||||
LIBS="$LIBS -lcrypt32"
|
||||
fi
|
||||
found_crypto="Windows Cryptography API: Next Generation"
|
||||
if test "$ac_cv_have_decl_SecureZeroMemory" = "yes"; then
|
||||
support_clear_memory=yes
|
||||
fi
|
||||
fi
|
||||
])
|
||||
|
77
configure.ac
77
configure.ac
@ -83,24 +83,32 @@ AC_C_BIGENDIAN
|
||||
dnl check for how to do large files
|
||||
AC_SYS_LARGEFILE
|
||||
|
||||
found_crypto=none
|
||||
|
||||
# Configure parameters
|
||||
AC_ARG_WITH(openssl,
|
||||
AC_HELP_STRING([--with-openssl],[Use OpenSSL for crypto]),
|
||||
use_openssl=$withval,use_openssl=auto)
|
||||
AC_ARG_WITH(libgcrypt,
|
||||
AC_HELP_STRING([--with-libgcrypt],[Use libgcrypt for crypto]),
|
||||
use_libgcrypt=$withval,use_libgcrypt=auto)
|
||||
[ use_libgcrypt=$withval
|
||||
LIBSSH2_CHECKFOR_GCRYPT
|
||||
], use_libgcrypt=auto)
|
||||
AC_ARG_WITH(wincng,
|
||||
AC_HELP_STRING([--with-wincng],[Use Windows CNG for crypto]),
|
||||
use_wincng=$withval,use_wincng=auto)
|
||||
AC_ARG_WITH(mbedtls,
|
||||
[ use_wincng=$withval
|
||||
LIBSSH2_CHECKFOR_WINCNG
|
||||
] ,use_wincng=auto)
|
||||
AC_ARG_WITH([mbedtls],
|
||||
AC_HELP_STRING([--with-mbedtls],[Use mbedTLS for crypto]),
|
||||
use_mbedtls=$withval,use_mbedtls=auto)
|
||||
[ use_mbedtls=$withval
|
||||
LIBSSH2_CHECKFOR_MBEDTLS
|
||||
], use_mbedtls=auto
|
||||
)
|
||||
AC_ARG_WITH(libz,
|
||||
AC_HELP_STRING([--with-libz],[Use zlib for compression]),
|
||||
use_libz=$withval,use_libz=auto)
|
||||
|
||||
found_crypto=none
|
||||
support_clear_memory=no
|
||||
|
||||
# Look for OpenSSL
|
||||
@ -119,65 +127,12 @@ if test "$ac_cv_libssl" = "yes"; then
|
||||
|
||||
found_crypto="OpenSSL (AES-CTR: ${ac_cv_func_EVP_aes_128_ctr:-N/A})"
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL(OPENSSL, test "$ac_cv_libssl" = "yes")
|
||||
|
||||
# Look for libgcrypt
|
||||
if test "$found_crypto" = "none" && test "$use_libgcrypt" != "no"; then
|
||||
AC_LIB_HAVE_LINKFLAGS([gcrypt], [], [#include <gcrypt.h>])
|
||||
fi
|
||||
if test "$ac_cv_libgcrypt" = "yes"; then
|
||||
AC_DEFINE(LIBSSH2_LIBGCRYPT, 1, [Use libgcrypt])
|
||||
LIBSREQUIRED= # libgcrypt doesn't provide a .pc file. sad face.
|
||||
LIBS="$LIBS -lgcrypt"
|
||||
found_crypto=libgcrypt
|
||||
fi
|
||||
AM_CONDITIONAL(LIBGCRYPT, test "$ac_cv_libgcrypt" = "yes")
|
||||
|
||||
# Look for Windows Cryptography API: Next Generation
|
||||
if test "$found_crypto" = "none" && test "$use_wincng" != "no"; then
|
||||
AC_LIB_HAVE_LINKFLAGS([bcrypt], [], [
|
||||
#include <windows.h>
|
||||
#include <bcrypt.h>
|
||||
])
|
||||
AC_LIB_HAVE_LINKFLAGS([crypt32], [], [
|
||||
#include <windows.h>
|
||||
#include <wincrypt.h>
|
||||
])
|
||||
AC_CHECK_HEADERS([ntdef.h ntstatus.h], [], [], [
|
||||
#include <windows.h>
|
||||
])
|
||||
AC_CHECK_DECLS([SecureZeroMemory], [], [], [
|
||||
#include <windows.h>
|
||||
])
|
||||
fi
|
||||
if test "$ac_cv_libbcrypt" = "yes"; then
|
||||
AC_DEFINE(LIBSSH2_WINCNG, 1, [Use Windows CNG])
|
||||
LIBSREQUIRED= # wincng doesn't provide a .pc file. sad face.
|
||||
LIBS="$LIBS -lbcrypt"
|
||||
if test "$ac_cv_libcrypt32" = "yes"; then
|
||||
LIBS="$LIBS -lcrypt32"
|
||||
fi
|
||||
found_crypto="Windows Cryptography API: Next Generation"
|
||||
if test "$ac_cv_have_decl_SecureZeroMemory" = "yes"; then
|
||||
support_clear_memory=yes
|
||||
fi
|
||||
fi
|
||||
AM_CONDITIONAL(WINCNG, test "$ac_cv_libbcrypt" = "yes")
|
||||
|
||||
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(LIBGCRYPT, test "$ac_cv_libgcrypt" = "yes")
|
||||
AM_CONDITIONAL(MBEDTLS, test "$ac_cv_libmbedtls" = "yes")
|
||||
AM_CONDITIONAL(OS400QC3, false)
|
||||
|
||||
# Check if crypto library was found
|
||||
if test "$found_crypto" = "none"; then
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user