forked from OpenLI-NZ/openli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
202 lines (157 loc) · 7.28 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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
# Super primitive configure script
AC_INIT([openli],[1.1.10],[[email protected]])
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_SRCDIR(src/collector/collector.c)
AC_CONFIG_HEADERS(config.h)
AC_CONFIG_MACRO_DIR([m4])
m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
AC_PREFIX_DEFAULT(/usr/local/)
AC_PROG_CC
AC_PROG_INSTALL
LT_INIT
EXTRA_LIBS=""
AC_ARG_ENABLE([mediator], AS_HELP_STRING([--disable-mediator],
[Disable building the OpenLI mediator]))
AC_ARG_ENABLE([provisioner], AS_HELP_STRING([--disable-provisioner],
[Disable building the OpenLI provisioner]))
AC_ARG_ENABLE([collector], AS_HELP_STRING([--disable-collector],
[Disable building the OpenLI collector]))
PKG_PROG_PKG_CONFIG
AC_ARG_WITH([systemdsystemunitdir],
AS_HELP_STRING([--with-systemdsystemunitdir=DIR], [Directory for systemd service files]),
[], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir"])
PROVISIONER_LIBS=
COLLECTOR_LIBS=
MEDIATOR_LIBS=
PROVISIONER_CFLAGS=
AC_CHECK_LIB([trace], [trace_get_radius],,libtrace_found=0)
AC_CHECK_LIB([yaml], [yaml_document_get_node],,libyaml_found=0)
AC_CHECK_LIB([zmq], [zmq_poll],libzmq_found=1,libzmq_found=0)
AC_CHECK_LIB([m], [pow],,libm_found=0)
AC_CHECK_LIB([ssl], [SSL_library_init],libssl_found=1,)
AC_CHECK_LIB([ssl], [OPENSSL_init_ssl],libssl11_found=1,)
AC_CHECK_LIB([crypto], [ERR_load_crypto_strings],libcrypto_found=1,)
AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_new],libcrypto_found=1,)
AC_CHECK_LIB([rabbitmq], [amqp_new_connection],rabbit_found=1,rabbit_found=0)
AC_CHECK_LIB([Judy], [JudySLGet],,libjudy_found=0)
if test "x$libzmq_found" = "x1"; then
COLLECTOR_LIBS="$COLLECTOR_LIBS -lzmq"
fi
if test "x$libssl11_found" = "x1"; then
AC_DEFINE(HAVE_LIBSSL_11, 1, [defined to 1 if the system is using libssl 1.1])
fi
AC_CHECK_HEADERS([uthash.h], [uthash_avail=yes; break;])
AC_CHECK_HEADERS([syslog.h])
AC_CHECK_HEADER(amqp.h, ampq_h_found=1, amqp_h_found=0)
AC_CONFIG_FILES([Makefile src/Makefile extlib/Makefile
extlib/libpatricia/Makefile])
AS_IF([test "x$uthash_avail" != "xyes"],
[AC_MSG_ERROR([Required header uthash.h not found; install uthash and try again])])
if test "x$enable_collector" != "xno"; then
AC_CHECK_LIB([tcmalloc], [tc_version],,libtcmalloc_found=0)
AC_CHECK_LIB([z], [inflateEnd],,libz_found=0)
if test "$libz_found" = 0; then
AC_MSG_ERROR(Required library libz not found; use LDFLAGS to specify library location)
fi
AC_CHECK_LIB([osipparser2], [osip_message_init],libosip2_found=1,libosip2_found=0)
if test "$libosip2_found" = 0; then
AC_MSG_ERROR(Required library libosipparser2 not found; use LDFLAGS to specify library location)
fi
AC_CHECK_LIB([b64], [base64_decode_block],libb64_found=1,libb64_found=0)
if test "$libb64_found" = 0; then
AC_MSG_ERROR(Required library libb64 not found; use LDFLAGS to specify library location)
fi
COLLECTOR_LIBS="$COLLECTOR_LIBS -losipparser2 -lb64 -lz"
fi
if test "x$enable_provisioner" != "xno" -o "x$enable_collector" != "xno"; then
AC_CHECK_LIB([microhttpd], [MHD_destroy_post_processor],libmicrohttpd_found=1,libmicrohttpd_found=0)
if test "$libmicrohttpd_found" = 0; then
AC_MSG_ERROR(Required library libmicrohttpd not found; use LDFLAGS to specify library location)
fi
COLLECTOR_LIBS="$COLLECTOR_LIBS -lmicrohttpd"
PROVISIONER_LIBS="$PROVISIONER_LIBS -lmicrohttpd"
fi
if test "x$enable_provisioner" != "xno"; then
AC_CHECK_LIB([json-c], [json_tokener_new],libjsonc_found=1,libjsonc_found=0)
if test "$libjsonc_found" = 0; then
AC_MSG_ERROR(Required library libjson-c not found; use LDFLAGS to specify library location)
fi
PROVISIONER_LIBS="$PROVISIONER_LIBS -ljson-c"
if test "x$libssl11_found" = "x1"; then
AC_CHECK_LIB([sqlcipher], [sqlite3_key], sqlcipher_found=1, sqlcipher_found=0)
if test "$sqlcipher_found" = 0; then
AC_MSG_ERROR(Required library libsqlcipher not found; use LDFLAGS to specify library location)
fi
AC_DEFINE(HAVE_SQLCIPHER, 1, [defined to 1 if SQLCipher is available])
PROVISIONER_LIBS="$PROVISIONER_LIBS -lsqlcipher"
PROVISIONER_CFLAGS="-DSQLITE_HAS_CODEC"
fi
fi
if test "x$enable_collector" != "xno" -o "x$enable_mediator" != "xno"; then
AC_CHECK_LIB([wandder], [wandder_decode_integer_value],libwandder_found=1,libwandder_found=0)
if test "$libwandder_found" = 0; then
AC_MSG_ERROR(Required library libwandder 2.0.6 or later not found; use LDFLAGS to specify library location)
fi
COLLECTOR_LIBS="$COLLECTOR_LIBS -lwandder"
MEDIATOR_LIBS="$MEDIATOR_LIBS -lwandder"
fi
if test "$libtrace_found" = 0; then
AC_MSG_ERROR(Required library libtrace 4.0.14 not found; use LDFLAGS to specify library location)
fi
if test "$libssl_found" != 1 -a "$libssl11_found" != 1; then
AC_MSG_ERROR(Required library libssl not found; use LDFLAGS to specify library location)
else
COLLECTOR_LIBS="$COLLECTOR_LIBS -lssl"
MEDIATOR_LIBS="$MEDIATOR_LIBS -lssl"
PROVISIONER_LIBS="$PROVISIONER_LIBS -lssl"
fi
if test "$libcrypto_found" != 1; then
AC_MSG_ERROR(Required library libcrypto not found; use LDFLAGS to specify library location)
else
COLLECTOR_LIBS="$COLLECTOR_LIBS -lcrypto"
MEDIATOR_LIBS="$MEDIATOR_LIBS -lcrypto"
PROVISIONER_LIBS="$PROVISIONER_LIBS -lcrypto"
fi
if test "$libjudy_found" = 0; then
AC_MSG_ERROR(Required library libjudy not found; use LDFLAGS to specify library location)
fi
if test "$rabbit_found" != 1; then
AC_MSG_ERROR(Required library librabbitmq not found; use LDFLAGS to specify library location)
else
if test "$amqp_h_found" = 0; then
AC_MSG_ERROR(Required headers for librabbitmq not found; use CFLAGS to specify header location)
else
COLLECTOR_LIBS="$COLLECTOR_LIBS -lrabbitmq"
MEDIATOR_LIBS="$MEDIATOR_LIBS -lrabbitmq"
PROVISIONER_LIBS="$PROVISIONER_LIBS -lrabbitmq"
fi
fi
if test "$libyaml_found" = 0; then
AC_MSG_ERROR(Required library libyaml not found; use LDFLAGS to specify library location)
fi
if test "$libzmq_found" = 0; then
AC_MSG_ERROR(Required library libzmq not found; use LDFLAGS to specify library location)
fi
AM_CONDITIONAL([BUILD_MEDIATOR], [test "x$enable_mediator" != "xno"])
AM_CONDITIONAL([BUILD_PROVISIONER], [test "x$enable_provisioner" != "xno"])
AM_CONDITIONAL([BUILD_COLLECTOR], [test "x$enable_collector" != "xno"])
AC_SUBST([ADD_LIBS])
AC_SUBST([EXTRA_LIBS])
AC_SUBST([ADD_LDFLAGS])
AC_SUBST([ADD_INCLS])
AC_SUBST([LTLIBOBJS])
AC_SUBST([COLLECTOR_LIBS])
AC_SUBST([MEDIATOR_LIBS])
AC_SUBST([PROVISIONER_LIBS])
AC_SUBST([PROVISIONER_CFLAGS])
AC_OUTPUT
# Function for reporting whether an option was set or not
reportopt() {
if test x"$2" = xtrue -o x"$2" = xyes; then
AC_MSG_NOTICE([$1: Yes])
else
AC_MSG_NOTICE([$1: No])
fi
}