]> arthur.barton.de Git - netatalk.git/blob - macros/ssl-check.m4
First autoconf macro.
[netatalk.git] / macros / ssl-check.m4
1 dnl $Id: ssl-check.m4,v 1.1 2001-10-27 13:13:59 srittau Exp $
2 dnl Autoconf macro to check for SSL or OpenSSL
3
4 AC_DEFUN([AC_PATH_SSL], [
5         tryssl=yes
6
7         AC_ARG_WITH(ssl-dir, [
8   --with-ssl-dir=PATH     specify path to OpenSSL installation (must contain
9                           lib and include dirs)],
10                 [
11                         if test "x$withval" != "xno"; then
12                                 tryssldir=$withval
13                         else
14                                 tryssl=no
15                         fi
16                 ]
17         )
18
19         SSL_CFLAGS=""
20         SSL_LIBS=""
21         compile_ssl=no
22
23         if test "$tryssl" = "yes"; then
24                 AC_MSG_CHECKING([for SSL])
25                 for ssldir in "" $tryssldir /usr /usr/local/openssl /usr/lib/openssl /usr/local/ssl /usr/lib/ssl /usr/local /usr/pkg /opt /opt/openssl /usr/local/ssl ; do
26                         if test -f "$ssldir/include/openssl/cast.h" ; then
27                                 SSL_CFLAGS="$SSL_CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
28                                 SSL_LIBS="$SSL_LIBS -L$ssldir/lib -L$ssldir -lcrypto"
29                                 if test "$need_dash_r" = "yes"; then
30                                         SSL_LIBS="$SSL_LIBS -R$ssldir/lib -R$ssldir"
31                                 fi
32                                 AC_MSG_RESULT([$ssldir (enabling RANDNUM and DHX support)])
33
34                                 dnl Check for the crypto library:
35                                 AC_CHECK_LIB(crypto, main)
36                                 dnl Check for "DES" library (for SSLeay, not openssl):
37                                 AC_CHECK_LIB(des, main)
38
39                                 dnl FIXME: do that temporarily
40                                 LDFLAGS="$LDFLAGS -L$ssldir/lib -L$ssldir"
41                                 CFLAGS="$CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
42                                 if test "$need_dash_r" = "yes"; then
43                                         LIBS="$LIBS -R$ssldir/lib -R$ssldir"
44                                 fi
45
46                                 AC_DEFINE(OPENSSL_DHX,  1)
47                                 AC_DEFINE(UAM_DHX,      1)
48                                 compile_ssl=yes
49                                 break
50                         fi
51                 done
52                 if test "x$compile_ssl" = "xno"; then
53                         AC_MSG_RESULT([no])
54                 fi
55         fi
56         AC_SUBST(SSL_CFLAGS)
57         AC_SUBST(SSL_LIBS)
58 ])