root/configure.in

Revision 3081176b656a255da1e587a44933eabc58ee9119, 16.9 kB (checked in by Dan Di Spaltro <dan@cloudkick.com>, 3 years ago)

Add autodetection of the libprotobuf-c library
Add the generated bundle file
use preprocessor macros to compile out support of protobufs.
Add 'B' metrics with the discussed format over IRC, enough information to route,
while preserving the cross language decoding.

  • 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_PROG_CC
16 AC_C_INLINE
17 AC_C_BIGENDIAN
18 AC_PROG_CPP
19 AC_PROG_RANLIB
20 AC_PROG_INSTALL
21 AC_PROG_LN_S
22 AC_PATH_PROG(AR, ar)
23 AC_PATH_PROGS(PERL, perl)
24 AC_PATH_PROGS(XSLTPROC, xsltproc)
25 AC_PATH_PROGS(XMLLINT, xmllint)
26 AC_PATH_PROGS(JAVA, java)
27 AC_PATH_PROGS(JAVA, java, , $JAVA_HOME/bin)
28 AC_PATH_PROGS(JAVAC, javac)
29 AC_PATH_PROGS(JAVAC, javac, , $JAVA_HOME/bin)
30 AC_PATH_PROGS(JAR, jar)
31 AC_PATH_PROGS(JAR, jar, , $JAVA_HOME/bin)
32 AC_PATH_PROG(NROFF, nroff)
33 AC_SUBST(PERL)
34
35 if test "x$CC" = "xgcc" ; then
36   CFLAGS="$CFLAGS -g"
37   DEPFLAGS="-MM"
38 else
39   CFLAGS="$CFLAGS -g"
40   DEPFLAGS="-xM1"
41 fi
42
43 CPPFLAGS="$CPPFLAGS "'-I$(top_srcdir)/src'
44
45 case $host in
46 *-*-darwin*)
47         DTRACE=/usr/sbin/dtrace
48         DTRACEHDR=dtrace_probes.h
49         DTRACE_ENABLED=1
50         PICFLAGS="-fPIC"
51         MODULELD="$CC -bundle -flat_namespace -undefined suppress"
52         SHLD="$CC -dynamiclib -flat_namespace -undefined suppress"
53         MODULEEXT=bundle
54         RLDFLAG="-Wl,--rpath="
55         ;;
56 *-*-solaris*)
57         DTRACE=/usr/sbin/dtrace
58         DTRACEHDR=dtrace_probes.h
59         DTRACE_ENABLED=1
60         DTRACEOBJ=dtrace_stub.o
61         AC_MSG_CHECKING([32 or 64 bit Solaris assembly])
62         if test -n "`echo $CFLAGS | grep m64`"; then
63                 DTRACEFLAGS=-64
64                 if test -n "`isalist | grep sparc`"; then
65                         AC_MSG_RESULT([sparc 64])
66                         ATOMIC_OBJS="noit_atomic_sol_sparcv9.o"
67                 else
68                         AC_MSG_RESULT([intel 64])
69                         ATOMIC_OBJS="noit_atomic_sol_x86_64.o"
70                 fi
71         else
72                 if test -n "`isalist | grep sparc`"; then
73                         AC_MSG_RESULT([sparc 32])
74                         ATOMIC_OBJS="noit_atomic_sol_sparcv8plus.o"
75                 else
76                         AC_MSG_RESULT([intel 32])
77                         ATOMIC_OBJS="noit_atomic_sol_x86_32.o"
78                 fi
79         fi
80         if test "x$CC" != "xgcc" ; then
81                 CFLAGS="$CFLAGS -mt"
82         fi
83         PICFLAGS="-Kpic"
84         MODULELD="$CC -G"
85         SHLD="$CC -G"
86         MODULEEXT=so
87         RLDFLAG="-R"
88         WHOLE_ARCHIVE="-Wl,-z -Wl,allextract"
89         NOWHOLE_ARCHIVE="-Wl,-z -Wl,defaultextract"
90         ;;
91 *-*-openbsd*)
92         PICFLAGS="-fpic"
93         LDFLAGS="$LDFLAGS -Wl,-E"
94         MODULELD="$CC -shared"
95         SHLD="$CC -shared"
96         MODULEEXT=so
97         LDFLAGS="$LDFLAGS -L/usr/local/lib"
98         CFLAGS="$CFLAGS -I/usr/local/include"
99         RLDFLAG="-Wl,--rpath="
100         WHOLE_ARCHIVE="-Wl,--whole-archive"
101         NOWHOLE_ARCHIVE="-Wl,--no-whole-archive"
102         ;;
103 *-*-linux*)
104         LDFLAGS="$LDFLAGS -Wl,-E"
105         CPPFLAGS="$CPPFLAGS"
106         PICFLAGS="-fpic"
107         MODULELD="$CC -shared"
108         SHLD="$CC -shared"
109         MODULEEXT=so
110         RLDFLAG="-Wl,--rpath="
111         WHOLE_ARCHIVE="-Wl,--whole-archive"
112         NOWHOLE_ARCHIVE="-Wl,--no-whole-archive"
113         ;;
114 *-*-freebsd*)
115         PICFLAGS="-fpic"
116         MODULELD="$CC -shared"
117         LDFLAGS="$LDFLAGS -export-dynamic -L/usr/local/lib"
118         CFLAGS="$CFLAGS -DCOMPAT_43TTY -I/usr/local/include"
119         MODULEEXT=so
120         RLDFLAG="-Wl,--rpath="
121         ;;
122 *)
123         PICFLAGS="-fpic"
124         MODULELD="$CC -shared"
125         MODULEEXT=so
126         RLDFLAG="-Wl,--rpath="
127         ;;
128 esac
129 AC_SUBST(DTRACE)
130 AC_SUBST(DTRACE_ENABLED)
131 if test "x$DTRACE_ENABLED" = "x1" ; then
132         AC_DEFINE(DTRACE_ENABLED)
133 fi
134 AC_SUBST(DTRACEOBJ)
135 AC_SUBST(DTRACEHDR)
136 AC_SUBST(DTRACEFLAGS)
137 AC_SUBST(SHLD)
138 AC_SUBST(RLDFLAG)
139 AC_SUBST(DEPFLAGS)
140 AC_SUBST(MODULELD)
141 AC_SUBST(MODULEEXT)
142 AC_SUBST(WHOLE_ARCHIVE)
143 AC_SUBST(NOWHOLE_ARCHIVE)
144 AC_SUBST(ATOMIC_OBJS)
145 AC_DEFINE_UNQUOTED(MODULEEXT, "$MODULEEXT", [module extension])
146 AC_MSG_CHECKING([enable build/install of the Java IEP and Jezebel bits])
147
148 if test -z "$ac_cv_path_JAVA" \
149         -o -z "$ac_cv_path_JAVAC" \
150         -o -z "$ac_cv_path_JAR" ; then
151         AC_MSG_RESULT([no])
152 else
153         if $ac_cv_path_JAVA -cp buildtools version 1.6 ; then
154                 JAVAPARTS=java
155                 AC_MSG_RESULT([yes])
156         else
157                 JVERSION=`$ac_cv_path_JAVA -cp buildtools version 1.6`
158                 AC_MSG_RESULT([too old: $JVERSION]);
159         fi
160 fi
161 AC_SUBST(JAVAPARTS)
162
163 # Checks for data types
164 AC_CHECK_SIZEOF(char, 1)
165 AC_CHECK_SIZEOF(short int, 2)
166 AC_CHECK_SIZEOF(int, 4)
167 AC_CHECK_SIZEOF(long int, 4)
168 AC_CHECK_SIZEOF(long long int, 8)
169 AC_CHECK_SIZEOF(void *, 1)
170
171 AC_CHECK_LIB(umem, umem_cache_create, , )
172 AC_CHECK_LIB(z, compress2, , [AC_MSG_ERROR(*** zlib is required ***)])
173 AC_CHECK_LIB(rt, sem_init, , )
174 AC_CHECK_LIB(posix4, sem_wait, , )
175 AC_CHECK_LIB(pthread, pthread_create, , )
176 AC_CHECK_FUNC(uuid_generate, , [
177   AC_MSG_WARN([uuid_generate not available])
178   AC_SEARCH_LIBS(uuid_generate, uuid e2fs-uuid, , [AC_MSG_ERROR(*** uuid is required ***)])])
179
180 # Some libraries provide an unparse_lower command
181 # we use that, so if it isn't present, we'll need
182 # to implement it.
183 AC_CHECK_FUNC(uuid_unparse_lower, [AC_DEFINE(HAVE_UUID_UNPARSE_LOWER)], )
184 AC_CHECK_LIB(util, openpty, , )
185 AC_CHECK_LIB(termcap, tputs, , )
186 AC_CHECK_LIB(curses, clear, , [AC_MSG_ERROR([curses not found, but required])])
187
188 CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
189 LDFLAGS="$LDFLAGS `pcre-config --libs`"
190 AC_CHECK_LIB(pcre, pcre_compile, ,
191         [
192                 AC_MSG_ERROR([libpcre not found, but required])
193         ]
194 )
195 AC_CHECK_LIB(crypto, ERR_load_CRYPTO_strings, ,
196         [
197                 AC_MSG_ERROR([libcrypto not found, but required])
198         ]
199 )
200 AC_CHECK_LIB(ssl, SSL_library_init, ,
201         [
202                 AC_MSG_ERROR([libssl not found, but required])
203         ]
204 )
205
206
207 old_LIBS="$LIBS"
208 #LIBS="$LIBS `pkg-config --libs thrift_c_glib`"
209 LIBS="$LIBS `pkg-config --libs libprotobuf-c`"
210 AC_CHECK_LIB(protobuf-c, protobuf_c_message_get_packed_size,
211         [
212                 AC_DEFINE([HAVE_PROTOBUFS])
213         ]
214         [
215     NOIT_OBJS_EXTRA="$NOIT_OBJS_EXTRA bundle.pb-c.o"
216                 CFLAGS="$CFLAGS `pkg-config --cflags libprotobuf-c`"
217         ],
218         [
219                 AC_MSG_WARN([protobuf-c not found, skipping bundled metrics])
220                 LIBS=$old_LIBS
221         ]
222 )
223 AC_SUBST(NOIT_OBJS_EXTRA)
224
225 old_LIBS=$LIBS
226 old_CFLAGS=$CFLAGS
227 AC_CHECK_LIB(pq, PQconnectdb,
228         [
229                 LIBS="$LIBS -lpq"
230                 PGLIBS="$LIBS"
231                 AC_SUBST(PGLIBS)
232         ],
233         [
234                 AC_MSG_ERROR([libpq required])
235         ]
236 )
237
238 AC_MSG_CHECKING([libpq includes])
239 PQICFLAGS=`pg_config --includedir`
240 if test -n "$PQICFLAGS" ; then
241   CFLAGS="$CFLAGS -I$PQICFLAGS"
242 fi
243
244 AC_TRY_LINK([
245         #include <libpq-fe.h>
246         ],
247         [ PGconn *dbh = PQconnectdb(""); ],
248         [],
249         [ AC_MSG_ERROR([Cannot compile/link against libpq]) ]
250 )
251 PGCFLAGS=$CFLAGS
252 AC_SUBST(PGCFLAGS)
253 LIBS=$old_LIBS
254 CFLAGS=$old_CFLAGS
255
256 AC_CHECK_HEADERS(mysql.h mysql/mysql.h)
257
258 if test "$ac_cv_header_mysql_h" = "no" -a "$ac_cv_header_mysql_mysql_h" = "no" ; then
259         AC_MSG_WARN([No libmysqlclient, skipping mysql module])
260         AC_SUBST(MYCFLAGS)
261         AC_SUBST(MYLIBS)
262 else
263         LIBS=$old_LIBS
264         CFLAGS=$old_CFLAGS
265        
266         if test -z "$MYLIBS" ; then
267           MYLIBS="-lmysqlclient_r -lz -lssl -lcrypto"
268         fi
269        
270         old_CFLAGS=$CFLAGS
271         old_LIBS=$LIBS
272         CFLAGS="$CFLAGS $MYCFLAGS"
273         LIBS="$MYLIBS"
274        
275         AC_CHECK_FUNC(mysql_real_connect,
276                 [
277                         BUILD_MODULES="$BUILD_MODULES mysql.$MODULEEXT"
278                         MYCFLAGS="$CFLAGS"
279                         MYLIBS="$LIBS"
280                         AC_SUBST(MYCFLAGS)
281                         AC_SUBST(MYLIBS)
282                 ],
283                 [
284                         AC_MSG_WARN([No libmysqlclient, skipping mysql module])
285                         AC_SUBST(MYCFLAGS)
286                         AC_SUBST(MYLIBS)
287                 ]
288         )
289        
290        
291         LIBS=$old_LIBS
292         CFLAGS=$old_CFLAGS
293 fi
294
295 ########
296 #
297 # CHECK FOR VARIOUS MODULE CRITERIA
298 # We don't track the libs themselves, as we'll just explictly link
299 # against the in the makefile if we enable them to build (by adding
300 # them to the BUILD_MODULES list).
301 #
302 ########
303
304 # Should we build snmp checks?
305 AC_CHECK_HEADERS(net-snmp/net-snmp-config.h)
306 if test "$ac_cv_header_net_snmp_net_snmp_config_h" = "yes" ; then
307 SAVELIBS="$LIBS"
308 AC_CHECK_LIB(netsnmp, snmp_sess_open,
309         [
310                 BUILD_MODULES="$BUILD_MODULES snmp.$MODULEEXT"
311         ],
312         [
313                 AC_MSG_WARN([No libnetsnmp, skipping snmp module])
314         ]
315 )
316 LIBS="$SAVELIBS"
317 else
318         AC_MSG_WARN([No libnetsnmp, skipping snmp module])
319 fi
320
321 # Should we build ssh2 checks?
322 SAVELIBS="$LIBS"
323 AC_CHECK_LIB(ssh2, libssh2_session_init_ex,
324         [
325                 BUILD_MODULES="$BUILD_MODULES ssh2.$MODULEEXT"
326         ],
327         [
328                 AC_MSG_WARN([No libssh2, skipping ssh2 module])
329         ]
330 )
331 LIBS="$SAVELIBS"
332
333 AC_MSG_CHECKING([libxml2 cflags])
334 XML2CFLAGS=`xml2-config --cflags`
335 CFLAGS="$CFLAGS $XML2CFLAGS"
336 AC_MSG_RESULT([$XML2CFLAGS])
337
338 AC_MSG_CHECKING([libxml2 libs])
339 XML2LIBS=`xml2-config --libs`
340 LIBS="$LIBS $XML2LIBS"
341 AC_MSG_RESULT([$XML2LIBS])
342
343 AC_CHECK_FUNC(xmlParseDocument, , [AC_MSG_ERROR(*** libxml2 is required ***)])
344
345 AC_MSG_CHECKING([libxslt cflags])
346 XSLTCFLAGS=`xslt-config --cflags`
347 CFLAGS="$CFLAGS $XSLTCFLAGS"
348 AC_MSG_RESULT([$XSLTCFLAGS])
349
350 AC_MSG_CHECKING([libxslt libs])
351 XSLTLIBS=`xslt-config --libs`
352 LIBS="$LIBS $XSLTLIBS"
353 AC_MSG_RESULT([$XSLTLIBS])
354
355 AC_CHECK_FUNC(xsltParseStylesheetDoc, , [AC_MSG_ERROR(*** libxslt is required ***)])
356
357 APRPREFIX="`apr-1-config --prefix`"
358 AC_SUBST(APRPREFIX)
359 AC_MSG_RESULT([$APRPREFIX])
360
361 AC_MSG_CHECKING([libapr cflags])
362 APRCFLAGS="`apr-1-config --cflags --cppflags --includes`"
363 AC_SUBST(APRCFLAGS)
364 AC_MSG_RESULT([$APRCFLAGS])
365
366 AC_MSG_CHECKING([libapr libs])
367 APRLIBS="`apr-1-config --link-ld --ldflags --libs`"
368 AC_SUBST(APRLIBS)
369 AC_MSG_RESULT([$APRLIBS])
370
371 AC_TRY_LINK([],
372         [ issetugid(); ],
373         [ ac_cv_libc_defines_issetugid="yes" ],
374         [ ac_cv_libc_defines_issetugid="no" ]
375 )
376 if test "x$ac_cv_libc_defines_issetugid" = "xyes" ; then
377         AC_DEFINE(HAVE_ISSETUGID)
378 fi
379
380 AC_MSG_CHECKING([whether sem_init works])
381 AC_TRY_RUN(
382         [
383 #include <semaphore.h>
384 int main(void){sem_t s;return (0 != sem_init(&s,0,0));}
385         ],
386         [
387                 AC_MSG_RESULT(yes)
388                 AC_DEFINE(WORKING_SEM_INIT)
389         ],
390         [
391                 AC_MSG_RESULT(no)
392                 AC_MSG_WARN([****** sem_init() is broken, I'll implement one myself.])
393         ]
394 )
395
396 AC_FUNC_STRFTIME
397 AC_CHECK_FUNCS(ssetugid strlcpy strnstrn openpty inet_pton inet_ntop getopt \
398                poll vasprintf)
399
400 # Checks for header files.
401 AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \
402                  sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \
403                  ctype.h unistd.h time.h pty.h sys/stat.h sys/event.h libkern/OSAtomic.h \
404                  termio.h termios.h curses.h sys/cdefs.h grp.h netinet/in_systm.h \
405                  sys/ioctl_compat.h sys/filio.h util.h sys/time.h sys/mman.h \
406                  sys/ioctl.h stropts.h sys/stream.h alloca.h sys/wait.h libutil.h)
407 AC_CHECK_HEADERS([term.h], [], [],
408      [[#ifdef HAVE_CURSES_H
409      # include <curses.h>
410      #endif
411      ]])
412
413 AC_CHECK_DECLS([openpty], [], [],
414                 [#if defined(HAVE_SYS_TYPES_H)
415                  # include <sys/types.h>
416                  #endif
417                  #if defined(HAVE_SYS_IOCTL_H)
418                  # include <sys/ioctl.h>
419                  #endif
420                  #if defined(HAVE_TERMIOS_H)
421                  # include <termios.h>
422                  #endif
423                  #if defined(HAVE_LIBUTIL_H)
424                  # include <libutil.h>
425                  #endif
426                  #if defined(HAVE_UTIL_H)
427                  # include <util.h>
428                  #endif
429                  #if defined(HAVE_PTY_H)
430                  # include <pty.h>
431                  #endif
432                 ])
433
434 AC_CHECK_FUNCS(getpwnam_r)
435 GETPWNAM_R_POSIX
436 AC_CHECK_FUNCS(getgrnam_r)
437 GETGRNAM_R_POSIX
438
439 AC_MSG_CHECKING(for tputs() function final argument type)
440 AC_EGREP_CPP([tputs.*[(][       ]*char[         ]*[)]],
441                 [#if defined(HAVE_TERM_H)
442                  #include <term.h>
443                  #endif
444                  #if defined(HAVE_CURSES_H)
445                  #include <curses.h>
446                  #endif],
447                 [AC_MSG_RESULT(char)
448                  AC_DEFINE(TPUTS_TAKES_CHAR)],
449                 [AC_MSG_RESULT(not char)])
450
451 AC_CACHE_CHECK([for epoll support], ac_cv_have_epoll, [
452         AC_TRY_LINK(
453                 [ #include <sys/types.h> ],
454                 [ u_int a; a = epoll_create(); ],
455                 [ ac_cv_have_epoll="yes" ],
456                 [ ac_cv_have_epoll="no" ]
457         )
458 ])
459 if test "x$ac_cv_have_epoll" = "xyes" ; then
460         AC_DEFINE(HAVE_EPOLL)
461         EVENTER_OBJS="$EVENTER_OBJS eventer_epoll_impl.o"
462         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "epoll")
463         have_epoll=1
464 fi
465
466 AC_CACHE_CHECK([for kqueue support], ac_cv_have_kqueue, [
467         AC_TRY_LINK(
468                 [ #include <sys/types.h> ],
469                 [ u_int a; a = kqueue(); ],
470                 [ ac_cv_have_kqueue="yes" ],
471                 [ ac_cv_have_kqueue="no" ]
472         )
473 ])
474 if test "x$ac_cv_have_kqueue" = "xyes" ; then
475         AC_DEFINE(HAVE_KQUEUE)
476         EVENTER_OBJS="$EVENTER_OBJS eventer_kqueue_impl.o"
477         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "kqueue")
478         have_kqueue=1
479 fi
480
481 AC_CACHE_CHECK([for Solaris ports support], ac_cv_have_ports, [
482         AC_TRY_LINK(
483                 [ #include <port.h> ],
484                 [ u_int a; a = port_create(); ],
485                 [ ac_cv_have_ports="yes" ],
486                 [ ac_cv_have_ports="no" ]
487         )
488 ])
489 if test "x$ac_cv_have_ports" = "xyes" ; then
490         AC_DEFINE(HAVE_PORTS)
491         EVENTER_OBJS="$EVENTER_OBJS eventer_ports_impl.o"
492         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "ports")
493         have_ports=1
494 fi
495
496 AC_SUBST(EVENTER_OBJS)
497
498 AC_CACHE_CHECK([for posix_readdir_r], ac_cv_have_posix_readdir_r, [
499         AC_TRY_COMPILE(
500                 [ #include <dirent.h> ],
501                 [ struct dirent *dep, de; readdir_r("/", &de, &dep); ],
502                 [ ac_cv_have_posix_readdir_r="yes" ],
503                 [ ac_cv_have_posix_readdir_r="no" ]
504         )
505 ])
506 if test "x$ac_cv_have_posix_readdir_r" = "xyes" ; then
507         AC_DEFINE(HAVE_POSIX_READDIR_R)
508         have_posix_readdir_r=1
509 fi
510
511 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
512         AC_TRY_COMPILE(
513                 [ #include <sys/types.h> ],
514                 [ u_int a; a = 1;],
515                 [ ac_cv_have_u_int="yes" ],
516                 [ ac_cv_have_u_int="no" ]
517         )
518 ])
519 if test "x$ac_cv_have_u_int" = "xyes" ; then
520         AC_DEFINE(HAVE_U_INT)
521         have_u_int=1
522 fi
523
524 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
525         AC_TRY_COMPILE(
526                 [ #include <sys/types.h> ],
527                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
528                 [ ac_cv_have_intxx_t="yes" ],
529                 [ ac_cv_have_intxx_t="no" ]
530         )
531 ])
532 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
533         AC_DEFINE(HAVE_INTXX_T)
534         have_intxx_t=1
535 fi
536        
537 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
538         AC_TRY_COMPILE(
539                 [ #include <sys/types.h> ],
540                 [ int64_t a; a = 1;],
541                 [ ac_cv_have_int64_t="yes" ],
542                 [ ac_cv_have_int64_t="no" ]
543         )
544 ])
545 if test "x$ac_cv_have_int64_t" = "xyes" ; then
546         AC_DEFINE(HAVE_INT64_T)
547         have_int64_t=1
548 fi
549        
550 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
551         AC_TRY_COMPILE(
552                 [ #include <sys/types.h> ],
553                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
554                 [ ac_cv_have_u_intxx_t="yes" ],
555                 [ ac_cv_have_u_intxx_t="no" ]
556         )
557 ])
558 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
559         AC_DEFINE(HAVE_U_INTXX_T)
560         have_u_intxx_t=1
561 fi
562
563 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
564         AC_TRY_COMPILE(
565                 [ #include <sys/types.h> ],
566                 [ u_int64_t a; a = 1;],
567                 [ ac_cv_have_u_int64_t="yes" ],
568                 [ ac_cv_have_u_int64_t="no" ]
569         )
570 ])
571 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
572         AC_DEFINE(HAVE_U_INT64_T)
573         have_u_int64_t=1
574 fi
575
576 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
577            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
578 then
579         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
580         AC_TRY_COMPILE(
581                 [
582 #include <sys/bitypes.h>
583                 ],
584                 [
585                         int8_t a; int16_t b; int32_t c;
586                         u_int8_t e; u_int16_t f; u_int32_t g;
587                         a = b = c = e = f = g = 1;
588                 ],
589                 [
590                         AC_DEFINE(HAVE_U_INTXX_T)
591                         AC_DEFINE(HAVE_INTXX_T)
592                         AC_MSG_RESULT(yes)
593                 ],
594                 [AC_MSG_RESULT(no)]
595         )
596 fi
597
598 if test -z "$have_u_intxx_t" ; then
599         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
600                 AC_TRY_COMPILE(
601                         [
602 #include <sys/types.h>
603                         ],
604                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
605                         [ ac_cv_have_uintxx_t="yes" ],
606                         [ ac_cv_have_uintxx_t="no" ]
607                 )
608         ])
609         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
610                 AC_DEFINE(HAVE_UINTXX_T)
611         fi
612 fi
613
614 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
615         AC_TRY_COMPILE(
616                 [
617 #include <sys/types.h>
618 #include <sys/socket.h>
619                 ],
620                 [socklen_t foo; foo = 1235;],
621                 [ ac_cv_have_socklen_t="yes" ],
622                 [ ac_cv_have_socklen_t="no" ]
623         )
624 ])
625 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
626         AC_DEFINE(HAVE_SOCKLEN_T)
627 fi
628
629 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
630         AC_TRY_COMPILE(
631                 [
632 #include <sys/types.h>
633                 ],
634                 [ size_t foo; foo = 1235; ],
635                 [ ac_cv_have_size_t="yes" ],
636                 [ ac_cv_have_size_t="no" ]
637         )
638 ])
639 if test "x$ac_cv_have_size_t" = "xyes" ; then
640         AC_DEFINE(HAVE_SIZE_T)
641 fi
642
643 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
644         AC_TRY_COMPILE(
645                 [
646 #include <sys/types.h>
647                 ],
648                 [ ssize_t foo; foo = 1235; ],
649                 [ ac_cv_have_ssize_t="yes" ],
650                 [ ac_cv_have_ssize_t="no" ]
651         )
652 ])
653 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
654         AC_DEFINE(HAVE_SSIZE_T)
655 fi
656
657 AC_SUBST(BUILD_MODULES)
658
659 docdir="docs"
660 mansubdir="man"
661 AC_SUBST(docdir)
662 AC_SUBST(mansubdir)
663 SHCFLAGS="$PICFLAGS $CFLAGS"
664 AC_SUBST(SHCFLAGS)
665
666 SUBPREFIX="$prefix"
667 if test "x$prefix" = "xNONE"; then
668   SUBPREFIX="$ac_default_prefix"
669 fi
670 AC_MSG_CHECKING([Resolving libexec path...])
671 fullpath=$libexecdir
672 while test "x$temppath" != "x$fullpath" ; do
673   temppath=$fullpath
674   fullpath=`eval echo ${fullpath}`
675 done
676 fullpath=`echo $fullpath | sed "s~NONE~$SUBPREFIX~"`
677 AC_MSG_RESULT([$fullpath/noit])
678 AC_DEFINE_UNQUOTED(MODULES_DIR, "${fullpath}/noit")
679 MODULES_DIR=${fullpath}/noit
680 AC_SUBST(MODULES_DIR)
681
682 JAVA_LIB_DIR="$prefix/java"
683 AC_ARG_WITH(java-libdir,
684         [--with-javalibdir=PFX  prefix to install java libs (optional)],
685         [JAVA_LIB_DIR=$withval],)
686 AC_SUBST(JAVA_LIB_DIR)
687
688 AC_MSG_CHECKING([Resolving sysconfdir path...])
689 fullpath=$sysconfdir
690 while test "x$temppath" != "x$fullpath" ; do
691   temppath=$fullpath
692   fullpath=`eval echo ${fullpath}`
693 done
694 fullpath=`echo $fullpath | sed "s~NONE~$SUBPREFIX~"`
695 AC_MSG_RESULT([$fullpath])
696 AC_DEFINE_UNQUOTED(ETC_DIR, "${fullpath}")
697 ETC_DIR=${fullpath}
698 AC_SUBST(ETC_DIR)
699
700 if test "x$CC" = "xgcc" ; then
701   CFLAGS="$CFLAGS -Werror -Wall"
702 else
703   CFLAGS="$CFLAGS -errwarn=%all"
704 fi
705
706 AC_OUTPUT([
707 Makefile
708 src/Makefile
709 src/eventer/Makefile
710 src/jlog/Makefile
711 src/jlog/perl/Makefile.PL
712 src/udns/Makefile
713 src/json-lib/Makefile
714 src/man/Makefile
715 src/modules/Makefile
716 src/modules-lua/Makefile
717 src/utils/Makefile
718 src/noitedit/Makefile
719 src/lua/Makefile
720 src/java/Makefile
721 src/java/run-iep.sh
722 src/java/jezebel
723 src/scripts/noit-config
724 sql/Makefile
725 test/Makefile
726 ])
Note: See TracBrowser for help on using the browser.