root/configure.in

Revision b38d60266df2a0d6c1799181d8a675b7081d10b7, 24.0 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 10 hours ago)

fix libyajl use in httptrap and collectd

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