AC_ARG_ENABLE(openssl, [ --enable-openssl Attempt to use OpenSSL for SSL support.],
[ac_cv_enable_openssl=$enableval], [ac_cv_enable_openssl=no])
AC_ARG_ENABLE(openssl, [ --enable-openssl Attempt to use OpenSSL for SSL support.],
[ac_cv_enable_openssl=$enableval], [ac_cv_enable_openssl=no])
if test "x${ac_cv_enable_openssl}" != "xno"; then
AC_ARG_WITH(openssl-includes, [ --with-openssl-includes=PREFIX Location of OpenSSL includes.],
with_openssl_includes="$withval", with_openssl_includes="/usr/include")
if test "x${ac_cv_enable_openssl}" != "xno"; then
AC_ARG_WITH(openssl-includes, [ --with-openssl-includes=PREFIX Location of OpenSSL includes.],
with_openssl_includes="$withval", with_openssl_includes="/usr/include")
AC_ARG_WITH(openssl-libs, [ --with-openssl-libs=PREFIX Location of OpenSSL libs.],
with_openssl_libs="$withval")
if test "x${with_openssl_libs}" != "xno" -a "x${have_openssl_includes}" != "xno"; then
AC_ARG_WITH(openssl-libs, [ --with-openssl-libs=PREFIX Location of OpenSSL libs.],
with_openssl_libs="$withval")
if test "x${with_openssl_libs}" != "xno" -a "x${have_openssl_includes}" != "xno"; then
AC_CHECK_LIB(dl, dlopen, DL_LIBS="-ldl", DL_LIBS="")
AC_CACHE_CHECK([for OpenSSL libraries], openssl_libs,
[
AC_CHECK_LIB(dl, dlopen, DL_LIBS="-ldl", DL_LIBS="")
AC_CACHE_CHECK([for OpenSSL libraries], openssl_libs,
[
LIBS="$LIBS $with_openssl_libs -lssl -lcrypto $DL_LIBS"
AC_TRY_LINK_FUNC(SSL_read, openssl_libs="yes", openssl_libs="no")
LIBS="$LIBS_save"
])
if test "x${openssl_libs}" != "xno"; then
AC_DEFINE(USE_OPENSSL, 1, [Define if you use OpenSSL to support SSL])
LIBS="$LIBS $with_openssl_libs -lssl -lcrypto $DL_LIBS"
AC_TRY_LINK_FUNC(SSL_read, openssl_libs="yes", openssl_libs="no")
LIBS="$LIBS_save"
])
if test "x${openssl_libs}" != "xno"; then
AC_DEFINE(USE_OPENSSL, 1, [Define if you use OpenSSL to support SSL])