root/configure.in

Revision 27a24a1299993c406f04ffa643b95fa8b14705bc, 12.1 kB (checked in by Theo Schlossnagle <jesus@omniti.com>, 6 years ago)

integrate the framework for docs... snmp docs

  • 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_SUBST(PERL)
27
28 if test "x$CC" = "xgcc" ; then
29   CFLAGS="$CFLAGS -g -Wall"
30 else
31   CFLAGS="$CFLAGS -g"
32 fi
33
34 CPPFLAGS="$CPPFLAGS "'-I$(top_srcdir)/src'
35
36 case $host in
37 *-*-darwin*)
38         PICFLAGS="-fPIC"
39         MODULELD="$CC -bundle -flat_namespace -undefined suppress"
40         SHLD="$CC -dynamiclib -flat_namespace -undefined suppress"
41         MODULEEXT=bundle
42         RLDFLAG="-Wl,--rpath="
43         ;;
44 *-*-solaris*)
45         AC_MSG_CHECKING([32 or 64 bit Solaris assembly])
46         if test -n "`echo $CFLAGS | grep m64`"; then
47                 AC_MSG_RESULT([64])
48                 ATOMIC_OBJS="noit_atomic_sol_x86_64.o"
49         else
50                 AC_MSG_RESULT([32])
51                 ATOMIC_OBJS="noit_atomic_sol_x86_32.o"
52         fi
53         PICFLAGS="-Kpic"
54         MODULELD="$CC -G"
55         SHLD="$CC -G"
56         MODULEEXT=so
57         RLDFLAG="-R"
58         WHOLE_ARCHIVE="-Wl,-z -Wl,allextract"
59         NOWHOLE_ARCHIVE="-Wl,-z -Wl,defaultextract"
60         ;;
61 *-*-openbsd*)
62         PICFLAGS="-fpic"
63         LDFLAGS="$LDFLAGS -Wl,-E"
64         MODULELD="$CC -shared"
65         SHLD="$CC -shared"
66         MODULEEXT=so
67         LDFLAGS="$LDFLAGS -L/usr/local/lib"
68         CFLAGS="$CFLAGS -I/usr/local/include"
69         RLDFLAG="-Wl,--rpath="
70         WHOLE_ARCHIVE="-Wl,--whole-archive"
71         NOWHOLE_ARCHIVE="-Wl,--no-whole-archive"
72         ;;
73 *-*-linux*)
74         LDFLAGS="$LDFLAGS -Wl,-E"
75         CPPFLAGS="$CPPFLAGS"
76         PICFLAGS="-fpic"
77         MODULELD="$CC -shared"
78         SHLD="$CC -shared"
79         MODULEEXT=so
80         RLDFLAG="-Wl,--rpath="
81         WHOLE_ARCHIVE="-Wl,--whole-archive"
82         NOWHOLE_ARCHIVE="-Wl,--no-whole-archive"
83         ;;
84 *)
85         PICFLAGS="-fpic"
86         MODULELD="$CC -shared"
87         MODULEEXT=so
88         RLDFLAG="-Wl,--rpath="
89         ;;
90 esac
91 AC_SUBST(SHLD)
92 AC_SUBST(RLDFLAG)
93 AC_SUBST(MODULELD)
94 AC_SUBST(MODULEEXT)
95 AC_SUBST(WHOLE_ARCHIVE)
96 AC_SUBST(NOWHOLE_ARCHIVE)
97 AC_SUBST(ATOMIC_OBJS)
98 AC_DEFINE_UNQUOTED(MODULEEXT, "$MODULEEXT", [module extension])
99
100 # Checks for data types
101 AC_CHECK_SIZEOF(char, 1)
102 AC_CHECK_SIZEOF(short int, 2)
103 AC_CHECK_SIZEOF(int, 4)
104 AC_CHECK_SIZEOF(long int, 4)
105 AC_CHECK_SIZEOF(long long int, 8)
106 AC_CHECK_SIZEOF(void *, 1)
107
108 AC_CHECK_LIB(z, compress2, , [AC_MSG_ERROR(*** zlib is required ***)])
109 AC_CHECK_LIB(rt, sem_init, , )
110 AC_CHECK_LIB(posix4, sem_wait, , )
111 AC_CHECK_LIB(pthread, pthread_create, , )
112 AC_CHECK_LIB(uuid, uuid_generate, , [AC_MSG_ERROR(*** uuid is required ***)])
113 # Some libraries provide an unparse_lower command
114 # we use that, so if it isn't present, we'll need
115 # to implement it.
116 AC_CHECK_FUNC(uuid_unparse_lower, [AC_DEFINE(HAVE_UUID_UNPARSE_LOWER)], )
117 AC_CHECK_LIB(util, openpty, , )
118 AC_CHECK_LIB(termcap, tputs, , )
119 AC_CHECK_LIB(curses, clear, , [AC_MSG_ERROR([curses not found, but required])])
120
121 CPPFLAGS="$CPPFLAGS `pcre-config --cflags`"
122 LDFLAGS="$LDFLAGS `pcre-config --libs`"
123 AC_CHECK_LIB(pcre, pcre_compile, ,
124         [
125                 AC_MSG_ERROR([libpcre not found, but required])
126         ]
127 )
128 AC_CHECK_LIB(crypto, ERR_load_CRYPTO_strings, ,
129         [
130                 AC_MSG_ERROR([libcrypto not found, but required])
131         ]
132 )
133 AC_CHECK_LIB(ssl, SSL_library_init, ,
134         [
135                 AC_MSG_ERROR([libssl not found, but required])
136         ]
137 )
138
139 old_LIBS=$LIBS
140 old_CFLAGS=$CFLAGS
141 AC_CHECK_LIB(pq, PQconnectdb,
142         [
143                 LIBS="$LIBS -lpq"
144                 PGLIBS="$LIBS"
145                 AC_SUBST(PGLIBS)
146         ],
147         [
148                 AC_MSG_ERROR([libpq required])
149         ]
150 )
151
152 AC_MSG_CHECKING([libpq includes])
153 PQICFLAGS=`pg_config --includedir`
154 if test -n "$PQICFLAGS" ; then
155   CFLAGS="$CFLAGS -I$PQICFLAGS"
156 fi
157
158 AC_TRY_LINK([
159         #include <libpq-fe.h>
160         ],
161         [ PGconn *dbh = PQconnectdb(""); ],
162         [],
163         [ AC_MSG_ERROR([Cannot compile/link against libpq]) ]
164 )
165 PGCFLAGS=$CFLAGS
166 AC_SUBST(PGCFLAGS)
167
168 LIBS=$old_LIBS
169 CFLAGS=$old_CFLAGS
170
171 ########
172 #
173 # CHECK FOR VARIOUS MODULE CRITERIA
174 # We don't track the libs themselves, as we'll just explictly link
175 # against the in the makefile if we enable them to build (by adding
176 # them to the BUILD_MODULES list).
177 #
178 ########
179
180 # Should we build snmp checks?
181 SAVELIBS="$LIBS"
182 AC_CHECK_LIB(netsnmp, snmp_sess_open,
183         [
184                 BUILD_MODULES="$BUILD_MODULES snmp.$MODULEEXT"
185         ],
186         [
187                 AC_MSG_WARN([No libnetsnmp, skipping snmp module])
188         ]
189 )
190 LIBS="$SAVELIBS"
191
192 # Should we build ssh2 checks?
193 SAVELIBS="$LIBS"
194 AC_CHECK_LIB(ssh2, libssh2_session_init_ex,
195         [
196                 BUILD_MODULES="$BUILD_MODULES ssh2.$MODULEEXT"
197         ],
198         [
199                 AC_MSG_WARN([No libssh2, skipping ssh2 module])
200         ]
201 )
202 LIBS="$SAVELIBS"
203
204 AC_MSG_CHECKING([libxml2 cflags])
205 XML2CFLAGS=`xml2-config --cflags`
206 CFLAGS="$CFLAGS $XML2CFLAGS"
207 AC_MSG_RESULT([$XML2CFLAGS])
208
209 AC_MSG_CHECKING([libxml2 libs])
210 XML2LIBS=`xml2-config --libs`
211 LIBS="$LIBS $XML2LIBS"
212 AC_MSG_RESULT([$XML2LIBS])
213
214 APRPREFIX="`apr-1-config --prefix`"
215 AC_MSG_CHECKING([libserf cflags])
216 AC_SUBST(APRPREFIX)
217 AC_MSG_RESULT([$APRPREFIX])
218
219 AC_MSG_CHECKING([libserf cflags])
220 SERFCFLAGS="`apr-1-config --cflags --cppflags`"
221 SERFCFLAGS="$SERFCFLAGS -I`apu-1-config --includedir` -I`apr-1-config --includedir`"
222 AC_SUBST(SERFCFLAGS)
223 AC_MSG_RESULT([$SERFCFLAGS])
224
225 AC_MSG_CHECKING([libserf libs])
226 SERFLIBS="`apu-1-config --link-ld --ldflags --libs` `apr-1-config --link-ld --ldflags --libs`"
227 AC_SUBST(SERFLIBS)
228 AC_MSG_RESULT([$SERFLIBS])
229
230 AC_TRY_LINK([],
231         [ issetugid(); ],
232         [ ac_cv_libc_defines_issetugid="yes" ],
233         [ ac_cv_libc_defines_issetugid="no" ]
234 )
235 if test "x$ac_cv_libc_defines_issetugid" = "xyes" ; then
236         AC_DEFINE(HAVE_ISSETUGID)
237 fi
238
239 AC_MSG_CHECKING([whether sem_init works])
240 AC_TRY_RUN(
241         [
242 #include <semaphore.h>
243 int main(void){sem_t s;return (0 != sem_init(&s,0,0));}
244         ],
245         [
246                 AC_MSG_RESULT(yes)
247                 AC_DEFINE(WORKING_SEM_INIT)
248         ],
249         [
250                 AC_MSG_RESULT(no)
251                 AC_MSG_WARN([****** sem_init() is broken, I'll implement one myself.])
252         ]
253 )
254
255 AC_FUNC_STRFTIME
256 AC_CHECK_FUNCS(ssetugid strlcpy strnstrn openpty inet_pton inet_ntop getopt \
257                poll)
258
259 # Checks for header files.
260 AC_CHECK_HEADERS(sys/file.h sys/types.h dirent.h sys/param.h fcntl.h errno.h limits.h \
261                  sys/resource.h pthread.h semaphore.h pwd.h stdio.h stdlib.h string.h \
262                  ctype.h unistd.h time.h sys/stat.h sys/event.h libkern/OSAtomic.h \
263                  term.h termio.h termios.h curses.h sys/cdefs.h pwd.h netinet/in_systm.h \
264                  sys/ioctl_compat.h sys/filio.h util.h sys/time.h sys/mman.h \
265                  stropts.h sys/stream.h alloca.h sys/wait.h)
266
267 AC_MSG_CHECKING(for tputs() function final argument type)
268 AC_EGREP_CPP([tputs.*[(][       ]*char[         ]*[)]],
269                 [#if defined(HAVE_TERM_H)
270                  #include <term.h>
271                  #endif
272                  #if defined(HAVE_CURSES_H)
273                  #include <curses.h>
274                  #endif],
275                 [AC_MSG_RESULT(char)
276                  AC_DEFINE(TPUTS_TAKES_CHAR)],
277                 [AC_MSG_RESULT(not char)])
278
279 AC_CACHE_CHECK([for epoll support], ac_cv_have_epoll, [
280         AC_TRY_LINK(
281                 [ #include <sys/types.h> ],
282                 [ u_int a; a = epoll_create(); ],
283                 [ ac_cv_have_epoll="yes" ],
284                 [ ac_cv_have_epoll="no" ]
285         )
286 ])
287 if test "x$ac_cv_have_epoll" = "xyes" ; then
288         AC_DEFINE(HAVE_EPOLL)
289         EVENTER_OBJS="$EVENTER_OBJS eventer_epoll_impl.o"
290         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "epoll")
291         have_epoll=1
292 fi
293
294 AC_CACHE_CHECK([for kqueue support], ac_cv_have_kqueue, [
295         AC_TRY_LINK(
296                 [ #include <sys/types.h> ],
297                 [ u_int a; a = kqueue(); ],
298                 [ ac_cv_have_kqueue="yes" ],
299                 [ ac_cv_have_kqueue="no" ]
300         )
301 ])
302 if test "x$ac_cv_have_kqueue" = "xyes" ; then
303         AC_DEFINE(HAVE_KQUEUE)
304         EVENTER_OBJS="$EVENTER_OBJS eventer_kqueue_impl.o"
305         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "kqueue")
306         have_kqueue=1
307 fi
308
309 AC_CACHE_CHECK([for Solaris ports support], ac_cv_have_ports, [
310         AC_TRY_LINK(
311                 [ #include <port.h> ],
312                 [ u_int a; a = port_create(); ],
313                 [ ac_cv_have_ports="yes" ],
314                 [ ac_cv_have_ports="no" ]
315         )
316 ])
317 if test "x$ac_cv_have_ports" = "xyes" ; then
318         AC_DEFINE(HAVE_PORTS)
319         EVENTER_OBJS="$EVENTER_OBJS eventer_ports_impl.o"
320         AC_DEFINE_UNQUOTED(DEFAULT_EVENTER, "ports")
321         have_ports=1
322 fi
323
324 AC_SUBST(EVENTER_OBJS)
325
326 AC_CACHE_CHECK([for u_int type], ac_cv_have_u_int, [
327         AC_TRY_COMPILE(
328                 [ #include <sys/types.h> ],
329                 [ u_int a; a = 1;],
330                 [ ac_cv_have_u_int="yes" ],
331                 [ ac_cv_have_u_int="no" ]
332         )
333 ])
334 if test "x$ac_cv_have_u_int" = "xyes" ; then
335         AC_DEFINE(HAVE_U_INT)
336         have_u_int=1
337 fi
338
339 AC_CACHE_CHECK([for intXX_t types], ac_cv_have_intxx_t, [
340         AC_TRY_COMPILE(
341                 [ #include <sys/types.h> ],
342                 [ int8_t a; int16_t b; int32_t c; a = b = c = 1;],
343                 [ ac_cv_have_intxx_t="yes" ],
344                 [ ac_cv_have_intxx_t="no" ]
345         )
346 ])
347 if test "x$ac_cv_have_intxx_t" = "xyes" ; then
348         AC_DEFINE(HAVE_INTXX_T)
349         have_intxx_t=1
350 fi
351        
352 AC_CACHE_CHECK([for int64_t type], ac_cv_have_int64_t, [
353         AC_TRY_COMPILE(
354                 [ #include <sys/types.h> ],
355                 [ int64_t a; a = 1;],
356                 [ ac_cv_have_int64_t="yes" ],
357                 [ ac_cv_have_int64_t="no" ]
358         )
359 ])
360 if test "x$ac_cv_have_int64_t" = "xyes" ; then
361         AC_DEFINE(HAVE_INT64_T)
362         have_int64_t=1
363 fi
364        
365 AC_CACHE_CHECK([for u_intXX_t types], ac_cv_have_u_intxx_t, [
366         AC_TRY_COMPILE(
367                 [ #include <sys/types.h> ],
368                 [ u_int8_t a; u_int16_t b; u_int32_t c; a = b = c = 1;],
369                 [ ac_cv_have_u_intxx_t="yes" ],
370                 [ ac_cv_have_u_intxx_t="no" ]
371         )
372 ])
373 if test "x$ac_cv_have_u_intxx_t" = "xyes" ; then
374         AC_DEFINE(HAVE_U_INTXX_T)
375         have_u_intxx_t=1
376 fi
377
378 AC_CACHE_CHECK([for u_int64_t types], ac_cv_have_u_int64_t, [
379         AC_TRY_COMPILE(
380                 [ #include <sys/types.h> ],
381                 [ u_int64_t a; a = 1;],
382                 [ ac_cv_have_u_int64_t="yes" ],
383                 [ ac_cv_have_u_int64_t="no" ]
384         )
385 ])
386 if test "x$ac_cv_have_u_int64_t" = "xyes" ; then
387         AC_DEFINE(HAVE_U_INT64_T)
388         have_u_int64_t=1
389 fi
390
391 if (test -z "$have_u_intxx_t" || test -z "$have_intxx_t" && \
392            test "x$ac_cv_header_sys_bitypes_h" = "xyes")
393 then
394         AC_MSG_CHECKING([for intXX_t and u_intXX_t types in sys/bitypes.h])
395         AC_TRY_COMPILE(
396                 [
397 #include <sys/bitypes.h>
398                 ],
399                 [
400                         int8_t a; int16_t b; int32_t c;
401                         u_int8_t e; u_int16_t f; u_int32_t g;
402                         a = b = c = e = f = g = 1;
403                 ],
404                 [
405                         AC_DEFINE(HAVE_U_INTXX_T)
406                         AC_DEFINE(HAVE_INTXX_T)
407                         AC_MSG_RESULT(yes)
408                 ],
409                 [AC_MSG_RESULT(no)]
410         )
411 fi
412
413 if test -z "$have_u_intxx_t" ; then
414         AC_CACHE_CHECK([for uintXX_t types], ac_cv_have_uintxx_t, [
415                 AC_TRY_COMPILE(
416                         [
417 #include <sys/types.h>
418                         ],
419                         [ uint8_t a; uint16_t b; uint32_t c; a = b = c = 1; ],
420                         [ ac_cv_have_uintxx_t="yes" ],
421                         [ ac_cv_have_uintxx_t="no" ]
422                 )
423         ])
424         if test "x$ac_cv_have_uintxx_t" = "xyes" ; then
425                 AC_DEFINE(HAVE_UINTXX_T)
426         fi
427 fi
428
429 AC_CACHE_CHECK([for socklen_t], ac_cv_have_socklen_t, [
430         AC_TRY_COMPILE(
431                 [
432 #include <sys/types.h>
433 #include <sys/socket.h>
434                 ],
435                 [socklen_t foo; foo = 1235;],
436                 [ ac_cv_have_socklen_t="yes" ],
437                 [ ac_cv_have_socklen_t="no" ]
438         )
439 ])
440 if test "x$ac_cv_have_socklen_t" = "xyes" ; then
441         AC_DEFINE(HAVE_SOCKLEN_T)
442 fi
443
444 AC_CACHE_CHECK([for size_t], ac_cv_have_size_t, [
445         AC_TRY_COMPILE(
446                 [
447 #include <sys/types.h>
448                 ],
449                 [ size_t foo; foo = 1235; ],
450                 [ ac_cv_have_size_t="yes" ],
451                 [ ac_cv_have_size_t="no" ]
452         )
453 ])
454 if test "x$ac_cv_have_size_t" = "xyes" ; then
455         AC_DEFINE(HAVE_SIZE_T)
456 fi
457
458 AC_CACHE_CHECK([for ssize_t], ac_cv_have_ssize_t, [
459         AC_TRY_COMPILE(
460                 [
461 #include <sys/types.h>
462                 ],
463                 [ ssize_t foo; foo = 1235; ],
464                 [ ac_cv_have_ssize_t="yes" ],
465                 [ ac_cv_have_ssize_t="no" ]
466         )
467 ])
468 if test "x$ac_cv_have_ssize_t" = "xyes" ; then
469         AC_DEFINE(HAVE_SSIZE_T)
470 fi
471
472 AC_SUBST(BUILD_MODULES)
473
474 docdir="docs"
475 mansubdir="man"
476 AC_SUBST(docdir)
477 AC_SUBST(mansubdir)
478 SHCFLAGS="$PICFLAGS $CFLAGS"
479 AC_SUBST(SHCFLAGS)
480
481 AC_MSG_CHECKING([Resolving libexec path...])
482 fullpath=$libexecdir
483 while test "x$temppath" != "x$fullpath" ; do
484   temppath=$fullpath
485   fullpath=`eval echo ${fullpath}`
486 done
487 fullpath=`echo $fullpath | sed "s~NONE~$ac_default_prefix~"`
488 AC_MSG_RESULT([$fullpath/noit])
489 AC_DEFINE_UNQUOTED(MODULES_DIR, "${fullpath}/noit")
490 MODULES_DIR=${fullpath}/noit
491 AC_SUBST(MODULES_DIR)
492
493 AC_MSG_CHECKING([Resolving sysconfdir path...])
494 fullpath=$sysconfdir
495 while test "x$temppath" != "x$fullpath" ; do
496   temppath=$fullpath
497   fullpath=`eval echo ${fullpath}`
498 done
499 fullpath=`echo $fullpath | sed "s~NONE~$ac_default_prefix~"`
500 AC_MSG_RESULT([$fullpath])
501 AC_DEFINE_UNQUOTED(ETC_DIR, "${fullpath}")
502 ETC_DIR=${fullpath}
503 AC_SUBST(ETC_DIR)
504
505
506 AC_OUTPUT([
507 Makefile
508 src/Makefile
509 src/eventer/Makefile
510 src/jlog/Makefile
511 src/jlog/perl/Makefile.PL
512 src/udns/Makefile
513 src/modules/Makefile
514 src/modules-lua/Makefile
515 src/utils/Makefile
516 src/noitedit/Makefile
517 src/lua/Makefile
518 sql/Makefile
519 test/Makefile
520 ])
Note: See TracBrowser for help on using the browser.