root/configure.in

Revision 0faf2eafe9e3fa3d886ddedc6d1c2220fac91e73, 21.5 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 5 months ago)

sh.. sigh

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