root/configure.in

Revision 2148d594359c81ffc07674617e97eef16818690f, 18.2 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 2 years ago)

Support c99 compile

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