ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/hopm/trunk/m4/ax_arg_openssl.m4
Revision: 8853
Committed: Sat Feb 9 18:50:11 2019 UTC (7 years, 5 months ago) by michael
File size: 2933 byte(s)
Log Message:
- ax_arg_openssl.m4: minimum supported OpenSSL version is 1.0.1f now

File Contents

# User Rev Content
1 michael 6222 AC_DEFUN([AX_ARG_OPENSSL], [
2     AC_ARG_ENABLE(openssl,
3     [ --enable-openssl[=DIR] Enable LibreSSL/OpenSSL support (DIR optional).
4     --disable-openssl Disable LibreSSL/OpenSSL support. ],
5     [ cf_enable_openssl=$enableval ],
6     [ cf_enable_openssl="auto" ])
7     AC_MSG_CHECKING([for LibreSSL/OpenSSL])
8     if test "$cf_enable_openssl" != "no"; then
9     cf_openssl_basedir=""
10     if test "$cf_enable_openssl" != "auto" &&
11     test "$cf_enable_openssl" != "yes"; then
12     dnl Support for --enable-openssl=/some/place
13     cf_openssl_basedir="${cf_enable_openssl}"
14     else
15     dnl Do the auto-probe here. Check some common directory paths.
16     for dirs in /usr/local/ssl /usr/pkg /usr/local /usr/lib /usr/lib/ssl\
17     /opt /opt/openssl /usr/local/openssl; do
18     if test -f "${dirs}/include/openssl/opensslv.h"; then
19     cf_openssl_basedir="${dirs}"
20     break
21     fi
22     done
23     unset dirs
24     fi
25    
26     dnl Now check cf_openssl_found to see if we found anything.
27     if test ! -z "$cf_openssl_basedir"; then
28     if test -f "${cf_openssl_basedir}/include/openssl/opensslv.h"; then
29     CPPFLAGS="-I${cf_openssl_basedir}/include $CPPFLAGS"
30     LDFLAGS="-L${cf_openssl_basedir}/lib $LDFLAGS"
31     else
32     dnl OpenSSL wasn't found in the directory specified. Naughty
33     dnl administrator...
34     cf_openssl_basedir=""
35     fi
36     else
37     dnl Check for stock FreeBSD 4.x and 5.x systems, since their files
38     dnl are in /usr/include and /usr/lib. In this case, we don't want to
39     dnl change INCLUDES or LIBS, but still want to enable OpenSSL.
40     dnl We can't do this check above, because some people want two versions
41     dnl of OpenSSL installed (stock FreeBSD 4.x/5.x and /usr/local/ssl)
42     dnl and they want /usr/local/ssl to have preference.
43     if test -f "/usr/include/openssl/opensslv.h"; then
44     cf_openssl_basedir="/usr"
45     fi
46     fi
47    
48     dnl If we have a basedir defined, then everything is okay. Otherwise,
49     dnl we have a problem.
50     if test ! -z "$cf_openssl_basedir"; then
51     AC_MSG_RESULT([$cf_openssl_basedir])
52     cf_enable_openssl="yes"
53     else
54     AC_MSG_RESULT([not found. Please check your path.])
55     cf_enable_openssl="no"
56     fi
57     unset cf_openssl_basedir
58     else
59     dnl If --disable-openssl was specified
60     AC_MSG_RESULT([disabled])
61     fi
62    
63     AS_IF([test "$cf_enable_openssl" != "no"],
64 michael 8853 [AC_MSG_CHECKING(for LibreSSL or OpenSSL 1.0.1f and above)
65 michael 6222 AC_RUN_IFELSE([
66     AC_LANG_PROGRAM([
67     #include <openssl/opensslv.h>
68     #include <stdlib.h>],
69 michael 8853 [[ exit(!(OPENSSL_VERSION_NUMBER >= 0x1000106fL)); ]])],
70 michael 6222 [cf_openssl_version_ok=yes],
71     [cf_openssl_version_ok=no],
72     [cf_openssl_version_ok=no])
73    
74     AS_IF([test "$cf_openssl_version_ok" = "yes"],
75     [AC_MSG_RESULT(found)
76    
77     AC_CHECK_LIB(crypto, RSA_free)
78     AS_IF([test "$ac_cv_lib_crypto_RSA_free" = "yes"],
79     [AC_CHECK_LIB(ssl, SSL_connect)])
80     ],[AC_MSG_RESULT(no - LibreSSL/OpenSSL support disabled)
81     cf_enable_openssl="no"])])
82     ])