Example code: Don't create rs_error on failing context creation.
[radsecproxy.git] / acinclude.m4
1 dnl Based on the one from the Boinc project by Reinhard
2
3 AC_DEFUN([AX_CHECK_SSL],
4 [AC_MSG_CHECKING(for OpenSSL)
5 SSL_DIR=
6 found_ssl="no"
7 AC_ARG_WITH(ssl,
8     AC_HELP_STRING([--with-ssl],
9        [Use SSL (in specified installation directory)]),
10     [check_ssl_dir="$withval"],
11     [check_ssl_dir=])
12 for dir in $check_ssl_dir /usr /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local ; do
13    ssldir="$dir"
14    if test -f "$dir/include/openssl/ssl.h"; then
15      found_ssl="yes";
16      SSL_DIR="${ssldir}"
17      SSL_CFLAGS="-I$ssldir/include -I$ssldir/include/openssl";
18      break;
19    fi
20    if test -f "$dir/include/ssl.h"; then
21      found_ssl="yes";
22      SSL_DIR="${ssldir}"
23      SSL_CFLAGS="-I$ssldir/include/";
24      break
25    fi
26 done
27 AC_MSG_RESULT($found_ssl)
28 if test x_$found_ssl != x_yes; then
29    AC_MSG_ERROR([
30 ----------------------------------------------------------------------
31   Cannot find SSL libraries.
32
33   Please install OpenSSL or specify installation directory with
34   --with-ssl=(dir).
35 ----------------------------------------------------------------------
36 ])
37 else
38         printf "OpenSSL found in $ssldir\n";
39         SSL_LIBS="-lssl -lcrypto";
40         SSL_LDFLAGS="-L$ssldir/lib";
41         AC_DEFINE_UNQUOTED([USE_OPENSSL],[1],
42           ["Define to 1 if you want to use the OpenSSL crypto library"])
43         AC_SUBST(SSL_CFLAGS)
44         AC_SUBST(SSL_LDFLAGS)
45         AC_SUBST(SSL_LIBS)
46 fi
47 ])dnl