2
# Process this file with autoconf to produce a configure script.
5
AC_CONFIG_SRCDIR([src])
9
#VERSION=`cat $srcdir/version.h | grep "#define VERSION " | sed -e 's/^.*\"\(.*\)\"/\1/'`
11
VERSION=`cat src/version.h | grep "#define VERSION " | sed -e 's/^.*\"\(.*\)\"/\1/'`
13
AC_C_BIGENDIAN(AC_SUBST([ENDIAN],[big]),AC_SUBST([ENDIAN],[little]))
17
[ --disable-mysql Disable MySQL support.],
18
[ MYSQL="$enableval"],
22
AC_ARG_WITH(mysql_includes,
23
[ --with-mysql-includes=DIR MySQL include directory],
24
[with_mysql_includes="$withval"],[with_mysql_includes="no"])
26
AC_ARG_WITH(mysql_libraries,
27
[ --with-mysql-libraries=DIR MySQL library directory],
28
[with_mysql_libraries="$withval"],[with_mysql_libraries="no"])
30
if test "x$with_mysql_includes" != "xno"; then
31
CPPFLAGS="${CPPFLAGS} -I${with_mysql_includes}"
34
if test "x$with_mysql_libraries" != "xno"; then
35
LDFLAGS="${LDFLAGS} -L${with_mysql_libraries}"
39
AC_ARG_ENABLE(postgresql,
40
[ --disable-postgresql Disable PostgreSQL support.],
41
[ POSTGRES="$enableval"],
45
AC_ARG_WITH(postgresql_includes,
46
[ --with-postgresql-includes=DIR PostgreSQL include directory],
47
[with_postgresql_includes="$withval"],[with_postgresql_includes="no"])
49
AC_ARG_WITH(postgresql_libraries,
50
[ --with-postgresql-libraries=DIR PostgreSQL library directory],
51
[with_postgresql_libraries="$withval"],[with_postgresql_libraries="no"])
53
if test "x$with_postgresql_includes" != "xno"; then
54
CPPFLAGS="${CPPFLAGS} -I${with_postgresql_includes}"
57
if test "x$with_postgresql_libraries" != "xno"; then
58
LDFLAGS="${LDFLAGS} -L${with_postgresql_libraries}"
63
[ --disable-esmtp Disable libesmtp support.],
64
[ ESMTP="$enableval"],
68
AC_ARG_WITH(esmtp_includes,
69
[ --with-esmtp-includes=DIR libesmtp include directory],
70
[with_esmtp_includes="$withval"],[with_esmtp_includes="no"])
72
AC_ARG_WITH(esmtp_libraries,
73
[ --with-esmtp-libraries=DIR libesmtp library directory],
74
[with_esmtp_libraries="$withval"],[with_esmtp_libraries="no"])
76
if test "x$with_esmtp_includes" != "xno"; then
77
CPPFLAGS="${CPPFLAGS} -I${with_esmtp_includes}"
80
if test "x$with_esmtp_libraries" != "xno"; then
81
LDFLAGS="${LDFLAGS} -L${with_esmtp_libraries}"
85
AC_ARG_ENABLE(prelude,
86
[ --disable-prelude Disable Prelude support.],
87
[ PRELUDE="$enableval"],
91
AC_ARG_WITH(prelude_includes,
92
[ --with-prelude-includes=DIR libprelude include directory],
93
[with_prelude_includes="$withval"],[with_prelude_includes="no"])
95
AC_ARG_WITH(prelude_libraries,
96
[ --with-prelude-libraries=DIR libprelude library directory],
97
[with_prelude_libraries="$withval"],[with_prelude_libraries="no"])
99
if test "x$with_prelude_includes" != "xno"; then
100
CPPFLAGS="${CPPFLAGS} -I${with_prelude_includes}"
103
if test "x$with_prelude_libraries" != "xno"; then
104
LDFLAGS="${LDFLAGS} -L${with_prelude_libraries}"
107
AC_ARG_ENABLE(lognorm,
108
[ --disable-lognorm Disable Lognorm (liblognorm) support.],
109
[ LOGNORM="$enableval"],
113
AC_ARG_WITH(lognorm_includes,
114
[ --with-lognorm-includes=DIR liblognorm include directory],
115
[with_lognorm_includes="$withval"],[with_lognorm_includes="no"])
117
AC_ARG_WITH(lognorm_libraries,
118
[ --with-lognorm-libraries=DIR liblognorm library directory],
119
[with_lognorm_libraries="$withval"],[with_lognorm_libraries="no"])
121
if test "x$with_lognorm_includes" != "xno"; then
122
CPPFLAGS="${CPPFLAGS} -I${with_lognorm_includes}"
125
if test "x$with_lognorm_libraries" != "xno"; then
126
LDFLAGS="${LDFLAGS} -L${with_lognorm_libraries}"
130
AC_ARG_ENABLE(libpcap,
131
[ --disable-libpcap Disable libpcap (plog) support.],
132
[ LIBPCAP="$enableval"],
136
AC_ARG_WITH(libpcap_includes,
137
[ --with-libpcap-includes=DIR libpcap include directory],
138
[with_libpcap_includes="$withval"],[with_libpcap_includes="no"])
140
AC_ARG_WITH(libpcap_libraries,
141
[ --with-libpcap-libraries=DIR libpcap library directory],
142
[with_libpcap_libraries="$withval"],[with_libpcap_libraries="no"])
144
if test "x$with_libpcap_includes" != "xno"; then
145
CPPFLAGS="${CPPFLAGS} -I${with_libpcap_includes}"
148
if test "x$with_libpcap_libraries" != "xno"; then
149
LDFLAGS="${LDFLAGS} -L${with_libpcap_libraries}"
152
AC_ARG_ENABLE(libdnet,
153
[ --disable-libdnet Disable libdnet (unified2) support.],
154
[ LIBDNET="$enableval"],
158
AC_ARG_WITH(libdnet_includes,
159
[ --with-libdnet-includes=DIR libdnet include directory],
160
[with_libdnet_includes="$withval"],[with_libdnet_includes="no"])
162
AC_ARG_WITH(libdnet_libraries,
163
[ --with-libdnet-libraries=DIR libdnet library directory],
164
[with_libdnet_libraries="$withval"],[with_libdnet_libraries="no"])
166
if test "x$with_libdnet_includes" != "xno"; then
167
CPPFLAGS="${CPPFLAGS} -I${with_libdnet_includes}"
170
if test "x$with_libdnet_libraries" != "xno"; then
171
LDFLAGS="${LDFLAGS} -L${with_libdnet_libraries}"
176
AM_INIT_AUTOMAKE(sagan, ${VERSION})
177
AC_CONFIG_HEADER(config.h)
179
# Checks for programs.
185
# Checks for header files.
189
AC_CHECK_HEADERS([stdio.h stdlib.h sys/types.h unistd.h stdint.h inttypes.h pthread.h ctype.h errno.h fcntl.h sys/stat.h string.h getopt.h time.h pcre.h stdarg.h limits.h arpa/inet.h netinet/in.h sys/time.h sys/socket.h])
191
# Checks for typedefs, structures, and compiler characteristics.
195
# Checks for library functions.
196
AC_PROG_GCC_TRADITIONAL
198
AC_FUNC_SELECT_ARGTYPES
208
AC_CHECK_FUNCS([select strstr strchr strcmp strlen sizeof write snprintf strncat strlcat strlcpy getopt_long gethostbyname socket htons connect send recv dup2 strspn strdup])
210
AC_CHECK_LIB(pcre, main,,AC_MSG_ERROR(Sagan needs PCRE installed. Please see http://www.pcre.org.))
211
AC_CHECK_LIB(pthread, main,,AC_MSG_ERROR(Sagan needs pthreads!))
212
AC_CHECK_LIB(m, main,,AC_MSG_ERROR(Sagan needs libm!))
214
if test "$MYSQL" = "yes"; then
215
AC_MSG_RESULT([------- MySQL Support is enabled -------])
216
AC_CHECK_HEADER([mysql/mysql.h])
217
AC_CHECK_HEADER([mysql/errmsg.h])
218
AC_CHECK_LIB(mysqlclient_r, main,,AC_MSG_ERROR(The MySQL library libmysqlclient_r is missing!
219
If you're not interested in MySQL support use the --disable-mysql flag.))
222
if test "$POSTGRES" = "yes"; then
223
AC_MSG_RESULT([------- PostgreSQL support is enabled -------])
224
AC_CHECK_HEADER([libpq-fe.h])
225
AC_CHECK_LIB(pq, main,,AC_MSG_ERROR(The PostgreSQL library cannot be found.
226
If you're not interested in PostgreSQL support use the --disable-postgresql flag.))
229
if test "$ESMTP" = "yes"; then
230
AC_MSG_RESULT([------- libesmtp support is enabled -------])
231
AC_CHECK_HEADER([libesmtp.h])
232
AC_CHECK_LIB(esmtp, main,,AC_MSG_ERROR(The libesmtp library cannot be found.
233
If you're not interested in libesmtp support use the --disable-esmtp flag.))
236
if test "$PRELUDE" = "yes"; then
237
AC_MSG_RESULT([------- libprelude support is enabled -------])
238
AC_CHECK_HEADER([libprelude/prelude.h])
239
AC_CHECK_LIB(prelude, main,,AC_MSG_ERROR(The libprelude library cannot be found.
240
If you're not interested in Prelude support use the --disable-prelude flag.))
243
if test "$LOGNORM" = "yes"; then
244
AC_MSG_RESULT([------- liblognorm support is enabled -------])
245
#AC_CHECK_HEADER([libestr.h])
246
#AC_CHECK_HEADER([libee/libee.h])
247
#AC_CHECK_HEADER([lognorm.h])
248
AC_CHECK_HEADER([liblognorm.h])
249
#AC_CHECK_HEADER([ptree.h])
250
#AC_CHECK_HEADER([lognorm.h])
251
AC_CHECK_LIB(lognorm, main,,AC_MSG_ERROR(The liblognorm library cannot be found.
252
This library is important for the correlation aspects of Sagan! Please see
253
https://wiki.softwink.com/bin/view/Main/LibLogNorm. To disable this feature
254
use the --disable-lognorm flag. ))
257
if test "$LIBPCAP" = "yes"; then
258
AC_MSG_RESULT([------- libpcap support is enabled -------])
259
AC_CHECK_HEADER([pcap.h])
260
AC_CHECK_HEADER([net/if.h])
261
AC_CHECK_HEADER([net/if_arp.h])
262
AC_CHECK_HEADER([netinet/in_systm.h])
263
AC_CHECK_HEADER([netinet/if_ether.h])
264
AC_CHECK_HEADER([netinet/ip.h])
265
AC_CHECK_HEADER([netinet/udp.h])
266
AC_CHECK_LIB(pcap, main,,AC_MSG_ERROR(The libpcap library cannot be found.
267
This library is used to run Sagan in a syslog 'sniffer' mode. Please see
268
https://wiki.softwink.com/bin/view/Main/PLog. To disable this feature use
269
the --disable-libpcap flag. ))
272
if test "$LIBDNET" = "yes"; then
273
AC_MSG_RESULT([------- libdnet support is enabled -------])
274
AC_CHECK_HEADER([dnet.h])
275
AC_CHECK_LIB(dnet, main,,AC_MSG_ERROR(The libdnet library cannot be found.
276
This library is used for Sagan's Unified2 output support. Please see
277
https://wiki.softwink.com/bin/view/Main/Unified2Output for more information.
278
To disable this feature use the --disable-libdnet flag. ))
282
test "x$prefix" = x. || test "x$prefix" = xNONE && prefix=/usr/local
283
AC_DEFINE_UNQUOTED(CONFIG_FILE_PATH, "`eval echo "${sysconfdir}/sagan.conf"`", [Sagan configuration file])
285
AC_DEFINE_UNQUOTED(PACKAGE_NAME, "sagan" )
286
AC_DEFINE_UNQUOTED(PACKAGE_STRING, "Sagan $VERSION")
287
AC_DEFINE_UNQUOTED(PACKAGE_BUGREPORT, "sagan@mailman.softwink.com" )
288
AC_DEFINE_UNQUOTED(PACKAGE_TARNAME, "sagan" )
289
AC_DEFINE_UNQUOTED(PACKAGE_VERSION, "$VERSION" )
296
# AC_OUTPUT(Makefile)
300
AC_MSG_RESULT([ ,-._,-. Sagan has been configured!])
301
AC_MSG_RESULT([ \/)"(\/ ])
302
AC_MSG_RESULT([ (_o_) Champ Clark III & The Softwink Team: http://www.softwink.com])
303
AC_MSG_RESULT([ / \/) Copyright (C) 2009-2011 Softwink, Inc., et al.])
304
AC_MSG_RESULT([ (|| ||) ])
305
AC_MSG_RESULT([ oo-oo ])