dnl
dnl
dnl
dnl
dnl
AC_DEFUN([AM_OPTIONS_CRYPTO], [
AC_ARG_WITH(
[crypto-prefix],
[AS_HELP_STRING(
[--with-crypto-prefix=PREFIX],
[prefix where crypto++ is installed])],
[CRYPTO_PP_PREFIX="$withval"],
[CRYPTO_PP_PREFIX=""])
])
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
dnl
AC_DEFUN([CHECK_CRYPTO], [
min_crypto_version=ifelse([$1], ,5.1,$1)
AC_MSG_CHECKING([for crypto++ version >= $min_crypto_version])
crypto_pp_file_with_version="cryptlib.h"
CRYPTO_PP_STYLE="unknown"
CRYPTO_PP_LIB_NAME=""
crypto_pp_include_i="unknown"
CRYPTO_PP_INCLUDE_PREFIX="unknown"
CRYPTO_PP_DEFINE="unknown"
CRYPTO_PP_LIB="unknown"
if test x$CRYPTO_PP_PREFIX = x ; then
CRYPTO_PP_PREFIX="/usr"
fi
if test -f $CRYPTO_PP_PREFIX/$crypto_pp_file_with_version; then
CRYPTO_PP_STYLE="sources"
CRYPTO_PP_LIB_NAME="cryptopp"
crypto_pp_include_i="$CRYPTO_PP_PREFIX"
CRYPTO_PP_INCLUDE_PREFIX="."
CRYPTO_PP_DEFINE="__CRYPTO_SOURCE__"
CRYPTO_PP_LIB="$CRYPTO_PP_PREFIX"
AC_MSG_ERROR([
Specifying the cryptopp source files directory for "--with-crypto-prefix="
will not work because cryptopp uses headers with the same name of system
headers (e.g. zlib.h) and you must be able to distinguish the system
headers from cryptopp headers in an
Please run "PREFIX=/home/YourUserName/usr/cryptopp make install" on
the cryptopp directory to properly install cryptopp in your system.])
elif test -f $CRYPTO_PP_PREFIX/include/cryptopp/$crypto_pp_file_with_version; then
CRYPTO_PP_STYLE="installed"
CRYPTO_PP_LIB_NAME="cryptopp"
crypto_pp_include_i="$CRYPTO_PP_PREFIX/include"
CRYPTO_PP_INCLUDE_PREFIX="$CRYPTO_PP_LIB_NAME"
CRYPTO_PP_DEFINE="__CRYPTO_INSTALLED__"
CRYPTO_PP_LIB="$CRYPTO_PP_PREFIX/lib"
elif test -f $CRYPTO_PP_PREFIX/include/crypto++/$crypto_pp_file_with_version; then
CRYPTO_PP_STYLE="gentoo_debian"
CRYPTO_PP_LIB_NAME="crypto++"
crypto_pp_include_i="$CRYPTO_PP_PREFIX/include"
CRYPTO_PP_INCLUDE_PREFIX="$CRYPTO_PP_LIB_NAME"
CRYPTO_PP_DEFINE="__CRYPTO_SOURCE__"
CRYPTO_PP_LIB="$CRYPTO_PP_PREFIX/lib"
fi
if test $CRYPTO_PP_STYLE = "unknown"; then
echo "no"
AC_MSG_NOTICE([
*** Could not find cryptopp header file "$crypto_pp_file_with_version".
*** Please check if the path "$CRYPTO_PP_PREFIX" is valid.])
ifelse([$3], , :, [$3])
else
crypto_pp_include_dir="$crypto_pp_include_i/$CRYPTO_PP_INCLUDE_PREFIX"
crypto_pp_header_path="$crypto_pp_include_dir/$crypto_pp_file_with_version"
CRYPTO_PP_VERSION_STRING=$(grep "Reference Manual" $crypto_pp_header_path | \
sed -e ['s/[^0-9]*\([0-9.]*\).*/\1/'])
CRYPTO_PP_VERSION_NUMBER=$(echo $CRYPTO_PP_VERSION_STRING | \
$AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}')
minvers=$(echo $min_crypto_version | \
$AWK 'BEGIN { FS = "."; } { printf "%d", ([$]1 * 1000 + [$]2) * 1000 + [$]3;}')
if test -n "$CRYPTO_PP_VERSION_NUMBER" && test "$CRYPTO_PP_VERSION_NUMBER" -ge $minvers; then
result="yes (version $CRYPTO_PP_VERSION_STRING, $CRYPTO_PP_STYLE)"
else
result="no"
fi
AC_MSG_RESULT([$result])
CRYPTO_PP_CXXFLAGS="-isystem $crypto_pp_include_i -D$CRYPTO_PP_DEFINE"
CRYPTO_PP_LDFLAGS="-L$CRYPTO_PP_LIB"
AH_TEMPLATE([CRYPTOPP_INCLUDE_PREFIX], [Define this to the include prefix of crypto++])
AC_DEFINE_UNQUOTED([CRYPTOPP_INCLUDE_PREFIX], $CRYPTO_PP_INCLUDE_PREFIX)
AC_SUBST([CRYPTO_PP_PREFIX])
AC_SUBST([CRYPTO_PP_VERSION_STRING])
AC_SUBST([CRYPTO_PP_VERSION_NUMBER])
AC_SUBST([CRYPTO_PP_STYLE])
AC_SUBST([CRYPTO_PP_LIB_NAME])
AC_SUBST([CRYPTO_PP_INCLUDE_PREFIX])
AC_SUBST([CRYPTO_PP_CXXFLAGS])
AC_SUBST([CRYPTO_PP_LDFLAGS])
AC_MSG_NOTICE([Crypto++ version number is $CRYPTO_PP_VERSION_NUMBER])
ifelse([$2], , :, [$2])
fi
])