1AC_DEFUN([PDNS_WITH_LIBSSL], [
2  AC_MSG_CHECKING([whether we will be linking in OpenSSL libssl])
3  HAVE_LIBSSL=0
4  AC_ARG_WITH([libssl],
5    AS_HELP_STRING([--with-libssl],[use OpenSSL libssl @<:@default=auto@:>@]),
6    [with_libssl=$withval],
7    [with_libssl=auto],
8  )
9  AC_MSG_RESULT([$with_libssl])
10
11  AS_IF([test "x$with_libssl" != "xno"], [
12    AS_IF([test "x$with_libssl" = "xyes" -o "x$with_libssl" = "xauto"], [
13      PKG_CHECK_MODULES([LIBSSL], [libssl], [
14        [HAVE_LIBSSL=1]
15        AC_DEFINE([HAVE_LIBSSL], [1], [Define to 1 if you have OpenSSL libssl])
16        save_CFLAGS=$CFLAGS
17        save_LIBS=$LIBS
18        CFLAGS="$LIBSSL_CFLAGS $CFLAGS"
19        LIBS="$LIBSSL_LIBS -lcrypto $LIBS"
20        AC_CHECK_FUNCS([SSL_CTX_set_ciphersuites OCSP_basic_sign SSL_CTX_set_num_tickets SSL_CTX_set_keylog_callback SSL_CTX_get0_privatekey SSL_CTX_set_min_proto_version SSL_set_hostflags])
21        CFLAGS=$save_CFLAGS
22        LIBS=$save_LIBS
23
24      ], [ : ])
25    ])
26  ])
27  AM_CONDITIONAL([HAVE_LIBSSL], [test "x$LIBSSL_LIBS" != "x"])
28  AS_IF([test "x$with_libssl" = "xyes"], [
29    AS_IF([test x"$LIBSSL_LIBS" = "x"], [
30      AC_MSG_ERROR([OpenSSL libssl requested but libraries were not found])
31    ])
32  ])
33])
34