3fef464b55b7a5b06e2ec602b1c50c02a821707b
[oweals/tinc.git] / m4 / openssl.m4
1 dnl Check to find the OpenSSL headers/libraries
2
3
4 AC_DEFUN(tinc_OPENSSL,
5 [
6
7   AC_CACHE_CHECK([for openssl], tinc_cv_openssl_include,
8   [
9     AC_ARG_WITH(openssl,
10       [  --with-openssl=DIR      OpenSSL library and headers prefix],
11       [echo -ne 'prefix...'
12        openssl_lib="$withval/lib"
13        openssl_include="$withval/include"]
14     )
15     AC_ARG_WITH(openssl-include,
16       [  --with-openssl-include=DIR OpenSSL headers directory],
17       [echo -ne 'includes...'
18        openssl_include="$withvall"]
19     )
20     AC_ARG_WITH(openssl-lib,
21       [  --with-openssl-lib=DIR  OpenSSL library directory],
22       [echo -ne 'libraries...'
23        openssl_lib="$withval"]
24     )
25
26 if test "x$openssl_lib" != "x" ; then
27   LIBS="$LIBS -L$openssl_lib"
28 fi
29 if test "x$openssl_include" != "x" ; then
30   INCLUDES="$INCLUDES -I$openssl_include"
31 fi
32
33 AC_MSG_RESULT([done.])
34   ])
35
36 libcrypto=none
37 AC_CHECK_LIB(crypto, SHA1_version, [
38   libcrypto=yes
39 ])
40
41 if test $libcrypto = none; then
42   AC_MSG_ERROR(
43 [It seems like OpenSSL is not installed on this system.  But perhaps
44 you need to supply the exact location of the headers and libraries.
45 You can try running configure with the --with-openssl=/DIRECTORY
46 parameter.  If you installed the headers and libraries in a different
47 location you can use --with-openssl-include=/DIR and
48 --with-openssl-lib=/DIR.])
49
50 else
51   LIBS="$LIBS -lcrypto"
52 fi
53
54 ])