root/configure.in

Revision 31dee091d67e2a43774f63671b5fd9ccb09d8373, 24.6 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 3 weeks ago)

have noitd and stratcond directly link libnoit objects

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