Check crypto library availability by type

This commit is contained in:
Nick Parker 2013-06-04 10:13:02 -05:00
parent e44f59f2b3
commit 50843f0b85
2 changed files with 10 additions and 9 deletions

View File

@ -159,9 +159,6 @@ if test "x${TCLLIBDIR+set}" != "xset" ; then
TCLLIBDIR="${TCLLIBDIR}/sqlite3" TCLLIBDIR="${TCLLIBDIR}/sqlite3"
fi fi
AC_CHECK_LIB([crypto], [HMAC_Init_ex], ,
AC_MSG_ERROR([Library crypto not found. Install openssl!"]))
######### #########
# Set up an appropriate program prefix # Set up an appropriate program prefix
# #
@ -260,14 +257,18 @@ AC_ARG_WITH([crypto-lib],
AC_HELP_STRING([--with-crypto-lib],[Specify which crypto library to use]), AC_HELP_STRING([--with-crypto-lib],[Specify which crypto library to use]),
crypto_lib=$withval) crypto_lib=$withval)
AC_MSG_CHECKING([for crypto library to use]) AC_MSG_CHECKING([for crypto library to use])
if test "$crypto_lib" = "libtomcrypto"; then if test "$crypto_lib" = "libtomcrypt"; then
CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPTO" CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPT"
BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPTO" BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_LIBTOMCRYPT"
AC_MSG_RESULT([libtomcrypto]) AC_MSG_RESULT([libtomcrypt])
AC_CHECK_LIB([tomcrypt], [register_cipher], ,
AC_MSG_ERROR([Library crypto not found. Install libtomcrypt!"]))
else else
CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL" CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL"
BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL" BUILD_CFLAGS+=" -DSQLCIPHER_CRYPTO_OPENSSL"
AC_MSG_RESULT([openssl]) AC_MSG_RESULT([openssl])
AC_CHECK_LIB([crypto], [HMAC_Init_ex], ,
AC_MSG_ERROR([Library crypto not found. Install openssl!"]))
fi fi
########## ##########

View File

@ -1,4 +1,4 @@
#ifdef SQLCIPHER_CRYPTO_LIBTOMCRYPTO #ifdef SQLCIPHER_CRYPTO_LIBTOMCRYPT
#include <tomcrypt.h> #include <tomcrypt.h>
void sqlcipher_activate(void *ctx) { void sqlcipher_activate(void *ctx) {