summaryrefslogtreecommitdiffstats
blob: 0534e3356c04fbcea395c62b9cf98031eac311ed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# Author: Remko Tronçon

AC_DEFUN([AX_OPENSSL],
[
	AC_ARG_WITH(
		[openssl],
		AC_HELP_STRING([--with-openssl=@<:@ARG@:>@],[Path to OpenSSL installation]),
		[
			WITH_OPENSSL="$withval"
			if test "$withval" != "no" -a "$withval" != "yes"; then
				OPENSSL_CPPFLAGS="-I$withval/include"
				case $host in
					*-*-cygwin*|*-mingw32*)
						OPENSSL_LIBS="-L$withval/lib/VC -leay32MT $withval/lib/VC/ssleay32MT.lib"
						;;
					*)
						OPENSSL_LIBS="-L$withval/lib -lssl -lcrypto"
				esac
				CPPFLAGS="$CPPFLAGS $OPENSSL_CPPFLAGS"
				LDFLAGS="$LDFLAGS $OPENSSL_LIBS"
			fi
		],
		[
			WITH_OPENSSL="yes"
			case $host in
				*-*-cygwin*|*-mingw32*)
					AC_MSG_ERROR([--with-openssl parameter is required on Windows])
				;;
				*)
					OPENSSL_LIBS="-lssl -lcrypto"
			esac
		])

	if test "$WITH_OPENSSL" != "no"; then
		AC_CHECK_HEADER(openssl/ssl.h, [HAVE_OPENSSL=yes], [])
	fi
])