forked from OpenLI-NZ/openli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigure.ac
141 lines (107 loc) · 4.72 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
# Super primitive configure script
AC_INIT(openli, 1.0.3, [email protected])
AM_INIT_AUTOMAKE([subdir-objects])
AC_CONFIG_SRCDIR(src/collector/collector.c)
AM_CONFIG_HEADER(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
AC_PROG_LIBTOOL
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=
AC_CHECK_LIB([trace], [trace_increment_packet_refcount],,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],libssl_found=1,)
AC_CHECK_LIB([crypto], [ERR_load_crypto_strings],libcrypto_found=1,)
AC_CHECK_LIB([crypto], [EVP_CIPHER_CTX_new],libcrypto_found=1,)
if test "x$libzmq_found" = "x1"; then
COLLECTOR_LIBS="$COLLECTOR_LIBS -lzmq"
fi
AC_CHECK_HEADERS([uthash.h], [uthash_avail=yes; break;])
AC_CHECK_HEADERS([syslog.h])
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([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
COLLECTOR_LIBS="$COLLECTOR_LIBS -losipparser2"
fi
if test "x$enable_collector" != "xno" -o "x$enable_mediator" != "xno"; then
AC_CHECK_LIB([wandder], [init_wandder_encoder],libwandder_found=1,libwandder_found=0)
if test "$libwandder_found" = 0; then
AC_MSG_ERROR(Required library libwandder not found; use LDFLAGS to specify library location)
fi
AC_CHECK_LIB([Judy], [JudySLGet],libjudy_found=1,libjudy_found=0)
if test "$libjudy_found" = 0; then
AC_MSG_ERROR(Required library libjudy not found; use LDFLAGS to specify library location)
fi
COLLECTOR_LIBS="$COLLECTOR_LIBS -lJudy -lwandder"
MEDIATOR_LIBS="$MEDIATOR_LIBS -lJudy -lwandder"
fi
if test "$libtrace_found" = 0; then
AC_MSG_ERROR(Required library libtrace 4.0.4 not found; use LDFLAGS to specify library location)
fi
if test "$libssl_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 "$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_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
}