Get rid of the annoying empty line
[tinc] / m4 / openssl.m4
1 dnl Check to find the OpenSSL headers/libraries
2
3
4 AC_DEFUN(tinc_OPENSSL,
5 [
6   AC_ARG_WITH(openssl,
7     [  --with-openssl=DIR      OpenSSL library and headers prefix],
8     [openssl_lib="$withval/lib"
9      openssl_include="$withval/include"]
10   )
11   AC_CACHE_CHECK([for openssl headers], tinc_cv_openssl_include,
12   [
13     AC_ARG_WITH(openssl-include,
14       [  --with-openssl-include=DIR OpenSSL headers directory],
15       [tinc_cv_openssl_include="$withval"],
16       [if test "x$openssl_include" = "x" ; then
17          tinc_cv_openssl_include="none given"
18        else
19          tinc_cv_openssl_include=$openssl_include
20        fi]
21     )
22   ])
23   AC_CACHE_CHECK([for openssl libraries], tinc_cv_openssl_lib,
24   [
25     AC_ARG_WITH(openssl-lib,
26       [  --with-openssl-lib=DIR  OpenSSL library directory],
27       [tinc_cv_openssl_lib="$withval"],
28       [if test "x$openssl_lib" = "x" ; then
29          tinc_cv_openssl_lib="none given"
30        else
31          tinc_cv_openssl_lib=$openssl_lib
32        fi]
33     )
34   ])
35
36 if test "$tinc_cv_openssl_lib" != "none given" ; then
37   LIBS="$LIBS -L$tinc_cv_openssl_lib"
38 fi
39 if test "$tinc_cv_openssl_include" != "none given" ; then
40   INCLUDES="$INCLUDES -I$tinc_cv_openssl_include"
41 fi
42
43 osi=none
44 AC_CHECK_HEADERS(evp.h rsa.h,
45 [osi=found
46  break])
47
48 if test "$osi" = "none" ; then
49   AC_CHECK_HEADERS(openssl/evp.h openssl/rsa.h,
50   [osi=found
51    break])
52 fi
53
54
55 libcrypto=none
56
57 if test "$osi" = "found" ; then
58   AC_CHECK_LIB(crypto, SHA1_version, [
59     libcrypto=yes
60   ])
61 fi
62
63 if test $libcrypto = none; then
64 cat <<EOF
65
66 It seems like OpenSSL is not installed on this system.  But perhaps
67 you need to supply the exact location of the headers and libraries.
68 You can try running configure with the --with-openssl=/DIRECTORY
69 parameter.  If you installed the headers and libraries in a different
70 location you can use --with-openssl-include=/DIR and
71 --with-openssl-lib=/DIR.
72
73 EOF
74
75   AC_MSG_ERROR(OpenSSL not found.)
76
77 else
78   LIBS="$LIBS -lcrypto"
79 fi
80
81 ])