root/configure.in

Revision 97313f9ba4f7a385bbe08db05036193ea2d9d7cb, 25.1 kB (checked in by Riley Berton <riley.berton@circonus.com>, 2 months ago)

fix warnings

  • 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_HEADER(ck_pr.h, [], [AC_MSG_ERROR(*** libck (headers) required ***)])
290 AC_CHECK_LIB(ck, ck_ht_init, , [AC_MSG_ERROR(*** concurrencyckit (libck) is required ***)])
291 AC_CHECK_LIB(hwloc, hwloc_topology_init, , [AC_MSG_ERROR(*** libhwloc required ***)])
292 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 ***)])
293 AC_CHECK_HEADER(udns.h, [], [AC_MSG_ERROR(*** udns.h required ***)])
294 AC_CHECK_LIB(udns, dns_new, [], [AC_MSG_ERROR(*** libudns required ***)])
295 AC_CHECK_LIB(umem, umem_cache_create, , )
296 AC_CHECK_LIB(protobuf-c, protobuf_c_message_get_packed_size, ,
297         [AC_MSG_ERROR(libprotobuf-c required)])
298 AC_CHECK_LIB(z, compress2, , [AC_MSG_ERROR(*** zlib is required ***)])
299 AC_CHECK_LIB(rt, sem_init, , [
300   AC_CHECK_LIB(rt, clock_gettime, , )
301 ])
302 AC_CHECK_LIB(posix4, sem_wait, , )
303 AC_CHECK_LIB(pthread, pthread_create, , )
304
305 AC_CHECK_HEADERS(priv.h)
306 AC_CHECK_FUNCS(setppriv)
307
308 AC_CHECK_FUNC(uuid_generate, , [
309         AC_MSG_WARN([uuid_generate not available])
310         AC_SEARCH_LIBS(uuid_generate, uuid e2fs-uuid, , [AC_MSG_ERROR(*** uuid is required ***)])])
311
312 # Some libraries provide an unparse_lower command
313 # we use that, so if it isn't present, we'll need
314 # to implement it.
315 AC_CHECK_FUNC(fdwalk, [AC_DEFINE(HAVE_FDWALK)], )
316 AC_CHECK_FUNC(uuid_unparse_lower, [AC_DEFINE(HAVE_UUID_UNPARSE_LOWER)], )
317 AC_CHECK_LIB(util, openpty, , )
318 AC_CHECK_LIB(termcap, tputs, , )
319 AC_CHECK_LIB(curses, clear, , [AC_MSG_ERROR([curses not found, but required])])
320
321 CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
322 LIBS="$LIBS `pcre-config --libs`"
323 AC_CHECK_LIB(pcre, pcre_compile, ,
324         [
325                 AC_MSG_ERROR([libpcre not found, but required])
326         ]
327 )
328 AC_CHECK_LIB(crypto, ERR_load_CRYPTO_strings, ,
329         [
330                 AC_MSG_ERROR([libcrypto not found, but required])
331         ]
332 )
333 AC_CHECK_LIB(ssl, SSL_library_init, ,
334         [
335                 AC_MSG_ERROR([libssl not found, but required])
336         ]
337 )
338
339 AC_MSG_CHECKING([libxml2 cflags])
340 XML2CFLAGS=`xml2-config --cflags`
341 CFLAGS="$CFLAGS $XML2CFLAGS"
342 AC_MSG_RESULT([$XML2CFLAGS])
343
344 AC_MSG_CHECKING([libxml2 libs])
345 XML2LIBS=`xml2-config --libs`
346 LIBS="$LIBS $XML2LIBS"
347 AC_MSG_RESULT([$XML2LIBS])
348
349 AC_CHECK_FUNC(xmlParseDocument, , [AC_MSG_ERROR(*** libxml2 is required ***)])
350
351 AC_MSG_CHECKING([libxslt cflags])
352 XSLTCFLAGS=`xslt-config --cflags`
353 CFLAGS="$CFLAGS $XSLTCFLAGS"
354 AC_MSG_RESULT([$XSLTCFLAGS])
355
356 AC_MSG_CHECKING([libxslt libs])
357 XSLTLIBS=`xslt-config --libs`
358 LIBS="$LIBS $XSLTLIBS"
359 AC_MSG_RESULT([$XSLTLIBS])
360
361 AC_CHECK_FUNC(xsltParseStylesheetDoc, , [AC_MSG_ERROR(*** libxslt is required ***)])
362
363 old_LIBS="$LIBS"
364 LIBS=""
365 AC_CHECK_LIB(protobuf-c, protobuf_c_message_get_packed_size, ,
366         [AC_MSG_ERROR(libprotobuf-c required)])
367 AC_CHECK_LIB(z, compress2, , [AC_MSG_ERROR(*** zlib is required ***)])
368 LIBNOIT_LIBS=$LIBS
369 AC_SUBST(LIBNOIT_LIBS)
370 LIBS="$old_LIBS"
371
372 AC_CHECK_FUNC(SSLv2_server_method, [ AC_DEFINE(HAVE_SSLV2_SERVER) ])
373 AC_CHECK_FUNC(SSLv2_client_method, [ AC_DEFINE(HAVE_SSLV2_CLIENT) ])
374 AC_CHECK_FUNC(SSLv3_server_method, [ AC_DEFINE(HAVE_SSLV3_SERVER) ])
375 AC_CHECK_FUNC(SSLv3_client_method, [ AC_DEFINE(HAVE_SSLV3_CLIENT) ])
376 AC_CHECK_FUNC(TLSv1_server_method, [ AC_DEFINE(HAVE_TLSV1_SERVER) ])
377 AC_CHECK_FUNC(TLSv1_client_method, [ AC_DEFINE(HAVE_TLSV1_CLIENT) ])
378 AC_CHECK_FUNC(TLSv1_1_server_method, [ AC_DEFINE(HAVE_TLSV1_1_SERVER) ])
379 AC_CHECK_FUNC(TLSv1_1_client_method, [ AC_DEFINE(HAVE_TLSV1_1_CLIENT) ])
380 AC_CHECK_FUNC(TLSv1_2_server_method, [ AC_DEFINE(HAVE_TLSV1_2_SERVER) ])
381 AC_CHECK_FUNC(TLSv1_2_client_method, [ AC_DEFINE(HAVE_TLSV1_2_CLIENT) ])
382
383 old_LIBS="$LIBS"
384 LIBS=
385 AC_CHECK_LIB(yajl, yajl_version,
386         [
387                 YAJLLIBS="$LIBS -lyajl"
388         ],
389         [ AC_MSG_ERROR([libyajl is required for collectd and httptrap modules]) ])
390 LIBS=$old_LIBS
391 AC_SUBST(YAJLLIBS)
392
393 old_LIBS="$LIBS"
394 old_CFLAGS="$CFLAGS"
395 AC_CHECK_LIB(pq, PQconnectdb,
396         [
397                 LIBS="$LIBS -lpq"
398                 PGLIBS="$LIBS"
399                 AC_SUBST(PGLIBS)
400         ],
401         [
402                 AC_MSG_WARN([libpq is highly recommended and needed for the test suite])
403                 AC_SUBST(PGLIBS)
404         ]
405 )
406
407 AC_MSG_CHECKING([libpq includes])
408 PQICFLAGS=`pg_config --includedir`
409 if test -n "$PQICFLAGS" ; then
410         CFLAGS="$CFLAGS -I$PQICFLAGS"
411 fi
412
413 POSTGRES_MODULE="no"
414 POSTGRES_INGESTOR_MODULE="no"
415 AC_TRY_LINK([
416         #include <libpq-fe.h>
417         ],
418         [ PGconn *dbh = PQconnectdb(""); (void)dbh; ],
419         [
420                 BUILD_MODULES="$BUILD_MODULES postgres.$MODULEEXT"
421                 BUILD_SMODULES="$BUILD_SMODULES postgres_ingestor.$MODULEEXT"
422                 AC_SUBST(PGCFLAGS)
423                 POSTGRES_MODULE="yes"
424                 POSTGRES_INGESTOR_MODULE="yes"
425   ],
426         [
427                 AC_SUBST(PGCFLAGS)
428                 AC_MSG_WARN([Cannot compile/link against libpq])
429         ]
430 )
431 PGCFLAGS=$CFLAGS
432 AC_SUBST(PGCFLAGS)
433 LIBS=$old_LIBS
434 CFLAGS=$old_CFLAGS
435
436 AC_CHECK_HEADERS(gcrypt.h)
437
438 AC_CHECK_HEADERS(mysql.h mysql/mysql.h)
439
440 MYSQL_MODULE="no"
441 if test "$ac_cv_header_mysql_h" = "no" -a "$ac_cv_header_mysql_mysql_h" = "no" ; then
442         AC_MSG_WARN([No libmysqlclient, skipping mysql module])
443         AC_SUBST(MYCFLAGS)
444         AC_SUBST(MYLIBS)
445 else
446         LIBS=$old_LIBS
447         CFLAGS=$old_CFLAGS
448        
449         if test -z "$MYLIBS" ; then
450           MYLIBS="-lmysqlclient_r -lz -lssl -lcrypto"
451         fi
452        
453         old_CFLAGS=$CFLAGS
454         old_LIBS=$LIBS
455         CFLAGS="$CFLAGS $MYCFLAGS"
456         LIBS="$MYLIBS"
457        
458         AC_CHECK_FUNC(mysql_real_connect,
459                 [
460                         BUILD_MODULES="$BUILD_MODULES mysql.$MODULEEXT"
461                         MYCFLAGS="$CFLAGS"
462                         MYLIBS="$LIBS"
463                         AC_SUBST(MYCFLAGS)
464                         AC_SUBST(MYLIBS)
465                         MYSQL_MODULE="yes"
466                 ],
467                 [
468                         AC_MSG_WARN([No libmysqlclient, skipping mysql module])
469                         AC_SUBST(MYCFLAGS)
470                         AC_SUBST(MYLIBS)
471                 ]
472         )
473        
474        
475         LIBS=$old_LIBS
476         CFLAGS=$old_CFLAGS
477 fi
478
479 ########
480 #
481 # CHECK FOR VARIOUS MODULE CRITERIA
482 # We don't track the libs themselves, as we'll just explictly link
483 # against the in the makefile if we enable them to build (by adding
484 # them to the BUILD_MODULES list).
485 #
486 ########
487
488 # Should we build snmp checks?
489 SNMP_MODULE="no"
490 HAS_NETSNMP="no"
491 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h)
492 if test "$ac_cv_header_net_snmp_net_snmp_config_h" = "yes" ; then
493 SAVELIBS="$LIBS"
494 AC_CHECK_LIB(netsnmp-c, snmp_sess_open_C1,
495         [
496                 BUILD_MODULES="$BUILD_MODULES snmp.$MODULEEXT"
497                 HAS_NETSNMP="yes"
498                 SNMP_MODULE="yes"
499                 LIBNETSNMP="netsnmp-c"
500         ],
501   [
502                 AC_CHECK_LIB(netsnmp, snmp_sess_open,
503                         [
504                                 HAS_NETSNMP="yes"
505                                 SNMP_MODULE="no"
506                                 AC_MSG_WARN([*** snmp C implementation requires libnetsnmp-c ***])
507                                 LIBNETSNMP="netsnmp"
508                         ]
509                 )
510         ]
511 )
512 LIBS="$SAVELIBS"
513 fi
514
515 FQ_DRIVER_MODULE="no"
516 SAVELIBS="$LIBS"
517 HAS_LIBFQ="no"
518 AC_CHECK_LIB(fq, fq_client_init,
519         [
520                 BUILD_SMODULES="$BUILD_SMODULES fq_driver.$MODULEEXT"
521                 HAS_LIBFQ="yes"
522                 FQ_DRIVER_MODULE="yes"
523         ]
524 )
525 LIBS="$SAVELIBS"
526
527 if test "x$HAS_NETSNMP" = "xno"; then
528         AC_MSG_WARN([No libnetsnmp, skipping snmp module])
529         if test -n "$LUA_MODULE"; then
530                 AC_MSG_WARN([*** lua specified, but no SNMP (things will get weird) ***])
531         fi
532 else
533         AC_DEFINE(HAVE_NETSNMP)
534 fi
535
536 AC_SUBST(LIBNETSNMP)
537
538 # Should we build ssh2 checks?
539 SSH2_MODULE="no"
540 SAVELIBS="$LIBS"
541 AC_CHECK_LIB(ssh2, libssh2_session_init_ex,
542         [
543                 BUILD_MODULES="$BUILD_MODULES ssh2.$MODULEEXT"
544                 SSH2_MODULE="yes"
545         ],
546         [
547                 AC_MSG_WARN([No libssh2, skipping ssh2 module])
548         ]
549 )
550 LIBS="$SAVELIBS"
551
552 STOMP_DRIVER_MODULE="no"
553 AS_IF([test "x$with_module_stomp" != "xno"],
554         [
555         AC_MSG_CHECKING([apr-1-config for needed for stomp support])
556         APRPREFIX=`apr-1-config --prefix`
557         if test $? -eq "0"; then
558                 BUILD_SMODULES="$BUILD_SMODULES stomp_driver.$MODULEEXT"
559                 STOMP_DRIVER_MODULE="yes"
560         fi
561         AC_SUBST(APRPREFIX)
562         AC_MSG_RESULT([$APRPREFIX])
563        
564         AC_MSG_CHECKING([libapr cflags])
565         APRCFLAGS="`apr-1-config --cflags --cppflags --includes`"
566         AC_SUBST(APRCFLAGS)
567         AC_MSG_RESULT([$APRCFLAGS])
568        
569         AC_MSG_CHECKING([libapr libs])
570         APRLIBS="`apr-1-config --link-ld --ldflags --libs`"
571         AC_SUBST(APRLIBS)
572         AC_MSG_RESULT([$APRLIBS])
573         ],
574         [STOMP_DRIVER_MODULE=no])
575
576 AC_TRY_LINK([],
577         [ issetugid(); ],
578         [ ac_cv_libc_defines_issetugid="yes" ],
579         [ ac_cv_libc_defines_issetugid="no" ]
580 )
581 if test "x$ac_cv_libc_defines_issetugid" = "xyes" ; then
582         AC_DEFINE(HAVE_ISSETUGID)
583 fi
584
585 AC_MSG_CHECKING([whether sem_init works])
586 AC_TRY_RUN(
587         [
588 #include <semaphore.h>
589 int main(void){sem_t s;return (0 != sem_init(&s,0,0));}
590         ],
591         [
592                 AC_MSG_RESULT(yes)
593                 AC_DEFINE(WORKING_SEM_INIT)
594         ],
595         [
596                 AC_MSG_RESULT(no)
597                 AC_MSG_WARN([****** sem_init() is broken, I'll implement one myself.])
598         ]
599 )
600
601 AC_FUNC_STRFTIME
602 AC_CHECK_FUNCS(ssetugid strlcpy strnstrn openpty inet_pton inet_ntop getopt \
603         poll vasprintf strlcat)
604
605 # Checks for header files.
606 AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \
607         sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \
608         ctype.h unistd.h time.h pty.h sys/stat.h sys/event.h libkern/OSAtomic.h \
609         termio.h termios.h curses.h sys/cdefs.h grp.h netinet/in_systm.h \
610         sys/ioctl_compat.h sys/filio.h util.h sys/time.h sys/mman.h \
611         sys/ioctl.h stropts.h sys/stream.h alloca.h sys/wait.h bsd/libutil.h libutil.h)
612
613 AC_CHECK_HEADERS([term.h], [], [],
614         [[
615 #ifdef HAVE_CURSES_H
616 # include <curses.h>
617 #endif
618         ]])
619
620 AC_CHECK_DECLS([openpty], [], [],
621         [
622 #if defined(HAVE_SYS_TYPES_H)
623 # include <sys/types.h>
624 #endif
625 #if defined(HAVE_SYS_IOCTL_H)
626 # include <sys/ioctl.h>
627 #endif
628 #if defined(HAVE_TERMIOS_H)
629 # include <termios.h>
630 #endif
631 #if defined(HAVE_BSD_LIBUTIL_H)
632 # include <bsd/libutil.h>
633 #elif defined(HAVE_LIBUTIL_H)
634 # include <libutil.h>
635 #endif
636 #if defined(HAVE_UTIL_H)
637 # include <util.h>
638 #endif
639 #if defined(HAVE_PTY_H)
640 # include <pty.h>
641 #endif
642         ])
643
644 AC_CHECK_FUNCS(getpwnam_r)
645 GETPWNAM_R_POSIX
646 AC_CHECK_FUNCS(getgrnam_r)
647 GETGRNAM_R_POSIX
648
649 AC_MSG_CHECKING(for tputs() function final argument type)
650 AC_EGREP_CPP([tputs.*[(][       ]*char[         ]*[)]],
651                 [#if defined(HAVE_TERM_H)
652                  #include <term.h>
653                  #endif
654                  #if defined(HAVE_CURSES_H)
655                  #include <curses.h>
656                  #endif],
657                 [AC_MSG_RESULT(char)
658                  AC_DEFINE(TPUTS_TAKES_CHAR)],
659                 [AC_MSG_RESULT(not char)])
660
661 AC_MSG_CHECKING(for tgoto() function final argument type)
662 AC_EGREP_CPP([tgoto.*[(][       ]*char[         ]*],
663                 [#if defined(HAVE_TERM_H)
664                  #include <term.h>
665                  #endif
666                  #if defined(HAVE_CURSES_H)
667                  #include <curses.h>
668                  #endif],
669                 [AC_MSG_RESULT(char)
670                  AC_DEFINE(TGOTO_TAKES_CHAR)],
671                 [AC_MSG_RESULT(not char)])
672
673 AC_CACHE_CHECK([for epoll support], ac_cv_have_epoll, [
674         AC_TRY_LINK(
675                 [ #include <sys/types.h> ],
676                 [ int a; a = epoll_create(); ],
677                 [ ac_cv_have_epoll="yes" ],
678                 [ ac_cv_have_epoll="no" ]
679         )
680 ])
681 if test "x$ac_cv_have_epoll" = "xyes" ; then
682         AC_DEFINE(HAVE_EPOLL)
683         EVENTER_OBJS="$EVENTER_OBJS eventer_epoll_impl.lo"
684         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "epoll")
685         have_epoll=1
686 fi
687
688 AC_CACHE_CHECK([for kqueue support], ac_cv_have_kqueue, [
689         AC_TRY_LINK(
690                 [ #include <sys/types.h> ],
691                 [ u_int a; a = kqueue(); ],
692                 [ ac_cv_have_kqueue="yes" ],
693                 [ ac_cv_have_kqueue="no" ]
694         )
695 ])
696 if test "x$ac_cv_have_kqueue" = "xyes" ; then
697         AC_DEFINE(HAVE_KQUEUE)
698         EVENTER_OBJS="$EVENTER_OBJS eventer_kqueue_impl.lo"
699         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "kqueue")
700         have_kqueue=1
701 fi
702
703 AC_CACHE_CHECK([for Solaris ports support], ac_cv_have_ports, [
704         AC_TRY_LINK(
705                 [ #include <port.h> ],
706                 [ u_int a; a = port_create(); ],
707                 [ ac_cv_have_ports="yes" ],
708                 [ ac_cv_have_ports="no" ]
709         )
710 ])
711 if test "x$ac_cv_have_ports" = "xyes" ; then
712         AC_DEFINE(HAVE_PORTS)
713         EVENTER_OBJS="$EVENTER_OBJS eventer_ports_impl.lo"
714         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "ports")
715         have_ports=1
716 fi
717
718 AC_SUBST(EVENTER_OBJS)
719
720 AC_CACHE_CHECK([for posix_readdir_r], ac_cv_have_posix_readdir_r, [
721         AC_TRY_COMPILE(
722                 [ #include <dirent.h> ],
723                 [ struct dirent *dep, de; readdir_r("/", &de, &dep); ],
724                 [ ac_cv_have_posix_readdir_r="yes" ],
725                 [ ac_cv_have_posix_readdir_r="no" ]
726         )
727 ])
728 if test "x$ac_cv_have_posix_readdir_r" = "xyes" ; then
729         AC_DEFINE(HAVE_POSIX_READDIR_R)
730         have_posix_readdir_r=1
731 fi
732
733 AC_CACHE_CHECK([for sig_t type], ac_cv_have_sig_t, [
734         AC_TRY_COMPILE(
735                 [ #include <signal.h> ],
736                 [ sig_t a; (void)a;],
737                 [ ac_cv_have_sig_t="yes" ],
738                 [ ac_cv_have_sig_t="no" ]
739         )
740 ])
741 if test "x$ac_cv_have_sig_t" = "xyes" ; then
742         AC_DEFINE(HAVE_SIG_T)
743         have_sig_t=1
744 fi
745
746 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
747         AC_TRY_COMPILE(
748                 [ #include <sys/types.h> ],
749                 [ u_int a; a = 1;],
750                 [ ac_cv_have_u_int="yes" ],
751                 [ ac_cv_have_u_int="no" ]
752         )
753 ])
754 if test "x$ac_cv_have_u_int" = "xyes" ; then
755         AC_DEFINE(HAVE_U_INT)
756         have_u_int=1
757 fi
758
759 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
760         AC_TRY_COMPILE(
761                 [ #include <sys/types.h> ],
762                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
763                 [ ac_cv_have_intxx_t="yes" ],
764                 [ ac_cv_have_intxx_t="no" ]
765         )
766 ])
767 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
768         AC_DEFINE(HAVE_INTXX_T)
769         have_intxx_t=1
770 fi
771        
772 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
773         AC_TRY_COMPILE(
774                 [ #include <sys/types.h> ],
775                 [ int64_t a; a = 1;],
776                 [ ac_cv_have_int64_t="yes" ],
777                 [ ac_cv_have_int64_t="no" ]
778         )
779 ])
780 if test "x$ac_cv_have_int64_t" = "xyes" ; then
781         AC_DEFINE(HAVE_INT64_T)
782         have_int64_t=1
783 fi
784        
785 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
786         AC_TRY_COMPILE(
787                 [ #include <sys/types.h> ],
788                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
789                 [ ac_cv_have_u_intxx_t="yes" ],
790                 [ ac_cv_have_u_intxx_t="no" ]
791         )
792 ])
793 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
794         AC_DEFINE(HAVE_U_INTXX_T)
795         have_u_intxx_t=1
796 fi
797
798 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
799         AC_TRY_COMPILE(
800                 [ #include <sys/types.h> ],
801                 [ u_int64_t a; a = 1;],
802                 [ ac_cv_have_u_int64_t="yes" ],
803                 [ ac_cv_have_u_int64_t="no" ]
804         )
805 ])
806 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
807         AC_DEFINE(HAVE_U_INT64_T)
808         have_u_int64_t=1
809 fi
810
811 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
812         test "x$ac_cv_header_sys_bitypes_h" = "xyes")
813 then
814         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
815         AC_TRY_COMPILE(
816                 [
817 #include <sys/bitypes.h>
818                 ],
819                 [
820                         int8_t a; int16_t b; int32_t c;
821                         u_int8_t e; u_int16_t f; u_int32_t g;
822                         a = b = c = e = f = g = 1;
823                 ],
824                 [
825                         AC_DEFINE(HAVE_U_INTXX_T)
826                         AC_DEFINE(HAVE_INTXX_T)
827                         AC_MSG_RESULT(yes)
828                 ],
829                 [AC_MSG_RESULT(no)]
830         )
831 fi
832
833 if test -z "$have_u_intxx_t" ; then
834         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
835                 AC_TRY_COMPILE(
836                         [
837 #include <sys/types.h>
838                         ],
839                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
840                         [ ac_cv_have_uintxx_t="yes" ],
841                         [ ac_cv_have_uintxx_t="no" ]
842                 )
843         ])
844         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
845                 AC_DEFINE(HAVE_UINTXX_T)
846         fi
847 fi
848
849 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
850         AC_TRY_COMPILE(
851                 [
852 #include <sys/types.h>
853 #include <sys/socket.h>
854                 ],
855                 [socklen_t foo; foo = 1235;],
856                 [ ac_cv_have_socklen_t="yes" ],
857                 [ ac_cv_have_socklen_t="no" ]
858         )
859 ])
860 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
861         AC_DEFINE(HAVE_SOCKLEN_T)
862 fi
863
864 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
865         AC_TRY_COMPILE(
866                 [
867 #include <sys/types.h>
868                 ],
869                 [ size_t foo; foo = 1235; ],
870                 [ ac_cv_have_size_t="yes" ],
871                 [ ac_cv_have_size_t="no" ]
872         )
873 ])
874 if test "x$ac_cv_have_size_t" = "xyes" ; then
875         AC_DEFINE(HAVE_SIZE_T)
876 fi
877
878 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
879         AC_TRY_COMPILE(
880                 [
881 #include <sys/types.h>
882                 ],
883                 [ ssize_t foo; foo = 1235; ],
884                 [ ac_cv_have_ssize_t="yes" ],
885                 [ ac_cv_have_ssize_t="no" ]
886         )
887 ])
888 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
889         AC_DEFINE(HAVE_SSIZE_T)
890 fi
891
892 BUILD_MODULES="$BUILD_MODULES $LUA_MODULE"
893
894 AC_SUBST(BUILD_MODULES)
895 AC_SUBST(BUILD_SMODULES)
896
897 docdir="docs"
898 mansubdir="man"
899 AC_SUBST(docdir)
900 AC_SUBST(mansubdir)
901 SHCFLAGS="$PICFLAGS $CFLAGS"
902 AC_SUBST(SHCFLAGS)
903 AC_SUBST(LD)
904 AC_SUBST(SHLDFLAGS)
905
906 SUBPREFIX="$prefix"
907 if test "x$prefix" = "xNONE"; then
908         SUBPREFIX="$ac_default_prefix"
909 fi
910 AC_MSG_CHECKING([Resolving libexec path...])
911 fullpath=$libexecdir
912 while test "x$temppath" != "x$fullpath" ; do
913         temppath=$fullpath
914         fullpath=`eval echo ${fullpath}`
915 done
916 fullpath=`echo $fullpath | sed "s~NONE~$SUBPREFIX~"`
917 AC_MSG_RESULT([$fullpath/noit])
918 AC_DEFINE_UNQUOTED(MODULES_DIR, "${fullpath}/noit")
919 MODULES_DIR=${fullpath}/noit
920 AC_SUBST(MODULES_DIR)
921
922 AC_MSG_CHECKING([Resolving lib path...])
923 fullpath=$libdir
924 while test "x$temppath" != "x$fullpath" ; do
925         temppath=$fullpath
926         fullpath=`eval echo ${fullpath}`
927 done
928 fullpath=`echo $fullpath | sed "s~NONE~$SUBPREFIX~"`
929 AC_MSG_RESULT([$fullpath])
930 AC_DEFINE_UNQUOTED(LIB_DIR, "${fullpath}")
931
932 JAVA_LIB_DIR="$prefix/java"
933 AC_ARG_WITH(java-libdir,
934         [--with-javalibdir=PFX  prefix to install java libs (optional)],
935         [JAVA_LIB_DIR=$withval],)
936 AC_MSG_CHECKING([Resolving javalibdir path...])
937 fullpath=$JAVA_LIB_DIR
938 while test "x$temppath" != "x$fullpath" ; do
939         temppath=$fullpath
940         fullpath=`eval echo ${fullpath}`
941 done
942 fullpath=`echo $fullpath | sed "s~NONE~$SUBPREFIX~"`
943 JAVA_LIB_DIR=$fullpath
944 AC_MSG_RESULT([$fullpath])
945 AC_SUBST(JAVA_LIB_DIR)
946
947 AC_MSG_CHECKING([Resolving sysconfdir path...])
948 fullpath=$sysconfdir
949 while test "x$temppath" != "x$fullpath" ; do
950         temppath=$fullpath
951         fullpath=`eval echo ${fullpath}`
952 done
953 fullpath=`echo $fullpath | sed "s~NONE~$SUBPREFIX~"`
954 AC_MSG_RESULT([$fullpath])
955 AC_DEFINE_UNQUOTED(ETC_DIR, "${fullpath}")
956 ETC_DIR=${fullpath}
957 AC_SUBST(ETC_DIR)
958
959 if test -n "`$CC -V 2>&1 | grep 'Sun C'`"; then
960         if test "$enable_string" != "no"; then
961                 CFLAGS="$CFLAGS -errwarn=%all"
962         fi
963 else
964         CFLAGS="$CFLAGS -Wall"
965         if test "$enable_strict" != "no"; then
966                 CFLAGS="$CFLAGS -Werror"
967         fi
968 fi
969
970 LUACFLAGS=`echo $CFLAGS | sed -e "s#${C99FLAG}##g; s#-mt##g; s#-errwarn=%all##g;"`
971 AC_SUBST(LUACFLAGS)
972
973 UNAME_V=`uname -v`
974 UNAME_R=`uname -r`
975 UNAME_S=`uname -s`
976 UNAME_M=`uname -m`
977 UNAME_N=`uname -n`
978 UNAME_P=`uname -p`
979 AC_DEFINE_UNQUOTED(NOIT_UNAME_V, "$UNAME_V")
980 AC_DEFINE_UNQUOTED(NOIT_UNAME_R, "$UNAME_R")
981 AC_DEFINE_UNQUOTED(NOIT_UNAME_S, "$UNAME_S")
982 AC_DEFINE_UNQUOTED(NOIT_UNAME_M, "$UNAME_M")
983 AC_DEFINE_UNQUOTED(NOIT_UNAME_N, "$UNAME_N")
984 AC_DEFINE_UNQUOTED(NOIT_UNAME_P, "$UNAME_P")
985
986
987 AC_OUTPUT([
988 Makefile
989 src/Makefile
990 src/man/Makefile
991 src/modules/Makefile
992 src/modules-lua/Makefile
993 src/java/Makefile
994 src/java/reconnoiter-riemann/run-iep.sh
995 src/java/jezebel
996 src/scripts/noit-config
997 sql/Makefile
998 test/Makefile
999 ])
1000
1001 AC_MSG_RESULT([
1002
1003 === Compile-time Configuration ===
1004   Lua Implementation: $ENABLE_LUA
1005
1006   == optional noit modules ==
1007   Postgres module:    $POSTGRES_MODULE
1008   MySQL module:       $MYSQL_MODULE
1009   SNMP module:        $SNMP_MODULE
1010   SSH2 module:        $SSH2_MODULE
1011
1012   == optional stratcon modules ==
1013   Postgres ingestor:  $POSTGRES_INGESTOR_MODULE
1014   STOMP iep driver:   $STOMP_DRIVER_MODULE
1015   FQ iep driver:      $FQ_DRIVER_MODULE
1016
1017   == Java bits ==
1018   Jezebel:            $JEZEBEL_JAR_ENABLE
1019   Reconnoiter:        $RECONNOITER_JAR_ENABLE
1020   Riemann IEP:        $RIEMANN_IEP_ENABLE
1021 ])
Note: See TracBrowser for help on using the browser.