root/configure.in

Revision b504e0e7fd942b3af0c6cff96afd10b916a4cfa8, 22.4 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 3 weeks ago)

Fixes issue #213: SSLv2_server_method not correctly detected.

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