root/configure.in

Revision 0567273f79a651d42a6272b26389bc7b34290e84, 24.4 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 5 days ago)

switch to external libudns

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