root/configure.in

Revision 38649fb7aae587fa00c4912878451bfc36979c61, 23.0 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 2 weeks ago)

pcre libs should be in libs, not ldflags. jlog doesn't need any libs

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