]> arthur.barton.de Git - netatalk.git/blob - macros/ssl-check.m4
apply parts of the netbsd build patch by Patrick Welche <prlw1@newn.cam.ac.uk>, mostl...
[netatalk.git] / macros / ssl-check.m4
1 dnl $Id: ssl-check.m4,v 1.12 2004-01-14 16:10:29 bfernhomberg Exp $
2 dnl Autoconf macro to check for SSL or OpenSSL
3
4 AC_DEFUN([AC_PATH_GCRYPT], [
5
6         GCRYPT_CFLAGS=""
7         GCRYPT_LIBS=""
8
9         search="yes"
10         errifnotfound="no"
11
12         AC_ARG_ENABLE(gcrypt, [  --disable-gcrypt        disable compilation with libgcrypt], [
13                 if test "x$enableval" != "xno"; then
14                         errifnotfound="yes"
15                 else
16                         search="no"
17                 fi
18         ])
19
20         GCRYPT_CONFIG=""
21         if test "x$search" == "xyes"; then
22                 AC_PATH_PROG([GCRYPT_CONFIG], [libgcrypt-config], [no])
23
24                 if test "x$GCRYPT_CONFIG" == "xno"; then
25                         if test "x$errifnotfound" == "xyes"; then
26                                 AC_MSG_ERROR([libgcrypt-config not found])
27                         fi
28                 else
29                         GCRYPT_CFLAGS="`$GCRYPT_CONFIG --cflags`"
30                         GCRYPT_LIBS="`$GCRYPT_CONFIG --libs`"
31                         AC_DEFINE(HAVE_GCRYPT, 1, [Define if libgcrypt is available])
32                 fi
33         fi
34
35         AC_SUBST(GCRYPT_CFLAGS)
36         AC_SUBST(GCRYPT_LIBS)
37         AM_CONDITIONAL(HAVE_GCRYPT, test "x$GCRYPT_CONFIG" != "xno")
38 ])
39
40 AC_DEFUN([AC_PATH_SSL], [
41         AC_ARG_WITH(ssl-dir, [  --with-ssl-dir=PATH     specify path to OpenSSL installation (must contain
42                           lib and include dirs)],
43                 [
44                         if test "x$withval" = "xno"; then
45                                 tryssl=no
46                         elif test "x$withval" = "xyes"; then
47                                 tryssl=yes
48                                 tryssldir=
49                         else
50                                 dnl FIXME: should only try in $withval
51                                 tryssl=yes
52                                 tryssldir="$withval"
53                         fi
54                 ], [tryssl=yes]
55         )
56
57         SSL_CFLAGS=""
58         SSL_LIBS=""
59         compile_ssl=no
60
61         if test "$tryssl" = "yes"; then
62                 AC_MSG_CHECKING([for SSL])
63                 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
64                         if test -f "$ssldir/include/openssl/cast.h" ; then
65                                 SSL_CFLAGS="$SSL_CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
66                                 SSL_LIBS="$SSL_LIBS -L$ssldir/lib -L$ssldir -lcrypto"
67                                 if test "x$need_dash_r" = "xyes"; then
68                                         SSL_LIBS="$SSL_LIBS -R$ssldir/lib -R$ssldir"
69                                 fi
70                                 AC_MSG_RESULT([$ssldir (enabling RANDNUM and DHX support)])
71
72                                 AC_DEFINE(OPENSSL_DHX,  1, [Define if the OpenSSL DHX modules should be built])
73                                 AC_DEFINE(UAM_DHX,      1, [Define if the DHX UAM modules should be compiled])
74                                 compile_ssl=yes
75                                 break
76                         fi
77                 done
78                 if test "x$compile_ssl" = "xno"; then
79                         AC_MSG_RESULT([no])
80                 fi
81         fi
82         AC_SUBST(SSL_CFLAGS)
83         AC_SUBST(SSL_LIBS)
84 ])