root/configure.in

Revision 28c4109324e12a224d81ae1709cff469fd1f4711, 24.7 kB (checked in by Eric Sproul <esproul@omniti.com>, 3 months ago)

Restore build info, but prefixed to avoid colliding with libmtev

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