forked from danharkins/est
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.ac
133 lines (116 loc) · 3.22 KB
/
configure.ac
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
dnl Process this file with autoconf to produce a configure script
AC_INIT([est], [1.0.0],[[email protected]])
AC_COPYRIGHT([Copyright (c) 2014 Dan Harkins, <[email protected]>
This configure script may be copied, distributed and modified under
the terms of the license included with this distribution; see COPYING
for more details])
AC_CONFIG_SRCDIR(client/cest.c)
AC_CONFIG_SRCDIR(server/sest.c)
AC_CONFIG_SRCDIR(ca/ca.c)
AC_CONFIG_SRCDIR(ecca/ecca.c)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE
AC_PROG_CC
AC_ARG_WITH([curl],
[AS_HELP_STRING([--with-curl=PATH], [location of libcurl])],
[curldir="$withval" custom_curl="yes"],
[curldir="/usr/lib" custom_curl="no"]
)
AC_ARG_WITH(ssl,
AS_HELP_STRING([--with-ssl=PATH], [location of OpenSSL]),
[ssldir="$withval" custom_ssl="yes"],
[ssldir="/usr/local/ssl" custom_ssl="no"]
)
CFLAGS="$CFLAGS -Wall -I$curldir/include"
LDFLAGS="$LDFLAGS -L$curldir/lib -L$curldir/lib/.libs"
CFLAGS="$CFLAGS -Wall -I$ssldir/include"
LDFLAGS="$LDFLAGS -L$ssldir/lib -L$ssldir"
AC_MSG_CHECKING([enable-debugging])
AC_ARG_ENABLE(debug,
AC_HELP_STRING([--enable-debug],[Enable debugging]) [],
[ case "$enableval" in
yes)
AC_MSG_RESULT(yes)
CFLAGS="$CFLAGS -g"
;;
*) AC_MSG_RESULT(no)
;;
esac ],
AC_MSG_RESULT(no)
)
AC_CANONICAL_HOST
case $host in
*-linux*)
AC_CHECK_LIB([dl], [dlopen], [],
[AC_MSG_FAILURE([can't find libdl])],
[])
AC_CHECK_LIB([pthread], pthread_create, [],
[AC_MSG_FAILURE([can't find pthread])],
[])
AC_ARG_ENABLE(static,
AS_HELP_STRING([--enable-static], [build static]),
LDFLAGS="$LDFLAGS -static",
[givemsg="yes" ld_msg="LD_LIBRARY_PATH"]
)
;;
*-darwin*)
dnl static building is not supported on OSX
givemsg="yes"
ld_msg="DYLD_LIBRARY_PATH"
;;
*-freebsd*)
AC_CHECK_LIB([z], [zlibVersion], [],
[AC_MSG_FAILURE([can't find libz])],
[])
AC_CHECK_LIB([pthread], pthread_create, [],
[AC_MSG_FAILURE([can't find pthread])],
[])
AC_ARG_ENABLE(static,
AS_HELP_STRING([--enable-static], [build static]),
LDFLAGS="$LDFLAGS -static",
[givemsg="yes" ld_msg="LD_LIBRARY_PATH"]
)
;;
*)
AC_MSG_ERROR([EST has not been ported to your OS yet])
esac
AC_CHECK_LIB([crypto], [X509_REQ_new], [],
[AC_MSG_FAILURE([can't find libcrypto])],
[])
AC_CHECK_LIB([ssl], [TLSv1_2_server_method], [],
tls_version_bad=yes,
[])
if test "x$tls_version_bad" = 'xyes'; then
AC_CHECK_LIB([ssl], [TLSv1_server_method],
AC_DEFINE(OPENSSL_VERSION_TLSV1, 1, [old TLS version])
AC_SUBST(OPENSSL_VERSION_TLSV1, [1]),
[AC_MSG_FAILURE([can't find libssl])],
[])
fi
AC_CHECK_LIB([curl], [curl_easy_setopt], [],
[AC_MSG_FAILURE([can't find libcurl])],
[])
AC_MSG_CHECKING([whether to include TLS-pwd support])
AC_ARG_ENABLE(tlspwd,
AC_HELP_STRING([--enable-tlspwd],[Enable TLS-pwd support]) [],
[ case "$enableval" in
yes)
AC_MSG_RESULT(yes)
AC_DEFINE(OPENSSL_HAS_TLS_PWD, 1, [to enable tlspwd])
AC_SUBST(OPENSSL_HAS_TLS_PWD, [1])
;;
*) AC_MSG_RESULT(no)
;;
esac ],
AC_MSG_RESULT(no)
)
AC_CONFIG_FILES([Makefile \
client/Makefile \
server/Makefile \
ca/Makefile \
ecca/Makefile
])
AC_OUTPUT
if test "x$givemsg" = 'xyes'; then
AC_MSG_NOTICE([Be sure to set $ld_msg appropriately])
fi