1 ##### http://autoconf-archive.cryp.to/check_ssl.html
9 # This macro will check various standard spots for OpenSSL including
10 # a user-supplied directory. The user uses '--with-ssl' or
11 # '--with-ssl=/path/to/ssl' as arguments to configure.
13 # If OpenSSL is found the include directory gets added to CFLAGS and
14 # CXXFLAGS as well as '-DHAVE_SSL', '-lssl' & '-lcrypto' get added to
15 # LIBS, and the libraries location gets added to LDFLAGS. Finally
16 # 'HAVE_SSL' gets set to 'yes' for use in your Makefile.in I use it
17 # like so (valid for gmake):
19 # HAVE_SSL = @HAVE_SSL@
20 # ifeq ($(HAVE_SSL),yes)
21 # SRCS+= @srcdir@/my_file_that_needs_ssl.c
24 # For bsd 'bmake' use:
26 # .if ${HAVE_SSL} == "yes"
27 # SRCS+= @srcdir@/my_file_that_needs_ssl.c
36 # Copyright (c) 2003 Mark Ethan Trostler <trostler@juniper.net>
38 # Copying and distribution of this file, with or without
39 # modification, are permitted in any medium without royalty provided
40 # the copyright notice and this notice are preserved.
44 dnl AC_MSG_CHECKING(if ssl is wanted)
46 [ --with-ssl enable ssl [will check /usr/local/ssl
47 /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr ]
49 dnl [ AC_MSG_RESULT(yes)
50 for dir in $withval /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
52 if test -f "$dir/include/openssl/ssl.h"; then
54 SSL_CFLAGS="$CFLAGS -I$ssldir/include/openssl -DHAVE_SSL";
56 SSL_CXXFLAGS="$CXXFLAGS -I$ssldir/include/openssl -DHAVE_SSL";
57 AC_SUBST(SSL_CXXFLAGS)
60 if test -f "$dir/include/ssl.h"; then
62 SSL_CFLAGS="$CFLAGS -I$ssldir/include/ -DHAVE_SSL";
64 SSL_CXXFLAGS="$CXXFLAGS -I$ssldir/include/ -DHAVE_SSL";
65 AC_SUBST(SSL_CXXFLAGS)
69 if test x_$found_ssl != x_yes; then
70 AC_MSG_ERROR(Cannot find ssl libraries)
72 printf "OpenSSL found in $ssldir\n";
73 SSL_LIBS="$LIBS -lssl -lcrypto";
75 SSL_LDFLAGS="$LDFLAGS -L$ssldir/lib";