]> arthur.barton.de Git - netatalk.git/blob - macros/ssl-check.m4
Don't assume offsets, specify the struct member. (Olaf)
[netatalk.git] / macros / ssl-check.m4
1 dnl $Id: ssl-check.m4,v 1.6 2003-01-26 16:40:46 srittau Exp $
2 dnl Autoconf macro to check for SSL or OpenSSL
3
4 AC_DEFUN([AC_PATH_SSL], [
5         AC_ARG_WITH(ssl-dir, [  --with-ssl-dir=PATH     specify path to OpenSSL installation (must contain
6                           lib and include dirs)],
7                 [
8                         if test "x$withval" = "xno"; then
9                                 tryssl=no
10                         elif test "x$withval" = "xyes"; then
11                                 tryssl=yes
12                                 tryssldir=
13                         else
14                                 dnl FIXME: should only try in $withval
15                                 tryssl=yes
16                                 tryssldir="$withval"
17                         fi
18                 ], [tryssl=yes]
19         )
20
21         SSL_CFLAGS=""
22         SSL_LIBS=""
23         compile_ssl=no
24
25         if test "$tryssl" = "yes"; then
26
27 dnl GnuTLS test
28
29                 AM_PATH_LIBGNUTLS_EXTRA(, [
30                         SSL_CFLAGS="$SSL_CFLAGS $LIBGNUTLS_EXTRA_CFLAGS"
31                         SSL_LIBS="$SSL_LIBS $LIBGNUTLS_EXTRA_LIBS"
32                         AC_DEFINE(GNUTLS_DHX, 1)
33                         AC_DEFINE(UAM_DHX,    1)
34                         compile_ssl=yes
35                 ], [
36
37 dnl OpenSSL test
38
39                         AC_MSG_CHECKING([for OpenSSL])
40                         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
41                                 if test -f "$ssldir/include/openssl/cast.h" ; then
42                                         SSL_CFLAGS="$SSL_CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
43                                         SSL_LIBS="$SSL_LIBS -L$ssldir/lib -L$ssldir -lcrypto"
44                                         if test "x$need_dash_r" = "xyes"; then
45                                                 SSL_LIBS="$SSL_LIBS -R$ssldir/lib -R$ssldir"
46                                         fi
47                                         AC_MSG_RESULT([$ssldir (enabling RANDNUM and DHX support)])
48
49 dnl FIXME: The following looks crude and probably doesn't work properly.
50                                         dnl Check for the crypto library:
51                                         AC_CHECK_LIB(crypto, main)
52                                         dnl Check for "DES" library (for SSLeay, not openssl):
53                                         AC_CHECK_LIB(des, main)
54
55                                         AC_DEFINE(OPENSSL_DHX,  1)
56                                         AC_DEFINE(UAM_DHX,      1)
57                                         compile_ssl=yes
58                                         break
59                                 fi
60                         done
61                         if test "x$compile_ssl" = "xno"; then
62                                 AC_MSG_RESULT([no])
63                         fi
64                 ])
65         fi
66         AC_SUBST(SSL_CFLAGS)
67         AC_SUBST(SSL_LIBS)
68 ])