xref: /freebsd/contrib/ntp/sntp/libevent/m4/libevent_openssl.m4 (revision f4b37ed0f8b307b1f3f0f630ca725d68f1dff30d)
1dnl ######################################################################
2dnl OpenSSL support
3AC_DEFUN([LIBEVENT_OPENSSL], [
4AC_REQUIRE([NTP_PKG_CONFIG])dnl
5
6case "$enable_openssl" in
7 yes)
8    have_openssl=no
9    case "$PKG_CONFIG" in
10     '')
11	;;
12     *)
13	OPENSSL_LIBS=`$PKG_CONFIG --libs openssl 2>/dev/null`
14	case "$OPENSSL_LIBS" in
15	 '') ;;
16	 *) OPENSSL_LIBS="$OPENSSL_LIBS $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD"
17	    have_openssl=yes
18	    ;;
19	esac
20	OPENSSL_INCS=`$PKG_CONFIG --cflags openssl 2>/dev/null`
21	;;
22    esac
23    case "$have_openssl" in
24     yes) ;;
25     *)
26	save_LIBS="$LIBS"
27	LIBS=""
28	OPENSSL_LIBS=""
29	AC_SEARCH_LIBS([SSL_new], [ssl],
30	    [have_openssl=yes
31	    OPENSSL_LIBS="$LIBS -lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD"],
32	    [have_openssl=no],
33	    [-lcrypto $EV_LIB_GDI $EV_LIB_WS32 $OPENSSL_LIBADD])
34	LIBS="$save_LIBS"
35	;;
36    esac
37    AC_SUBST(OPENSSL_INCS)
38    AC_SUBST(OPENSSL_LIBS)
39    case "$have_openssl" in
40     yes)  AC_DEFINE(HAVE_OPENSSL, 1, [Define if the system has openssl]) ;;
41    esac
42    ;;
43esac
44
45# check if we have and should use openssl
46AM_CONDITIONAL(OPENSSL, [test "$enable_openssl" != "no" && test "$have_openssl" = "yes"])
47])
48