| 1 |
##### http://autoconf-archive.cryp.to/check_ssl.html |
| 2 |
# |
| 3 |
# SYNOPSIS |
| 4 |
# |
| 5 |
# CHECK_SSL |
| 6 |
# |
| 7 |
# DESCRIPTION |
| 8 |
# |
| 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. |
| 12 |
# |
| 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): |
| 18 |
# |
| 19 |
# HAVE_SSL = @HAVE_SSL@ |
| 20 |
# ifeq ($(HAVE_SSL),yes) |
| 21 |
# SRCS+= @srcdir@/my_file_that_needs_ssl.c |
| 22 |
# endif |
| 23 |
# |
| 24 |
# For bsd 'bmake' use: |
| 25 |
# |
| 26 |
# .if ${HAVE_SSL} == "yes" |
| 27 |
# SRCS+= @srcdir@/my_file_that_needs_ssl.c |
| 28 |
# .endif |
| 29 |
# |
| 30 |
# LAST MODIFICATION |
| 31 |
# |
| 32 |
# 2003-01-28 |
| 33 |
# |
| 34 |
# COPYLEFT |
| 35 |
# |
| 36 |
# Copyright (c) 2003 Mark Ethan Trostler <[email protected]> |
| 37 |
# |
| 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. |
| 41 |
|
| 42 |
AC_DEFUN([CHECK_SSL], |
| 43 |
[ |
| 44 |
for dir in $withval /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do |
| 45 |
ssldir="$dir" |
| 46 |
if test -f "$dir/include/openssl/ssl.h"; then |
| 47 |
found_ssl="yes"; |
| 48 |
CFLAGS="$CFLAGS -I$ssldir/include"; |
| 49 |
CXXFLAGS="$CXXFLAGS -I$ssldir/include"; |
| 50 |
break; |
| 51 |
fi |
| 52 |
if test -f "$dir/include/ssl.h"; then |
| 53 |
found_ssl="yes"; |
| 54 |
CFLAGS="$CFLAGS -I$ssldir/include/"; |
| 55 |
CXXFLAGS="$CXXFLAGS -I$ssldir/include/"; |
| 56 |
break |
| 57 |
fi |
| 58 |
done |
| 59 |
if test x_$found_ssl != x_yes; then |
| 60 |
AC_MSG_ERROR(Cannot find ssl libraries) |
| 61 |
else |
| 62 |
printf "OpenSSL found in $ssldir\n"; |
| 63 |
LIBS="$LIBS -lssl -lcrypto"; |
| 64 |
LDFLAGS="$LDFLAGS -L$ssldir/lib"; |
| 65 |
HAVE_SSL=yes |
| 66 |
fi |
| 67 |
AC_SUBST(HAVE_SSL) |
| 68 |
])dnl |