source: trunk/m4/check-ssl.m4 @ 6695

Last change on this file since 6695 was 6695, checked in by charles, 14 years ago

#450: OpenSSL in FreeBSD basesystem doesn't have openssl.pc

File size: 2.0 KB
Line 
1# ===========================================================================
2#               http://autoconf-archive.cryp.to/check_ssl.html
3# ===========================================================================
4#
5# SYNOPSIS
6#
7#   CHECK_SSL
8#
9# DESCRIPTION
10#
11#   This macro will check various standard spots for OpenSSL including a
12#   user-supplied directory. The user uses '--with-ssl' or
13#   '--with-ssl=/path/to/ssl' as arguments to configure.
14#
15#   If OpenSSL is found the include directory gets added to CFLAGS and
16#   CXXFLAGS as well as '-DHAVE_SSL', '-lssl' & '-lcrypto' get added to
17#   LIBS, and the libraries location gets added to LDFLAGS. Finally
18#   'HAVE_SSL' gets set to 'yes' for use in your Makefile.in I use it like
19#   so (valid for gmake):
20#
21#       HAVE_SSL = @HAVE_SSL@
22#       ifeq ($(HAVE_SSL),yes)
23#           SRCS+= @srcdir@/my_file_that_needs_ssl.c
24#       endif
25#
26#   For bsd 'bmake' use:
27#
28#       .if ${HAVE_SSL} == "yes"
29#           SRCS+= @srcdir@/my_file_that_needs_ssl.c
30#       .endif
31#
32# LAST MODIFICATION
33#
34#   2008-04-12
35#
36# COPYLEFT
37#
38#   Copyright (c) 2008 Mark Ethan Trostler <trostler@juniper.net>
39#
40#   Copying and distribution of this file, with or without modification, are
41#   permitted in any medium without royalty provided the copyright notice
42#   and this notice are preserved.
43
44AC_DEFUN([CHECK_SSL],
45[
46    AC_MSG_CHECKING([for OpenSSL])
47
48    for dir in $withval /usr/local/ssl /usr/lib/ssl /usr/ssl /usr/pkg /usr/local /usr; do
49        ssldir="$dir"
50        if test -f "$dir/include/openssl/ssl.h"; then
51            found_ssl="yes";
52            OPENSSL_CFLAGS="-I$ssldir/include";
53            break;
54        fi
55        if test -f "$dir/include/ssl.h"; then
56            found_ssl="yes";
57            OPENSSL_CFLAGS="-I$ssldir/include";
58            break
59        fi
60    done
61    if test x_$found_ssl != x_yes; then
62        AC_MSG_ERROR([Cannot locate ssl])
63    else
64        AC_MSG_RESULT([$ssldir])
65        OPENSSL_LIBS="-L$ssldir/lib -lssl -lcrypto";
66    fi
67])dnl
68
Note: See TracBrowser for help on using the repository browser.