-
Notifications
You must be signed in to change notification settings - Fork 9
/
configure.ac
214 lines (180 loc) · 7.77 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
202
203
204
205
206
207
208
209
210
211
212
213
# -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.67])
AC_INIT([Snort_AI_preproc], [0.1], [blacklight@autistici.org])
AM_INIT_AUTOMAKE([1.10 -Wall no-define])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_MACRO_DIR([m4])
LT_INIT
AC_PREFIX_DEFAULT(/usr)
test "$prefix" = "NONE" && prefix=/usr
case "$host" in
*-openbsd2.6|*-openbsd2.5|*-openbsd2.4|*-openbsd2.3*)
AC_DEFINE([OPENBSD],[1],[Define if OpenBSD])
AC_DEFINE([BROKEN_SIOCGIFMTU],[1],[Define if BROKEN_SIOCGIFMTU])
;;
*-openbsd*)
AC_DEFINE([OPENBSD],[1],[Define if OpenBSD < 2.3])
;;
*-sgi-irix5*)
AC_DEFINE([IRIX],[1],[Define if Irix 5])
no_libsocket="yes"
no_libnsl="yes"
if test -z "$GCC"; then
sgi_cc="yes"
fi
LDFLAGS="${LDFLAGS} -L/usr/local/lib"
extra_incl="-I/usr/local/include"
;;
*-sgi-irix6*)
AC_DEFINE([IRIX],[1],[Define if Irix 6])
no_libsocket="yes"
no_libnsl="yes"
if test -z "$GCC"; then
sgi_cc="yes"
fi
LDFLAGS="${LDFLAGS} -L/usr/local/lib"
extra_incl="-I/usr/local/include"
;;
*-solaris*)
AC_DEFINE([SOLARIS],[1],[Define if Solaris])
CPPFLAGS="${CPPFLAGS} -DBSD_COMP -D_REENTRANT"
rt_nanosleep="yes"
;;
*-sunos*)
AC_DEFINE([SUNOS],[1],[Define if SunOS])
sunos4="yes"
;;
*-linux*)
linux="yes"
AC_DEFINE([LINUX],[1],[Define if Linux])
# libpcap doesn't even LOOK at the timeout you give it under Linux
AC_DEFINE([PCAP_TIMEOUT_IGNORED],[1],[Define if pcap timeout is ignored])
AC_SUBST(extra_incl)
extra_incl="-I/usr/include/pcap"
;;
*-hpux10*|*-hpux11*)
AC_DEFINE([HPUX],[1],[Define if HP-UX 10 or 11])
AC_DEFINE([WORDS_BIGENDIAN],[1],[Define if words are big endian])
AC_SUBST(extra_incl)
extra_incl="-I/usr/local/include"
;;
*-freebsd*)
AC_DEFINE([FREEBSD],[1],[Define if FreeBSD])
;;
*-bsdi*)
AC_DEFINE([BSDI],[1],[Define if BSDi])
;;
*-aix*)
AC_DEFINE([AIX],[1],[Define if AIX])
;;
*-osf4*)
AC_DEFINE([OSF1],[1],[Define if OSF-4])
;;
*-osf5.1*)
AC_DEFINE([OSF1],[1],[Define if OSF-5.1])
;;
*-tru64*)
AC_DEFINE([OSF1],[1],[Define if Tru64])
;;
# it is actually <platform>-apple-darwin1.2 or <platform>-apple-rhapsody5.x but lets stick with this for the moment
*-apple*)
AC_DEFINE([MACOS],[1],[Define if MacOS])
AC_DEFINE([BROKEN_SIOCGIFMTU],[1],[Define if broken SIOCGIFMTU])
LDFLAGS="${LDFLAGS} -L/sw/lib"
extra_incl="-I/sw/include"
esac
# Checks for programs.
AC_PROG_CC
AC_PROG_LN_S
AC_PROG_MAKE_SET
# Check for optional features
AC_ARG_WITH(mysql,
AS_HELP_STRING([--with-mysql],
[Enable support for MySQL alert logs @<:@default=no@:>@ WARNING: You cannot enable the support for two databases at the same time]),
[with_mysql=yes],
[with_mysql=no])
AC_ARG_WITH(postgresql,
AS_HELP_STRING([--with-postgresql],
[Enable support for PostgreSQL alert logs @<:@default=no@:>@ WARNING: You cannot enable the support for two databases at the same time]),
[with_postgresql=yes],
[with_postgresql=no])
AC_ARG_WITH(python,
AS_HELP_STRING([--with-python],
[Enable support for Python modules @<:@default=no@:>@]),
[with_python=yes],
[with_python=no])
AC_ARG_WITH(graphviz,
AS_HELP_STRING([--without-graphviz],
[Disable Graphviz support for rendering correlated alerts as a PNG graph @<:@default=yes@:>@]),
[],
[with_graphviz=yes])
# Checks for libraries.
AS_IF([test "x$with_mysql" != xno],
[AC_CHECK_LIB([mysqlclient], [mysql_query],,
[AC_MSG_FAILURE([--with-mysql option used, but libmysqlclient was not found - do not use --with-mysql, or, on a Debian-based system, install libmysqlclient-dev])])])
AS_IF([test "x$with_postgresql" != xno],
[AC_CHECK_LIB([pq], [PQexec],,
[AC_MSG_FAILURE([--with-postgresql option used, but libpq was not found - do not use --with-postgresql, or, on a Debian-based system, install libpq-dev])])])
AS_IF([test "x$with_python" != xno],
[AC_CHECK_LIB([python2.6], [Py_BuildValue],,
[AC_MSG_FAILURE([--with-python option used, but libpython2.6 was not found - do not use --with-python, or, on a Debian-based system, install libpython2.6])])])
AS_IF([test "x$with_mysql" != xno -a "x$with_postgresql" != xno],
[AC_MSG_FAILURE([The support for an only DBMS can be enabled via ./configure, for example, you cannot enable MySQL and PostgreSQL support at the same time])], [])
AS_IF([test "x$with_graphviz" != xno],
[AC_CHECK_LIB([gvc], [agread],,
[AC_MSG_FAILURE([libgraphviz support required but the library was not found - use --without-graphviz if you do not want to enable the support for it, or, on a Debian-based system, install libgraphviz-dev])])])
AC_CHECK_LIB([xml2], [xmlReaderForFile],, AC_MSG_FAILURE(libxml2 not found on the system))
AC_CHECK_LIB([pthread], [pthread_create],, AC_MSG_FAILURE(libpthread not found on the system))
AC_CHECK_LIB([m], [sqrt],, AC_MSG_FAILURE(libm not found on the system))
AC_CHECK_LIB([dl], [dlopen],, AC_MSG_FAILURE(libdl not found on the system))
AS_IF([test "x$prefix" == x/usr],
[AC_SUBST([CORR_RULES_PREFIX], ["/etc/snort/corr_rules"])],
[AC_SUBST([CORR_RULES_PREFIX], ["${prefix}/etc/corr_rules"])])
# Set extra prefixes and control if we have Doxygen
AS_IF([test ! -z "`which doxygen`"], [AC_SUBST([DOC_PREFIX], ["${prefix}/doc/snort_ai_preprocessor"])], [])
AC_SUBST([SHARE_PREFIX], ["${prefix}/share/snort_ai_preprocessor"])
# Checks for header files.
AS_IF([test ! -z "`pkg-config --cflags libxml-2.0 2> /dev/null`"],
[AC_SUBST([LIBXML2_INCLUDES], ["$(pkg-config --cflags libxml-2.0 2> /dev/null)"])],
[AC_MSG_FAILURE([libxml2 not found, okr pkg-config not working])])
AS_IF([test "x$with_python" != xno],
[AS_IF([test ! -z "`ls /usr/include/python2.6 2> /dev/null`"],
[AC_SUBST([LIBPYTHON_INCLUDES], ["-I/usr/include/python2.6"])],
[AC_MSG_FAILURE([python support enabled, but the include directory /usr/include/python2.6 was not found])])])
AS_IF([test "x$with_graphviz" != xno],
[AS_IF([test ! -z "`pkg-config --cflags libgraph 2> /dev/null`"],
[AC_SUBST([LIBGRAPH_INCLUDES], ["$(pkg-config --cflags libgraph 2> /dev/null)"])],
[AC_MSG_FAILURE([libgraphviz support enabled, but the library was not found or pkg-config is not working])])])
AS_IF([test "x$with_graphviz" != xno],
[AC_DEFINE([HAVE_BOOLEAN], [1], [Check if the boolean type is defined])])
AC_FUNC_ALLOCA
AC_CHECK_HEADERS([dirent.h dlfcn.h inttypes.h limits.h math.h stddef.h stdlib.h string.h unistd.h wchar.h],,AC_MSG_ERROR(At least one of the required headers was not found))
# Check for int types
AC_CHECK_TYPES([u_int8_t,u_int16_t,u_int32_t,u_int64_t,uint8_t,uint16_t,uint32_t,uint64_t])
AC_CHECK_TYPES([int8_t,int16_t,int32_t,int64_t,boolean])
# Checks for typedefs, structures, and compiler characteristics.
AC_HEADER_STDBOOL
AC_TYPE_SIZE_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T
AC_CHECK_TYPES([ptrdiff_t])
# Checks for library functions.
AC_FUNC_MALLOC
AC_FUNC_MKTIME
AC_FUNC_REALLOC
AC_CHECK_FUNCS([memmove memset regcomp strcasecmp strdup strstr strtol strtoul socket bind listen accept connect],,AC_MSG_ERROR(At least one of the required functions was not found))
AC_DEFINE([VERSION], ["0.1.0"], [Module version])
AC_DEFINE([PACKAGE], ["sf_ai_preprocessor"], [Package name])
AC_DEFINE([PACKAGE_BUGREPORT], ["blacklight@autistici.org"], [Bug report address])
AC_DEFINE([PACKAGE_NAME], ["sf_ai_preprocessor"], [Package full name])
AC_DEFINE([PACKAGE_STRING], ["Snort AI preprocessor"], [Package string])
AC_DEFINE([PACKAGE_TARNAME], ["snort_ai_preproc"], [Package tarname])
AC_DEFINE([PACKAGE_VERSION], ["0.1.0"], [Package version])
AC_DEFINE([SUP_IP6], [], [Use SUP_IP6])
AC_DEFINE([HAVE_VISIBILITY], [1], [Check if the compiler supports visibility])
AC_DEFINE_UNQUOTED([PREFIX], "${prefix}", [Installation prefix])
AC_CONFIG_FILES([Makefile])
AC_OUTPUT