2005-08-02 16:33:22 +00:00
|
|
|
AC_DEFUN([CHECK_SSL],
|
2009-01-13 23:06:02 +00:00
|
|
|
[
|
2005-08-02 16:57:44 +00:00
|
|
|
SSLDIR=
|
2009-01-13 23:06:02 +00:00
|
|
|
SSL_LIBS=
|
|
|
|
SSL_CFLAGS=
|
|
|
|
SSL_CXXFLAGS=
|
|
|
|
AC_ARG_WITH(pkg-config,
|
|
|
|
AC_HELP_STRING([--with-pkg-config],
|
|
|
|
[Use pkg-config specified]),
|
|
|
|
[mypkgconfig="${withval}"]
|
|
|
|
[mypkgconfig=])
|
|
|
|
|
|
|
|
|
|
|
|
AC_PATH_PROG(PKGCONFIG,[$mypkgconfig pkg-config])
|
2005-08-02 16:33:22 +00:00
|
|
|
AC_ARG_WITH(ssl,
|
2005-08-03 19:53:41 +00:00
|
|
|
AC_HELP_STRING([--with-ssl],
|
|
|
|
[Use openssl (in specified installation directory)]),
|
|
|
|
[check_ssl_dir="$withval"],
|
|
|
|
[check_ssl_dir=])
|
2009-01-13 23:06:02 +00:00
|
|
|
if test "x${PKGCONFIG}" != "x" -a "x${check_ssl_dir}" = "x" ; then
|
|
|
|
SSLDIR="`${PKGCONFIG} openssl --cflags-only-I | sed -e 's/-I//' -e 's/\/include\/openssl//' -e 's/\/include//' | grep '[a-z]' 2>/dev/null`"
|
|
|
|
if test "x${SSLDIR}" = "x" ; then
|
|
|
|
if test -d "/usr/include/openssl" -o -f "/usr/include/ssl.h" ; then
|
|
|
|
SSLDIR="/usr"
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
if test "x${enable_client_release}" = "xyes" -o "x${disable_static_linkage}" = "xno" ; then
|
|
|
|
SSL_LIBS="`${PKGCONFIG} openssl --libs --static 2>/dev/null`"
|
|
|
|
fi
|
|
|
|
if test "x${SSL_LIBS}" = "x" ; then
|
|
|
|
SSL_LIBS="`${PKGCONFIG} openssl --libs 2>/dev/null`"
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
SSL_CFLAGS="`${PKGCONFIG} openssl --cflags 2>/dev/null`"
|
|
|
|
SSL_CXXFLAGS="${SSL_CFLAGS}"
|
|
|
|
SSL_CPPFLAGS="${SSL_CFLAGS}"
|
|
|
|
found_ssl="yes"
|
|
|
|
fi
|
|
|
|
if test "x${SSL_LIBS}" = "x" ; then
|
|
|
|
found_ssl="no"
|
|
|
|
for dir in $check_ssl_dir ${prefix} /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr /opt/misc /opt/csw /opt/sfw; do
|
|
|
|
ssldir="$dir"
|
|
|
|
if test -f "$dir/include/openssl/ssl.h"; then
|
|
|
|
found_ssl="yes";
|
|
|
|
SSLDIR="${ssldir}"
|
|
|
|
SSL_CFLAGS="-I$ssldir/include -I$ssldir/include/openssl";
|
|
|
|
SSL_CXXFLAGS="-I$ssldir/include -I$ssldir/include/openssl";
|
|
|
|
SSL_LIBS="-L$ssldir -lssl -lcrypto -ldl -lz"
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
if test -f "$dir/include/ssl.h"; then
|
|
|
|
found_ssl="yes"
|
|
|
|
SSLDIR="${ssldir}"
|
|
|
|
SSL_CFLAGS="-I$ssldir/include/"
|
|
|
|
SSL_CXXFLAGS="-I$ssldir/include/"
|
|
|
|
SSL_LIBS="-L$ssldir -lssl -lcrypto"
|
|
|
|
break;
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
|
|
|
AC_MSG_CHECKING(for openssl)
|
2005-08-03 19:53:41 +00:00
|
|
|
AC_MSG_RESULT($found_ssl)
|
2009-01-13 23:06:02 +00:00
|
|
|
|
|
|
|
BOINC_CHECK_LIB_WITH([gcrypt],[gcry_randomize],[SSL_LIBS])
|
|
|
|
BOINC_CHECK_LIB_WITH([gpg-error],[gpg_strerror], [SSL_LIBS])
|
|
|
|
|
2005-08-03 19:53:41 +00:00
|
|
|
if test x_$found_ssl != x_yes; then
|
|
|
|
AC_MSG_ERROR([
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
Cannot find openssl libraries.
|
|
|
|
|
|
|
|
Please install openssl or specify installation directory with
|
|
|
|
--with-ssl=(dir).
|
|
|
|
----------------------------------------------------------------------
|
|
|
|
])
|
|
|
|
else
|
2009-01-13 23:06:02 +00:00
|
|
|
printf "OpenSSL found in $SSLDIR\n";
|
2005-08-02 16:57:44 +00:00
|
|
|
AC_DEFINE_UNQUOTED([USE_OPENSSL],[1],
|
|
|
|
["Define to 1 if you want to use the openssl crypto library"])
|
|
|
|
AC_SUBST(SSLDIR)
|
2009-01-13 23:06:02 +00:00
|
|
|
AC_SUBST(SSL_CFLAGS)
|
|
|
|
AC_SUBST(SSL_CXXFLAGS)
|
|
|
|
AC_SUBST(SSL_LIBS)
|
2005-08-03 19:53:41 +00:00
|
|
|
fi
|
2009-01-13 23:06:02 +00:00
|
|
|
])
|