root/configure.in

Revision e777c361cd646308f382dc6e94c33adc3d8efda0, 25.2 kB (checked in by GitHub <noreply@github.com>, 5 months ago)

Websockets and externalization of histogram code into libcircllhist (#278)

* WIP, livestreaming over websocket

* fix livestream mtev_log_stream_t leak

* move histogram impl out of reconnoiter tree into libcircllhist repo, tests for websockets

* whitespace cleanup

* fix comment

* output any websocket errors as json

* fix integer names

  • Property mode set to 100755
Line 
1 AC_INIT(src/noitd.c)
2
3 node=`hostname | cut -f1 -d '.' | tr '[A-Z]' '[a-z]'`
4 if test -f ".configure.$node"; then
5         echo "***********************************************************"
6         echo "* Loading node specific configure settings for $node."
7         echo "***********************************************************"
8         . ./.configure.$node
9 fi
10
11 AC_CANONICAL_HOST
12 AC_CONFIG_HEADER(src/noit_config.h)
13
14 AC_ARG_WITH([module-stomp],
15         AS_HELP_STRING([--without-module-stomp], [Don't build stomp]))
16
17 AC_ARG_ENABLE(strict,
18         [AC_HELP_STRING([--enable-strict],
19                 [Compile with warnings treated as errors])],
20         enable_strict="$enableval",
21         enable_strict=no)
22
23 AC_ARG_ENABLE(lua,
24         [AC_HELP_STRING([--enable-lua],
25                 [Choose a lua implementation: (no, lua52, LuaJIT)])],
26         enable_lua="$enableval",
27         enable_lua=LuaJIT)
28
29 if (test "$enable_lua" != "LuaJIT" && \
30         test "$enable_lua" != "lua52" && \
31         test "$enable_lua" != "no") ; then
32         AC_MSG_ERROR(Invalid value '$enable_lua' for --enable-lua)
33 fi
34
35 AC_PROG_CC
36 AC_C_INLINE
37 AC_C_BIGENDIAN
38 AC_PROG_CPP
39 AC_PROG_RANLIB
40 AC_PROG_INSTALL
41 AC_PROG_LN_S
42 AC_PATH_PROG(AR, ar)
43 AC_PATH_PROGS(PERL, perl)
44 AC_PATH_PROGS(XSLTPROC, xsltproc)
45 AC_PATH_PROGS(XMLLINT, xmllint)
46 AC_PATH_PROGS(MAVEN, mvn)
47 AC_PATH_PROGS(JAVA, java)
48 AC_PATH_PROGS(JAVA, java, , $JAVA_HOME/bin)
49 AC_PATH_PROGS(JAVAC, javac)
50 AC_PATH_PROGS(JAVAC, javac, , $JAVA_HOME/bin)
51 AC_PATH_PROGS(JAR, jar)
52 AC_PATH_PROGS(JAR, jar, , $JAVA_HOME/bin)
53 AC_PATH_PROG(NROFF, nroff)
54 AC_PATH_PROG(CTFCONVERT, ctfconvert)
55 AC_PATH_PROG(CTFMERGE, ctfmerge)
56 AC_PATH_PROG(LUA, luajit)
57 if test -z "$ac_cv_path_LUA"; then
58         AC_PATH_PROG(LUA, lua)
59 fi
60 AC_SUBST(PERL)
61
62 ENABLE_LUA=$enable_lua
63 AC_SUBST(ENABLE_LUA)
64
65 MAPFLAGS=""
66 if test "x$GCC" = "xyes" ; then
67         C99FLAG="-std=c99"
68         CFLAGS="$CFLAGS -g $C99FLAG"
69         DEPFLAGS="-MM"
70 else
71         C99FLAG="-xc99=all"
72         CFLAGS="$CFLAGS -g $C99FLAG"
73         DEPFLAGS="-xM1"
74 fi
75 SHLDFLAGS="$LDFLAGS"
76
77 CPPFLAGS="$CPPFLAGS -D_REENTRANT -D_XOPEN_SOURCE=600 -D_XOPEN_SOURCE_EXTENDED -D_POSIX_SOURCE -D_POSIX_C_SOURCE=200112L "'-I$(top_srcdir)/src'
78 DTRACEHDR=dtrace_probes.h
79 DOTSO=.so
80 LD_LIBNOIT_VERSION='-Wl,-soname,libnoit.so.$(LIBNOIT_VERSION)'
81
82 MTEV_MODULES_DIR=`mtev-config --modules-dir 2>/dev/null`
83 if test "$?" -ne "0" ; then
84     AC_MSG_ERROR([*** mtev-config not found ***])
85 fi
86 AC_SUBST(MTEV_MODULES_DIR)
87
88 case $host in
89 *-*-darwin*)
90         CAP_PLATFORM="darwin"
91         DOTSO=
92         DOTDYLIB=dylib
93         DTRACE=/usr/sbin/dtrace
94         DTRACE_ENABLED=1
95         PICFLAGS="-fPIC"
96         CPPFLAGS="$CPPFLAGS -D_DARWIN_C_SOURCE -DMAC_OS_X_VERSION_MIN_REQUIRED=MAC_OS_X_VERSION_10_6 -Wno-deprecated-declarations"
97         MODULELD="$CC -bundle -flat_namespace -undefined suppress"
98         SHLD="$CC -dynamiclib -single_module -undefined dynamic_lookup -fPIC"
99   DOTDYLIB=.dylib
100         LD_LIBNOIT_VERSION='-current_version $(LIBNOIT_VERSION) -install_name $(libdir)/libnoit.$(LIBNOIT_VERSION).dylib'
101         MODULEEXT=bundle
102         # This is needed for luajit on Mac OS X
103         if test "x$ENABLE_LUA" = "xLuaJIT"; then
104                 LDFLAGS="$LDFLAGS -pagezero_size 10000 -image_base 100000000"
105                 SHLDFLAGS="$SHLDFLAGS -image_base 100000000"
106         fi
107         ;;
108 *-*-solaris*)
109         CAP_PLATFORM="illumos"
110         CAP_SUPPORTED=1
111         DTRACE=/usr/sbin/dtrace
112         DTRACE_ENABLED=1
113         DTRACEOBJ=dtrace_stub.o
114         CFLAGS="$CFLAGS"
115         CPPFLAGS="$CPPFLAGS -D_XPG6 -D__EXTENSIONS__"
116         MDB_MODS=
117         if test "x$GCC" != "xyes" ; then
118         AC_MSG_CHECKING([32 or 64 bit Solaris assembly])
119         if test -n "`echo $CFLAGS | grep m64`" ; then
120                 DTRACEFLAGS=-64
121                 MAPFLAGS="-Wl,-M -Wl,map64bit"
122                 if test -n "`isalist | grep sparc`"; then
123                         AC_MSG_RESULT([sparc 64])
124                         ATOMIC_OBJS="noit_atomic_sol_sparcv9.lo"
125                 else
126                         AC_MSG_RESULT([intel 64])
127                         ATOMIC_OBJS="noit_atomic_sol_x86_64.lo"
128                 fi
129         else
130                 if test -n "`isalist | grep sparc`"; then
131                         AC_MSG_RESULT([sparc 32])
132                         ATOMIC_OBJS="noit_atomic_sol_sparcv8plus.lo"
133                 else
134                         AC_MSG_RESULT([intel 32])
135                         ATOMIC_OBJS="noit_atomic_sol_x86_32.lo"
136                 fi
137         fi
138         fi
139         if test "x$GCC" != "xyes" ; then
140                 CFLAGS="$CFLAGS -mt"
141                 PICFLAGS="-Kpic"
142                 MODULELD="$CC -G"
143                 SHLD="$CC -G"
144         else
145                 # Foul and disgusting unwinding issues require libgcc_s
146                 LUALIBS="-lgcc_s"
147                 if test -n "`echo $CFLAGS | grep m64`" ; then
148                         DTRACEFLAGS=-64
149                         MAPFLAGS="-Wl,-M -Wl,map64bit"
150                 fi
151                 PICFLAGS="-fPIC"
152                 MODULELD="$CC -shared"
153                 SHLD="$CC -shared"
154                 CLINKFLAGS="-shared-libgcc"
155         fi
156         MODULEEXT=so
157         RLDFLAG="-R"
158         WHOLE_ARCHIVE="-Wl,-z -Wl,allextract"
159         NOWHOLE_ARCHIVE="-Wl,-z -Wl,defaultextract"
160         ;;
161 *-*-openbsd*)
162         CAP_PLATFORM="openbsd"
163         PICFLAGS="-fpic"
164         LDFLAGS="$LDFLAGS -Wl,-E"
165         MODULELD="$CC -shared"
166         SHLD="$CC -shared"
167         MODULEEXT=so
168         LDFLAGS="$LDFLAGS -L/usr/local/lib"
169         CFLAGS="$CFLAGS -I/usr/local/include"
170         RLDFLAG="-Wl,--rpath="
171         WHOLE_ARCHIVE="-Wl,--whole-archive"
172         NOWHOLE_ARCHIVE="-Wl,--no-whole-archive"
173         ;;
174 *-*-linux*)
175         CAP_PLATFORM="linux"
176         LDFLAGS="$LDFLAGS -Wl,-E"
177         CPPFLAGS="$CPPFLAGS -D_SVID_SOURCE -D_BSD_SOURCE"
178         PICFLAGS="-fpic"
179         MODULELD="$CC -shared"
180         SHLD="$CC -shared"
181         MODULEEXT=so
182         RLDFLAG="-Wl,--rpath="
183         WHOLE_ARCHIVE="-Wl,--whole-archive"
184         NOWHOLE_ARCHIVE="-Wl,--no-whole-archive"
185         ;;
186 *-*-freebsd*)
187         CAP_PLATFORM="freebsd"
188         PICFLAGS="-fpic"
189         MODULELD="$CC -shared"
190         LDFLAGS="$LDFLAGS -export-dynamic -L/usr/local/lib"
191         CFLAGS="$CFLAGS -DCOMPAT_43TTY -I/usr/local/include"
192         MODULEEXT=so
193         RLDFLAG="-Wl,--rpath="
194         ;;
195 *)
196         PICFLAGS="-fpic"
197         MODULELD="$CC -shared"
198         MODULEEXT=so
199         RLDFLAG="-Wl,--rpath="
200         ;;
201 esac
202 AC_SUBST(DOTSO)
203 AC_SUBST(DOTDYLIB)
204 AC_SUBST(LD_LIBNOIT_VERSION)
205 AC_SUBST(MDB_MODS)
206 AC_DEFINE_UNQUOTED(CAP_PLATFORM, "$CAP_PLATFORM", [capabilities platform])
207 if test "x$CAP_SUPPORTED" = "x1" ; then
208         AC_DEFINE(CAP_SUPPORTED)
209 fi
210 AC_SUBST(DTRACE)
211 AC_SUBST(DTRACE_ENABLED)
212 if test "x$DTRACE_ENABLED" = "x1" ; then
213         AC_DEFINE(DTRACE_ENABLED)
214 fi
215 AC_SUBST(DTRACEOBJ)
216 AC_SUBST(DTRACEHDR)
217 AC_SUBST(DTRACEFLAGS)
218 AC_SUBST(CLINKFLAGS)
219 AC_SUBST(SHLD)
220 AC_SUBST(RLDFLAG)
221 AC_SUBST(DEPFLAGS)
222 AC_SUBST(MODULELD)
223 AC_SUBST(MODULEEXT)
224 AC_SUBST(WHOLE_ARCHIVE)
225 AC_SUBST(NOWHOLE_ARCHIVE)
226 AC_SUBST(ATOMIC_OBJS)
227 AC_SUBST(MAPFLAGS)
228 AC_DEFINE_UNQUOTED(MODULEEXT, "$MODULEEXT", [module extension])
229 AC_MSG_CHECKING([enable build/install of the Java IEP and Jezebel bits])
230
231 LUA_MODULE=lua.$MODULEEXT
232 if test "$enable_lua" = "no"; then
233         LUA_MODULE=
234 fi
235
236 INSTALL_IEP=install-iep
237 SKIP_IEP=
238 RIEMANN_IEP_ENABLE="no"
239 if test -z "$ac_cv_path_MAVEN" ; then
240         INSTALL_IEP=
241         SKIP_IEP=_SKIP_
242 else
243         RIEMANN_IEP_ENABLE="yes"
244 fi
245 AC_SUBST(INSTALL_IEP)
246 AC_SUBST(SKIP_IEP)
247
248 JEZEBEL_JAR_ENABLE="no"
249 RECONNOITER_JAR_ENABLE="no"
250 if test -z "$ac_cv_path_JAVA" \
251         -o -z "$ac_cv_path_JAVAC" \
252         -o -z "$ac_cv_path_JAR" ; then
253         AC_MSG_RESULT([no])
254 else
255         if $ac_cv_path_JAVA -cp buildtools version 1.6 ; then
256                 JAVAPARTS=java
257                 AC_MSG_RESULT([yes])
258                 JEZEBEL_JAR_ENABLE="yes"
259                 RECONNOITER_JAR_ENABLE="yes"
260         else
261                 JVERSION=`$ac_cv_path_JAVA -cp buildtools version 1.6`
262                 AC_MSG_RESULT([too old: $JVERSION]);
263         fi
264 fi
265 AC_SUBST(JAVAPARTS)
266
267 # Checks for data types
268 AC_CHECK_SIZEOF(char, 1)
269 AC_CHECK_SIZEOF(short int, 2)
270 AC_CHECK_SIZEOF(int, 4)
271 AC_CHECK_SIZEOF(long int, 4)
272 AC_CHECK_SIZEOF(long long int, 8)
273 AC_CHECK_SIZEOF(void *, 1)
274
275 # Check for lua libraries
276 OLD_LIBS=$LIBS
277 LIBS=
278 if test "x$ENABLE_LUA" = "xLuaJIT"; then
279         AC_CHECK_LIB(luajit-5.1, luaL_newstate, [], [AC_MSG_ERROR(*** libluajit-5.1 required ***)])
280 elif test "x$ENABLE_LUA" = "xlua52"; then
281         AC_MSG_ERROR(*** liblua52 required ***)
282 fi
283 LUALIBS="$LUALIBS $LIBS"
284 AC_SUBST(LUALIBS)
285 LIBS=$OLD_LIBS
286
287 AC_CHECK_HEADER(mtev_config.h, [], [AC_MSG_ERROR(*** libmtev (headers) required ***)])
288 AC_CHECK_LIB(mtev, mtev_main, , [AC_MSG_ERROR(*** libmtev is required ***)])
289 AC_CHECK_LIB(circllhist, hist_alloc, , [AC_MSG_ERROR(*** libcircllhist is required ***)])
290 AC_CHECK_HEADER(ck_pr.h, [], [AC_MSG_ERROR(*** libck (headers) required ***)])
291 AC_CHECK_LIB(ck, ck_ht_init, , [AC_MSG_ERROR(*** concurrencyckit (libck) is required ***)])
292 AC_CHECK_LIB(hwloc, hwloc_topology_init, , [AC_MSG_ERROR(*** libhwloc required ***)])
293 AC_CHECK_LIB(jlog, jlog_ctx_add_subscriber_copy_checkpoint, , [AC_MSG_ERROR(*** libjlog 2.0.2 or higher required github.com/omniti-labs/jlog ***)])
294 AC_CHECK_HEADER(udns.h, [], [AC_MSG_ERROR(*** udns.h required ***)])
295 AC_CHECK_LIB(udns, dns_new, [], [AC_MSG_ERROR(*** libudns required ***)])
296 AC_CHECK_LIB(umem, umem_cache_create, , )
297 AC_CHECK_LIB(protobuf-c, protobuf_c_message_get_packed_size, ,
298         [AC_MSG_ERROR(libprotobuf-c required)])
299 AC_CHECK_LIB(z, compress2, , [AC_MSG_ERROR(*** zlib is required ***)])
300 AC_CHECK_LIB(rt, sem_init, , [
301   AC_CHECK_LIB(rt, clock_gettime, , )
302 ])
303 AC_CHECK_LIB(posix4, sem_wait, , )
304 AC_CHECK_LIB(pthread, pthread_create, , )
305
306 AC_CHECK_HEADERS(priv.h)
307 AC_CHECK_FUNCS(setppriv)
308
309 AC_CHECK_FUNC(uuid_generate, , [
310         AC_MSG_WARN([uuid_generate not available])
311         AC_SEARCH_LIBS(uuid_generate, uuid e2fs-uuid, , [AC_MSG_ERROR(*** uuid is required ***)])])
312
313 # Some libraries provide an unparse_lower command
314 # we use that, so if it isn't present, we'll need
315 # to implement it.
316 AC_CHECK_FUNC(fdwalk, [AC_DEFINE(HAVE_FDWALK)], )
317 AC_CHECK_FUNC(uuid_unparse_lower, [AC_DEFINE(HAVE_UUID_UNPARSE_LOWER)], )
318 AC_CHECK_LIB(util, openpty, , )
319 AC_CHECK_LIB(termcap, tputs, , )
320 AC_CHECK_LIB(curses, clear, , [AC_MSG_ERROR([curses not found, but required])])
321
322 CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
323 LIBS="$LIBS `pcre-config --libs`"
324 AC_CHECK_LIB(pcre, pcre_compile, ,
325         [
326                 AC_MSG_ERROR([libpcre not found, but required])
327         ]
328 )
329 AC_CHECK_LIB(crypto, ERR_load_CRYPTO_strings, ,
330         [
331                 AC_MSG_ERROR([libcrypto not found, but required])
332         ]
333 )
334 AC_CHECK_LIB(ssl, SSL_library_init, ,
335         [
336                 AC_MSG_ERROR([libssl not found, but required])
337         ]
338 )
339
340 AC_MSG_CHECKING([libxml2 cflags])
341 XML2CFLAGS=`xml2-config --cflags`
342 CFLAGS="$CFLAGS $XML2CFLAGS"
343 AC_MSG_RESULT([$XML2CFLAGS])
344
345 AC_MSG_CHECKING([libxml2 libs])
346 XML2LIBS=`xml2-config --libs`
347 LIBS="$LIBS $XML2LIBS"
348 AC_MSG_RESULT([$XML2LIBS])
349
350 AC_CHECK_FUNC(xmlParseDocument, , [AC_MSG_ERROR(*** libxml2 is required ***)])
351
352 AC_MSG_CHECKING([libxslt cflags])
353 XSLTCFLAGS=`xslt-config --cflags`
354 CFLAGS="$CFLAGS $XSLTCFLAGS"
355 AC_MSG_RESULT([$XSLTCFLAGS])
356
357 AC_MSG_CHECKING([libxslt libs])
358 XSLTLIBS=`xslt-config --libs`
359 LIBS="$LIBS $XSLTLIBS"
360 AC_MSG_RESULT([$XSLTLIBS])
361
362 AC_CHECK_FUNC(xsltParseStylesheetDoc, , [AC_MSG_ERROR(*** libxslt is required ***)])
363
364 old_LIBS="$LIBS"
365 LIBS=""
366 AC_CHECK_LIB(protobuf-c, protobuf_c_message_get_packed_size, ,
367         [AC_MSG_ERROR(libprotobuf-c required)])
368 AC_CHECK_LIB(z, compress2, , [AC_MSG_ERROR(*** zlib is required ***)])
369 LIBNOIT_LIBS=$LIBS
370 AC_SUBST(LIBNOIT_LIBS)
371 LIBS="$old_LIBS"
372
373 AC_CHECK_FUNC(SSLv2_server_method, [ AC_DEFINE(HAVE_SSLV2_SERVER) ])
374 AC_CHECK_FUNC(SSLv2_client_method, [ AC_DEFINE(HAVE_SSLV2_CLIENT) ])
375 AC_CHECK_FUNC(SSLv3_server_method, [ AC_DEFINE(HAVE_SSLV3_SERVER) ])
376 AC_CHECK_FUNC(SSLv3_client_method, [ AC_DEFINE(HAVE_SSLV3_CLIENT) ])
377 AC_CHECK_FUNC(TLSv1_server_method, [ AC_DEFINE(HAVE_TLSV1_SERVER) ])
378 AC_CHECK_FUNC(TLSv1_client_method, [ AC_DEFINE(HAVE_TLSV1_CLIENT) ])
379 AC_CHECK_FUNC(TLSv1_1_server_method, [ AC_DEFINE(HAVE_TLSV1_1_SERVER) ])
380 AC_CHECK_FUNC(TLSv1_1_client_method, [ AC_DEFINE(HAVE_TLSV1_1_CLIENT) ])
381 AC_CHECK_FUNC(TLSv1_2_server_method, [ AC_DEFINE(HAVE_TLSV1_2_SERVER) ])
382 AC_CHECK_FUNC(TLSv1_2_client_method, [ AC_DEFINE(HAVE_TLSV1_2_CLIENT) ])
383
384 old_LIBS="$LIBS"
385 LIBS=
386 AC_CHECK_LIB(yajl, yajl_version,
387         [
388                 YAJLLIBS="$LIBS -lyajl"
389         ],
390         [ AC_MSG_ERROR([libyajl is required for collectd and httptrap modules]) ])
391 LIBS=$old_LIBS
392 AC_SUBST(YAJLLIBS)
393
394 old_LIBS="$LIBS"
395 old_CFLAGS="$CFLAGS"
396 AC_CHECK_LIB(pq, PQconnectdb,
397         [
398                 LIBS="$LIBS -lpq"
399                 PGLIBS="$LIBS"
400                 AC_SUBST(PGLIBS)
401         ],
402         [
403                 AC_MSG_WARN([libpq is highly recommended and needed for the test suite])
404                 AC_SUBST(PGLIBS)
405         ]
406 )
407
408 AC_MSG_CHECKING([libpq includes])
409 PQICFLAGS=`pg_config --includedir`
410 if test -n "$PQICFLAGS" ; then
411         CFLAGS="$CFLAGS -I$PQICFLAGS"
412 fi
413
414 POSTGRES_MODULE="no"
415 POSTGRES_INGESTOR_MODULE="no"
416 AC_TRY_LINK([
417         #include <libpq-fe.h>
418         ],
419         [ PGconn *dbh = PQconnectdb(""); (void)dbh; ],
420         [
421                 BUILD_MODULES="$BUILD_MODULES postgres.$MODULEEXT"
422                 BUILD_SMODULES="$BUILD_SMODULES postgres_ingestor.$MODULEEXT"
423                 AC_SUBST(PGCFLAGS)
424                 POSTGRES_MODULE="yes"
425                 POSTGRES_INGESTOR_MODULE="yes"
426   ],
427         [
428                 AC_SUBST(PGCFLAGS)
429                 AC_MSG_WARN([Cannot compile/link against libpq])
430         ]
431 )
432 PGCFLAGS=$CFLAGS
433 AC_SUBST(PGCFLAGS)
434 LIBS=$old_LIBS
435 CFLAGS=$old_CFLAGS
436
437 AC_CHECK_HEADERS(gcrypt.h)
438
439 AC_CHECK_HEADERS(mysql.h mysql/mysql.h)
440
441 MYSQL_MODULE="no"
442 if test "$ac_cv_header_mysql_h" = "no" -a "$ac_cv_header_mysql_mysql_h" = "no" ; then
443         AC_MSG_WARN([No libmysqlclient, skipping mysql module])
444         AC_SUBST(MYCFLAGS)
445         AC_SUBST(MYLIBS)
446 else
447         LIBS=$old_LIBS
448         CFLAGS=$old_CFLAGS
449        
450         if test -z "$MYLIBS" ; then
451           MYLIBS="-lmysqlclient_r -lz -lssl -lcrypto"
452         fi
453        
454         old_CFLAGS=$CFLAGS
455         old_LIBS=$LIBS
456         CFLAGS="$CFLAGS $MYCFLAGS"
457         LIBS="$MYLIBS"
458        
459         AC_CHECK_FUNC(mysql_real_connect,
460                 [
461                         BUILD_MODULES="$BUILD_MODULES mysql.$MODULEEXT"
462                         MYCFLAGS="$CFLAGS"
463                         MYLIBS="$LIBS"
464                         AC_SUBST(MYCFLAGS)
465                         AC_SUBST(MYLIBS)
466                         MYSQL_MODULE="yes"
467                 ],
468                 [
469                         AC_MSG_WARN([No libmysqlclient, skipping mysql module])
470                         AC_SUBST(MYCFLAGS)
471                         AC_SUBST(MYLIBS)
472                 ]
473         )
474        
475        
476         LIBS=$old_LIBS
477         CFLAGS=$old_CFLAGS
478 fi
479
480 ########
481 #
482 # CHECK FOR VARIOUS MODULE CRITERIA
483 # We don't track the libs themselves, as we'll just explictly link
484 # against the in the makefile if we enable them to build (by adding
485 # them to the BUILD_MODULES list).
486 #
487 ########
488
489 # Should we build snmp checks?
490 SNMP_MODULE="no"
491 HAS_NETSNMP="no"
492 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h)
493 if test "$ac_cv_header_net_snmp_net_snmp_config_h" = "yes" ; then
494 SAVELIBS="$LIBS"
495 AC_CHECK_LIB(netsnmp-c, snmp_sess_open_C1,
496         [
497                 BUILD_MODULES="$BUILD_MODULES snmp.$MODULEEXT"
498                 HAS_NETSNMP="yes"
499                 SNMP_MODULE="yes"
500                 LIBNETSNMP="netsnmp-c"
501         ],
502   [
503                 AC_CHECK_LIB(netsnmp, snmp_sess_open,
504                         [
505                                 HAS_NETSNMP="yes"
506                                 SNMP_MODULE="no"
507                                 AC_MSG_WARN([*** snmp C implementation requires libnetsnmp-c ***])
508                                 LIBNETSNMP="netsnmp"
509                         ]
510                 )
511         ]
512 )
513 LIBS="$SAVELIBS"
514 fi
515
516 FQ_DRIVER_MODULE="no"
517 SAVELIBS="$LIBS"
518 HAS_LIBFQ="no"
519 AC_CHECK_LIB(fq, fq_client_init,
520         [
521                 BUILD_SMODULES="$BUILD_SMODULES fq_driver.$MODULEEXT"
522                 HAS_LIBFQ="yes"
523                 FQ_DRIVER_MODULE="yes"
524         ]
525 )
526 LIBS="$SAVELIBS"
527
528 if test "x$HAS_NETSNMP" = "xno"; then
529         AC_MSG_WARN([No libnetsnmp, skipping snmp module])
530         if test -n "$LUA_MODULE"; then
531                 AC_MSG_WARN([*** lua specified, but no SNMP (things will get weird) ***])
532         fi
533 else
534         AC_DEFINE(HAVE_NETSNMP)
535 fi
536
537 AC_SUBST(LIBNETSNMP)
538
539 # Should we build ssh2 checks?
540 SSH2_MODULE="no"
541 SAVELIBS="$LIBS"
542 AC_CHECK_LIB(ssh2, libssh2_session_init_ex,
543         [
544                 BUILD_MODULES="$BUILD_MODULES ssh2.$MODULEEXT"
545                 SSH2_MODULE="yes"
546         ],
547         [
548                 AC_MSG_WARN([No libssh2, skipping ssh2 module])
549         ]
550 )
551 LIBS="$SAVELIBS"
552
553 STOMP_DRIVER_MODULE="no"
554 AS_IF([test "x$with_module_stomp" != "xno"],
555         [
556         AC_MSG_CHECKING([apr-1-config for needed for stomp support])
557         APRPREFIX=`apr-1-config --prefix`
558         if test $? -eq "0"; then
559                 BUILD_SMODULES="$BUILD_SMODULES stomp_driver.$MODULEEXT"
560                 STOMP_DRIVER_MODULE="yes"
561         fi
562         AC_SUBST(APRPREFIX)
563         AC_MSG_RESULT([$APRPREFIX])
564        
565         AC_MSG_CHECKING([libapr cflags])
566         APRCFLAGS="`apr-1-config --cflags --cppflags --includes`"
567         AC_SUBST(APRCFLAGS)
568         AC_MSG_RESULT([$APRCFLAGS])
569        
570         AC_MSG_CHECKING([libapr libs])
571         APRLIBS="`apr-1-config --link-ld --ldflags --libs`"
572         AC_SUBST(APRLIBS)
573         AC_MSG_RESULT([$APRLIBS])
574         ],
575         [STOMP_DRIVER_MODULE=no])
576
577 AC_TRY_LINK([],
578         [ issetugid(); ],
579         [ ac_cv_libc_defines_issetugid="yes" ],
580         [ ac_cv_libc_defines_issetugid="no" ]
581 )
582 if test "x$ac_cv_libc_defines_issetugid" = "xyes" ; then
583         AC_DEFINE(HAVE_ISSETUGID)
584 fi
585
586 AC_MSG_CHECKING([whether sem_init works])
587 AC_TRY_RUN(
588         [
589 #include <semaphore.h>
590 int main(void){sem_t s;return (0 != sem_init(&s,0,0));}
591         ],
592         [
593                 AC_MSG_RESULT(yes)
594                 AC_DEFINE(WORKING_SEM_INIT)
595         ],
596         [
597                 AC_MSG_RESULT(no)
598                 AC_MSG_WARN([****** sem_init() is broken, I'll implement one myself.])
599         ]
600 )
601
602 AC_FUNC_STRFTIME
603 AC_CHECK_FUNCS(ssetugid strlcpy strnstrn openpty inet_pton inet_ntop getopt \
604         poll vasprintf strlcat)
605
606 # Checks for header files.
607 AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \
608         sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \
609         ctype.h unistd.h time.h pty.h sys/stat.h sys/event.h libkern/OSAtomic.h \
610         termio.h termios.h curses.h sys/cdefs.h grp.h netinet/in_systm.h \
611         sys/ioctl_compat.h sys/filio.h util.h sys/time.h sys/mman.h \
612         sys/ioctl.h stropts.h sys/stream.h alloca.h sys/wait.h bsd/libutil.h libutil.h)
613
614 AC_CHECK_HEADERS([term.h], [], [],
615         [[
616 #ifdef HAVE_CURSES_H
617 # include <curses.h>
618 #endif
619         ]])
620
621 AC_CHECK_DECLS([openpty], [], [],
622         [
623 #if defined(HAVE_SYS_TYPES_H)
624 # include <sys/types.h>
625 #endif
626 #if defined(HAVE_SYS_IOCTL_H)
627 # include <sys/ioctl.h>
628 #endif
629 #if defined(HAVE_TERMIOS_H)
630 # include <termios.h>
631 #endif
632 #if defined(HAVE_BSD_LIBUTIL_H)
633 # include <bsd/libutil.h>
634 #elif defined(HAVE_LIBUTIL_H)
635 # include <libutil.h>
636 #endif
637 #if defined(HAVE_UTIL_H)
638 # include <util.h>
639 #endif
640 #if defined(HAVE_PTY_H)
641 # include <pty.h>
642 #endif
643         ])
644
645 AC_CHECK_FUNCS(getpwnam_r)
646 GETPWNAM_R_POSIX
647 AC_CHECK_FUNCS(getgrnam_r)
648 GETGRNAM_R_POSIX
649
650 AC_MSG_CHECKING(for tputs() function final argument type)
651 AC_EGREP_CPP([tputs.*[(][       ]*char[         ]*[)]],
652                 [#if defined(HAVE_TERM_H)
653                  #include <term.h>
654                  #endif
655                  #if defined(HAVE_CURSES_H)
656                  #include <curses.h>
657                  #endif],
658                 [AC_MSG_RESULT(char)
659                  AC_DEFINE(TPUTS_TAKES_CHAR)],
660                 [AC_MSG_RESULT(not char)])
661
662 AC_MSG_CHECKING(for tgoto() function final argument type)
663 AC_EGREP_CPP([tgoto.*[(][       ]*char[         ]*],
664                 [#if defined(HAVE_TERM_H)
665                  #include <term.h>
666                  #endif
667                  #if defined(HAVE_CURSES_H)
668                  #include <curses.h>
669                  #endif],
670                 [AC_MSG_RESULT(char)
671                  AC_DEFINE(TGOTO_TAKES_CHAR)],
672                 [AC_MSG_RESULT(not char)])
673
674 AC_CACHE_CHECK([for epoll support], ac_cv_have_epoll, [
675         AC_TRY_LINK(
676                 [ #include <sys/types.h> ],
677                 [ int a; a = epoll_create(); ],
678                 [ ac_cv_have_epoll="yes" ],
679                 [ ac_cv_have_epoll="no" ]
680         )
681 ])
682 if test "x$ac_cv_have_epoll" = "xyes" ; then
683         AC_DEFINE(HAVE_EPOLL)
684         EVENTER_OBJS="$EVENTER_OBJS eventer_epoll_impl.lo"
685         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "epoll")
686         have_epoll=1
687 fi
688
689 AC_CACHE_CHECK([for kqueue support], ac_cv_have_kqueue, [
690         AC_TRY_LINK(
691                 [ #include <sys/types.h> ],
692                 [ u_int a; a = kqueue(); ],
693                 [ ac_cv_have_kqueue="yes" ],
694                 [ ac_cv_have_kqueue="no" ]
695         )
696 ])
697 if test "x$ac_cv_have_kqueue" = "xyes" ; then
698         AC_DEFINE(HAVE_KQUEUE)
699         EVENTER_OBJS="$EVENTER_OBJS eventer_kqueue_impl.lo"
700         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "kqueue")
701         have_kqueue=1
702 fi
703
704 AC_CACHE_CHECK([for Solaris ports support], ac_cv_have_ports, [
705         AC_TRY_LINK(
706                 [ #include <port.h> ],
707                 [ u_int a; a = port_create(); ],
708                 [ ac_cv_have_ports="yes" ],
709                 [ ac_cv_have_ports="no" ]
710         )
711 ])
712 if test "x$ac_cv_have_ports" = "xyes" ; then
713         AC_DEFINE(HAVE_PORTS)
714         EVENTER_OBJS="$EVENTER_OBJS eventer_ports_impl.lo"
715         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "ports")
716         have_ports=1
717 fi
718
719 AC_SUBST(EVENTER_OBJS)
720
721 AC_CACHE_CHECK([for posix_readdir_r], ac_cv_have_posix_readdir_r, [
722         AC_TRY_COMPILE(
723                 [ #include <dirent.h> ],
724                 [ struct dirent *dep, de; readdir_r("/", &de, &dep); ],
725                 [ ac_cv_have_posix_readdir_r="yes" ],
726                 [ ac_cv_have_posix_readdir_r="no" ]
727         )
728 ])
729 if test "x$ac_cv_have_posix_readdir_r" = "xyes" ; then
730         AC_DEFINE(HAVE_POSIX_READDIR_R)
731         have_posix_readdir_r=1
732 fi
733
734 AC_CACHE_CHECK([for sig_t type], ac_cv_have_sig_t, [
735         AC_TRY_COMPILE(
736                 [ #include <signal.h> ],
737                 [ sig_t a; (void)a;],
738                 [ ac_cv_have_sig_t="yes" ],
739                 [ ac_cv_have_sig_t="no" ]
740         )
741 ])
742 if test "x$ac_cv_have_sig_t" = "xyes" ; then
743         AC_DEFINE(HAVE_SIG_T)
744         have_sig_t=1
745 fi
746
747 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
748         AC_TRY_COMPILE(
749                 [ #include <sys/types.h> ],
750                 [ u_int a; a = 1;],
751                 [ ac_cv_have_u_int="yes" ],
752                 [ ac_cv_have_u_int="no" ]
753         )
754 ])
755 if test "x$ac_cv_have_u_int" = "xyes" ; then
756         AC_DEFINE(HAVE_U_INT)
757         have_u_int=1
758 fi
759
760 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
761         AC_TRY_COMPILE(
762                 [ #include <sys/types.h> ],
763                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
764                 [ ac_cv_have_intxx_t="yes" ],
765                 [ ac_cv_have_intxx_t="no" ]
766         )
767 ])
768 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
769         AC_DEFINE(HAVE_INTXX_T)
770         have_intxx_t=1
771 fi
772        
773 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
774         AC_TRY_COMPILE(
775                 [ #include <sys/types.h> ],
776                 [ int64_t a; a = 1;],
777                 [ ac_cv_have_int64_t="yes" ],
778                 [ ac_cv_have_int64_t="no" ]
779         )
780 ])
781 if test "x$ac_cv_have_int64_t" = "xyes" ; then
782         AC_DEFINE(HAVE_INT64_T)
783         have_int64_t=1
784 fi
785        
786 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
787         AC_TRY_COMPILE(
788                 [ #include <sys/types.h> ],
789                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
790                 [ ac_cv_have_u_intxx_t="yes" ],
791                 [ ac_cv_have_u_intxx_t="no" ]
792         )
793 ])
794 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
795         AC_DEFINE(HAVE_U_INTXX_T)
796         have_u_intxx_t=1
797 fi
798
799 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
800         AC_TRY_COMPILE(
801                 [ #include <sys/types.h> ],
802                 [ u_int64_t a; a = 1;],
803                 [ ac_cv_have_u_int64_t="yes" ],
804                 [ ac_cv_have_u_int64_t="no" ]
805         )
806 ])
807 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
808         AC_DEFINE(HAVE_U_INT64_T)
809         have_u_int64_t=1
810 fi
811
812 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
813         test "x$ac_cv_header_sys_bitypes_h" = "xyes")
814 then
815         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
816         AC_TRY_COMPILE(
817                 [
818 #include <sys/bitypes.h>
819                 ],
820                 [
821                         int8_t a; int16_t b; int32_t c;
822                         u_int8_t e; u_int16_t f; u_int32_t g;
823                         a = b = c = e = f = g = 1;
824                 ],
825                 [
826                         AC_DEFINE(HAVE_U_INTXX_T)
827                         AC_DEFINE(HAVE_INTXX_T)
828                         AC_MSG_RESULT(yes)
829                 ],
830                 [AC_MSG_RESULT(no)]
831         )
832 fi
833
834 if test -z "$have_u_intxx_t" ; then
835         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
836                 AC_TRY_COMPILE(
837                         [
838 #include <sys/types.h>
839                         ],
840                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
841                         [ ac_cv_have_uintxx_t="yes" ],
842                         [ ac_cv_have_uintxx_t="no" ]
843                 )
844         ])
845         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
846                 AC_DEFINE(HAVE_UINTXX_T)
847         fi
848 fi
849
850 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
851         AC_TRY_COMPILE(
852                 [
853 #include <sys/types.h>
854 #include <sys/socket.h>
855                 ],
856                 [socklen_t foo; foo = 1235;],
857                 [ ac_cv_have_socklen_t="yes" ],
858                 [ ac_cv_have_socklen_t="no" ]
859         )
860 ])
861 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
862         AC_DEFINE(HAVE_SOCKLEN_T)
863 fi
864
865 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
866         AC_TRY_COMPILE(
867                 [
868 #include <sys/types.h>
869                 ],
870                 [ size_t foo; foo = 1235; ],
871                 [ ac_cv_have_size_t="yes" ],
872                 [ ac_cv_have_size_t="no" ]
873         )
874 ])
875 if test "x$ac_cv_have_size_t" = "xyes" ; then
876         AC_DEFINE(HAVE_SIZE_T)
877 fi
878
879 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
880         AC_TRY_COMPILE(
881                 [
882 #include <sys/types.h>
883                 ],
884                 [ ssize_t foo; foo = 1235; ],
885                 [ ac_cv_have_ssize_t="yes" ],
886                 [ ac_cv_have_ssize_t="no" ]
887         )
888 ])
889 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
890         AC_DEFINE(HAVE_SSIZE_T)
891 fi
892
893 BUILD_MODULES="$BUILD_MODULES $LUA_MODULE"
894
895 AC_SUBST(BUILD_MODULES)
896 AC_SUBST(BUILD_SMODULES)
897
898 docdir="docs"
899 mansubdir="man"
900 AC_SUBST(docdir)
901 AC_SUBST(mansubdir)
902 SHCFLAGS="$PICFLAGS $CFLAGS"
903 AC_SUBST(SHCFLAGS)
904 AC_SUBST(LD)
905 AC_SUBST(SHLDFLAGS)
906
907 SUBPREFIX="$prefix"
908 if test "x$prefix" = "xNONE"; then
909         SUBPREFIX="$ac_default_prefix"
910 fi
911 AC_MSG_CHECKING([Resolving libexec path...])
912 fullpath=$libexecdir
913 while test "x$temppath" != "x$fullpath" ; do
914         temppath=$fullpath
915         fullpath=`eval echo ${fullpath}`
916 done
917 fullpath=`echo $fullpath | sed "s~NONE~$SUBPREFIX~"`
918 AC_MSG_RESULT([$fullpath/noit])
919 AC_DEFINE_UNQUOTED(MODULES_DIR, "${fullpath}/noit")
920 MODULES_DIR=${fullpath}/noit
921 AC_SUBST(MODULES_DIR)
922
923 AC_MSG_CHECKING([Resolving lib path...])
924 fullpath=$libdir
925 while test "x$temppath" != "x$fullpath" ; do
926         temppath=$fullpath
927         fullpath=`eval echo ${fullpath}`
928 done
929 fullpath=`echo $fullpath | sed "s~NONE~$SUBPREFIX~"`
930 AC_MSG_RESULT([$fullpath])
931 AC_DEFINE_UNQUOTED(LIB_DIR, "${fullpath}")
932
933 JAVA_LIB_DIR="$prefix/java"
934 AC_ARG_WITH(java-libdir,
935         [--with-javalibdir=PFX  prefix to install java libs (optional)],
936         [JAVA_LIB_DIR=$withval],)
937 AC_MSG_CHECKING([Resolving javalibdir path...])
938 fullpath=$JAVA_LIB_DIR
939 while test "x$temppath" != "x$fullpath" ; do
940         temppath=$fullpath
941         fullpath=`eval echo ${fullpath}`
942 done
943 fullpath=`echo $fullpath | sed "s~NONE~$SUBPREFIX~"`
944 JAVA_LIB_DIR=$fullpath
945 AC_MSG_RESULT([$fullpath])
946 AC_SUBST(JAVA_LIB_DIR)
947
948 AC_MSG_CHECKING([Resolving sysconfdir path...])
949 fullpath=$sysconfdir
950 while test "x$temppath" != "x$fullpath" ; do
951         temppath=$fullpath
952         fullpath=`eval echo ${fullpath}`
953 done
954 fullpath=`echo $fullpath | sed "s~NONE~$SUBPREFIX~"`
955 AC_MSG_RESULT([$fullpath])
956 AC_DEFINE_UNQUOTED(ETC_DIR, "${fullpath}")
957 ETC_DIR=${fullpath}
958 AC_SUBST(ETC_DIR)
959
960 if test -n "`$CC -V 2>&1 | grep 'Sun C'`"; then
961         if test "$enable_string" != "no"; then
962                 CFLAGS="$CFLAGS -errwarn=%all"
963         fi
964 else
965         CFLAGS="$CFLAGS -Wall"
966         if test "$enable_strict" != "no"; then
967                 CFLAGS="$CFLAGS -Werror"
968         fi
969 fi
970
971 LUACFLAGS=`echo $CFLAGS | sed -e "s#${C99FLAG}##g; s#-mt##g; s#-errwarn=%all##g;"`
972 AC_SUBST(LUACFLAGS)
973
974 UNAME_V=`uname -v`
975 UNAME_R=`uname -r`
976 UNAME_S=`uname -s`
977 UNAME_M=`uname -m`
978 UNAME_N=`uname -n`
979 UNAME_P=`uname -p`
980 AC_DEFINE_UNQUOTED(NOIT_UNAME_V, "$UNAME_V")
981 AC_DEFINE_UNQUOTED(NOIT_UNAME_R, "$UNAME_R")
982 AC_DEFINE_UNQUOTED(NOIT_UNAME_S, "$UNAME_S")
983 AC_DEFINE_UNQUOTED(NOIT_UNAME_M, "$UNAME_M")
984 AC_DEFINE_UNQUOTED(NOIT_UNAME_N, "$UNAME_N")
985 AC_DEFINE_UNQUOTED(NOIT_UNAME_P, "$UNAME_P")
986
987
988 AC_OUTPUT([
989 Makefile
990 src/Makefile
991 src/man/Makefile
992 src/modules/Makefile
993 src/modules-lua/Makefile
994 src/java/Makefile
995 src/java/reconnoiter-riemann/run-iep.sh
996 src/java/jezebel
997 src/scripts/noit-config
998 sql/Makefile
999 test/Makefile
1000 ])
1001
1002 AC_MSG_RESULT([
1003
1004 === Compile-time Configuration ===
1005   Lua Implementation: $ENABLE_LUA
1006
1007   == optional noit modules ==
1008   Postgres module:    $POSTGRES_MODULE
1009   MySQL module:       $MYSQL_MODULE
1010   SNMP module:        $SNMP_MODULE
1011   SSH2 module:        $SSH2_MODULE
1012
1013   == optional stratcon modules ==
1014   Postgres ingestor:  $POSTGRES_INGESTOR_MODULE
1015   STOMP iep driver:   $STOMP_DRIVER_MODULE
1016   FQ iep driver:      $FQ_DRIVER_MODULE
1017
1018   == Java bits ==
1019   Jezebel:            $JEZEBEL_JAR_ENABLE
1020   Reconnoiter:        $RECONNOITER_JAR_ENABLE
1021   Riemann IEP:        $RIEMANN_IEP_ENABLE
1022 ])
Note: See TracBrowser for help on using the browser.