~ubuntu-branches/ubuntu/hardy/prelude-manager/hardy

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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
dnl Process this file with autoconf to produce a configure script.

AC_INIT
AC_PREREQ(2.59)
AC_CANONICAL_TARGET([])
AM_INIT_AUTOMAKE(prelude-manager, 0.9.7.2)
AM_CONFIG_HEADER(config.h)
AM_DISABLE_STATIC

AM_MAINTAINER_MODE

dnl Checks for programs.
AC_PROG_CPP
AC_PROG_CC
gl_EARLY


AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_C_INLINE
AC_C_BIGENDIAN
AC_SYS_LARGEFILE
AC_LIBTOOL_DLOPEN
AM_PROG_LIBTOOL

AC_SUBST(CPPFLAGS)
AC_SUBST(LDFLAGS)



if test "x$prefix" = "xNONE"; then
   prefix="/usr/local"
fi

if test "x$localstatedir" = "x\${prefix}/var"; then
   localstatedir="$prefix/var"
fi

if test "x$sysconfdir" = "x\${prefix}/etc"; then
   sysconfdir="$prefix/etc"
fi

if test "x$datadir" = "x\${prefix}/share"; then
   datadir="$prefix/share"
fi


dnl **********************************************************
dnl * Check for platform specific flags                      *
dnl **********************************************************
AC_MSG_CHECKING(for platform-specific compiler flags)

case "$host_os" in
 darwin*)
        #
        # It may be called "cc", but it's really a GCC derivative
        # with a problematic special precompiler and precompiled
        # headers; turn off the special precompiler, as some
        # apparently-legal code won't compile with its precompiled
        # headers.
        #
        AC_MSG_RESULT(Darwin: adding -no-cpp-precomp)
	AX_CFLAGS_GCC_OPTION(-no-cpp-precomp)
        ;;
 *)
        AC_MSG_RESULT(none needed)
        ;;
esac


dnl **************************************************
dnl * Check for missing function replacement         *
dnl **************************************************
gl_SOURCE_BASE(libmissing)
gl_M4_BASE(libmissing/m4)
gl_INIT


dnl **************************************************
dnl * Check for libprelude                           *
dnl **************************************************

AM_PATH_LIBPRELUDE(0.9.7, ,
  AC_MSG_ERROR(Cannot find libprelude: Is libprelude-config in the path?) )

defined="$defined $LIBPRELUDE_PTHREAD_CFLAGS -DPRELUDE_CONFIG_DIR=\\\"$LIBPRELUDE_CONFIG_PREFIX\\\""


dnl ***
dnl *** Can we use -Werror -Wmissing-braces for some checks ? ***
AX_CFLAGS_GCC_OPTION(-Werror -Wmissing-braces, buggy_pthread_cppflags)

old_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $buggy_pthread_cppflags"

AC_MSG_CHECKING(for buggy pthread mutex initializers)
AC_TRY_COMPILE(
[
#include <pthread.h>
], 
[
static pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER;
],
compile_ok="yes", compile_ok="no")

CFLAGS="$old_CFLAGS"

if test x$compile_ok = xyes; then
   AC_MSG_RESULT(no)
else
   AC_MSG_RESULT(yes)
   buggy_pthread_initializers="yes"
fi


dnl **************************************************
dnl * Check for GnuTLS.                              *
dnl **************************************************
AM_PATH_LIBGNUTLS(1.0.17, gnutls=yes, gnutls=no)
if test x$gnutls != xyes; then
	AC_MSG_ERROR(libgnutls is required in order to build prelude-manager.)
fi

old_CPPFLAGS=$CPPFLAGS
CPPFLAGS="$LIBGNUTLS_CFLAGS"

AC_CHECK_HEADER(gnutls/gnutls.h, ,
       		AC_MSG_ERROR("libgnutls development headers are required to build libprelude"))
CPPFLAGS=$old_CPPFLAGS



dnl **************************************************
dnl * Check for libpreludedb                         *
dnl **************************************************

AM_PATH_LIBPRELUDEDB(0.9.4, enable_libpreludedb=yes, enable_libpreludedb=no)
AM_CONDITIONAL(HAVE_LIBPRELUDEDB, test x$enable_libpreludedb = xyes)


dnl ********************************************************
dnl * Check for the Libxml2                                *
dnl ********************************************************

AM_PATH_XML2(, enable_xmlmod=yes, enable_xmlmod=no)
AM_CONDITIONAL(HAVE_XML2, test x$enable_xmlmod = xyes)



dnl **************************************************
dnl * TCP WRAPPER CHECK                              *
dnl **************************************************

AC_ARG_WITH(libwrap, AC_HELP_STRING(--with-libwrap@<:@=PFX@:>@, 
                                    Compile in libwrap (tcp_wrappers) support @<:@default=auto@:>@.),
            libwrap_required=true, with_libwrap="yes")

if test x$with_libwrap != xno; then
   LIBWRAP_INCLUDE="tcpd.h"

   if test -d $with_libwrap; then
      LIBWRAP_PATH="$with_libwrap"
      LIBWRAP_INCLUDE="$with_libwrap/include/tcpd.h"
   fi

   AC_CHECK_HEADER($LIBWRAP_INCLUDE, with_libwrap=yes, with_libwrap=no)

   if test x$with_libwrap = xyes; then
      AC_CHECK_LIB(wrap, request_init, LIBWRAP_LIBS="-L$LIBWRAP_PATH/lib -lwrap")
      AC_CHECK_LIB(nsl, yp_get_default_domain, LIBNSL_LIBS="-lnsl")

      AC_MSG_CHECKING(whether -lwrap require -lnsl)
      old_LIBS=$LIBS
      LIBS=$LIBWRAP_LIBS

      AC_TRY_LINK([extern int hosts_access; int allow_severity, deny_severity;],
		  [return hosts_access;], with_libwrap=yes, with_libwrap=no)

      require_nsl="no"
      if test x$with_libwrap = xno; then
	 LIBS="$LIBNSL_LIBS $LIBS"
	 AC_TRY_LINK([extern int hosts_access; int allow_severity, deny_severity;],
		     [return hosts_access;], [with_libwrap=yes require_nsl="yes"], with_libwrap=no)
      fi
   
      AC_MSG_RESULT($require_nsl)
   fi

   LIBWRAP_LIBS=$LIBS
   LIBS=$old_LIBS

   if test x$libwrap_required = xtrue && test x$with_libwrap = xno; then 
      AC_MSG_ERROR([Could not find libwrap library])
   fi
fi

if test x$with_libwrap = xyes; then
   AC_DEFINE_UNQUOTED(HAVE_TCP_WRAPPERS, [], Define if tcp wrapper support is enabled)
fi


dnl **************************************************
dnl * Check for Ipv6.                                *
dnl **************************************************

AC_CHECK_TYPES([struct sockaddr_in6], have_ipv6_type=yes,, [
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
])

AC_CHECK_DECL(AF_INET6, have_ipv6_def=yes,, [
 #include <sys/types.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
])

if test x$have_ipv6_type = xyes && test x$have_ipv6_def = xyes; then
	AC_DEFINE_UNQUOTED(HAVE_IPV6, , Define wether Ipv6 is available on this system)
fi



dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_UID_T
AC_TYPE_PID_T
AC_TYPE_SIZE_T
AC_HEADER_TIME

dnl Checks for library functions.
AC_TYPE_SIGNAL


configdir=$sysconfdir/prelude-manager
prelude_manager_conf=$configdir/prelude-manager.conf
plugindir=$libdir/prelude-manager
report_plugin_dir=$plugindir/reports
decode_plugin_dir=$plugindir/decodes
filter_plugin_dir=$plugindir/filters
db_plugin_dir=$plugindir/db

manager_failover_dir=$localstatedir/spool/prelude-manager/failover
manager_scheduler_dir=$localstatedir/spool/prelude-manager/scheduler

manager_data_dir=$datadir/prelude-manager
manager_run_dir=$localstatedir/run/prelude-manager

AC_DEFINE_UNQUOTED(PRELUDE_MANAGER_CONFDIR, "$configdir", Define the Prelude Manager configuration directory)
AC_DEFINE_UNQUOTED(PRELUDE_MANAGER_CONF, "$prelude_manager_conf", Define the Prelude Manager configuration file path)

AC_SUBST(manager_data_dir)
AC_SUBST(defined)
AC_SUBST(configdir)
AC_SUBST(localstatedir)
AC_SUBST(prelude_manager_conf)
AC_SUBST(report_plugin_dir)
AC_SUBST(decode_plugin_dir)
AC_SUBST(filter_plugin_dir)
AC_SUBST(LIBWRAP_LIBS)
AC_SUBST(manager_scheduler_dir)
AC_SUBST(manager_failover_dir)
AC_SUBST(manager_run_dir)

AX_CFLAGS_GCC_OPTION(-Wall)
AX_CFLAGS_GCC_OPTION(-Wstrict-prototypes)
AX_CFLAGS_GCC_OPTION(-Wmissing-prototypes)
AX_CFLAGS_GCC_OPTION(-Wmissing-declarations)
AX_CFLAGS_GCC_OPTION(-Wbad-function-cast)
AX_CFLAGS_GCC_OPTION(-Wcast-qual)
AX_CFLAGS_GCC_OPTION(-Wcast-align)
AX_CFLAGS_GCC_OPTION(-Wnested-externs)
AX_CFLAGS_GCC_OPTION(-Wunused)

if test x$buggy_pthread_initializers = xyes; then
   AX_CFLAGS_GCC_OPTION(-Wno-missing-braces)
fi

AC_SUBST(CFLAGS)


AC_CONFIG_FILES([

Makefile 

libmissing/Makefile
prelude-manager.conf

src/Makefile 
src/include/Makefile

plugins/Makefile

plugins/decodes/Makefile
plugins/decodes/normalize/Makefile

plugins/filters/Makefile
plugins/filters/idmef-criteria/Makefile

plugins/reports/Makefile
plugins/reports/db/Makefile
plugins/reports/debug/Makefile
plugins/reports/relaying/Makefile
plugins/reports/textmod/Makefile
plugins/reports/xmlmod/Makefile

])
AC_OUTPUT

echo
echo "*** Dumping configuration ***"
echo "    - TCP wrapper support    : $with_libwrap";
echo "    - XML plugin support     : $enable_xmlmod";
echo "    - Database plugin support: $enable_libpreludedb";