]> arthur.barton.de Git - netatalk.git/commitdiff
First autoconf macro.
authorsrittau <srittau>
Sat, 27 Oct 2001 13:13:59 +0000 (13:13 +0000)
committersrittau <srittau>
Sat, 27 Oct 2001 13:13:59 +0000 (13:13 +0000)
macros/Makefile.am [new file with mode: 0644]
macros/ssl-check.m4 [new file with mode: 0644]

diff --git a/macros/Makefile.am b/macros/Makefile.am
new file mode 100644 (file)
index 0000000..76ba78a
--- /dev/null
@@ -0,0 +1,2 @@
+EXTRA_DIST = \
+       ssl-check.m4
diff --git a/macros/ssl-check.m4 b/macros/ssl-check.m4
new file mode 100644 (file)
index 0000000..173ba1b
--- /dev/null
@@ -0,0 +1,58 @@
+dnl $Id: ssl-check.m4,v 1.1 2001-10-27 13:13:59 srittau Exp $
+dnl Autoconf macro to check for SSL or OpenSSL
+
+AC_DEFUN([AC_PATH_SSL], [
+       tryssl=yes
+
+       AC_ARG_WITH(ssl-dir, [
+  --with-ssl-dir=PATH     specify path to OpenSSL installation (must contain
+                          lib and include dirs)],
+               [
+                       if test "x$withval" != "xno"; then
+                               tryssldir=$withval
+                       else
+                               tryssl=no
+                       fi
+               ]
+       )
+
+       SSL_CFLAGS=""
+       SSL_LIBS=""
+       compile_ssl=no
+
+       if test "$tryssl" = "yes"; then
+               AC_MSG_CHECKING([for SSL])
+               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
+                       if test -f "$ssldir/include/openssl/cast.h" ; then
+                               SSL_CFLAGS="$SSL_CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
+                               SSL_LIBS="$SSL_LIBS -L$ssldir/lib -L$ssldir -lcrypto"
+                               if test "$need_dash_r" = "yes"; then
+                                       SSL_LIBS="$SSL_LIBS -R$ssldir/lib -R$ssldir"
+                               fi
+                               AC_MSG_RESULT([$ssldir (enabling RANDNUM and DHX support)])
+
+                               dnl Check for the crypto library:
+                               AC_CHECK_LIB(crypto, main)
+                               dnl Check for "DES" library (for SSLeay, not openssl):
+                               AC_CHECK_LIB(des, main)
+
+                               dnl FIXME: do that temporarily
+                               LDFLAGS="$LDFLAGS -L$ssldir/lib -L$ssldir"
+                               CFLAGS="$CFLAGS -I$ssldir/include -I$ssldir/include/openssl"
+                               if test "$need_dash_r" = "yes"; then
+                                       LIBS="$LIBS -R$ssldir/lib -R$ssldir"
+                               fi
+
+                               AC_DEFINE(OPENSSL_DHX,  1)
+                               AC_DEFINE(UAM_DHX,      1)
+                               compile_ssl=yes
+                               break
+                       fi
+               done
+               if test "x$compile_ssl" = "xno"; then
+                       AC_MSG_RESULT([no])
+               fi
+       fi
+       AC_SUBST(SSL_CFLAGS)
+       AC_SUBST(SSL_LIBS)
+])