root/configure.in

Revision 0e13b19af2b2db5d4e070a6ebdaa1d0db152a639, 22.6 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 2 weeks ago)

This should be defined (be explicit)

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