2 # ngIRCd -- The Next Generation IRC Daemon
3 # Copyright (c)2001-2005 Alexander Barton <alex@barton.de>
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2 of the License, or
8 # (at your option) any later version.
9 # Please read the file COPYING, README and AUTHORS for more information.
11 # $Id: configure.in,v 1.126 2008/02/26 22:04:15 fw Exp $
14 # -- Initialisation --
17 AC_INIT(ngircd, CVSHEAD)
18 AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
21 AM_CONFIG_HEADER(src/config.h)
23 # -- Templates for config.h --
25 AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
26 AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
27 AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
28 AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
29 AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging])
30 AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
31 AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
32 AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
33 AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled])
34 AH_TEMPLATE([ZEROCONF], [Define if support for Zeroconf should be included])
35 AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
37 AH_TEMPLATE([TARGET_OS], [Target operating system name])
38 AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
39 AH_TEMPLATE([TARGET_CPU], [Target CPU name])
45 # -- Helper programs --
53 # -- Compiler Features --
59 # -- Hard coded system and compiler dependencies/features/options ... --
61 AC_DEFUN([GCC_STACK_PROTECT_CC],[
63 # we use -fstack-protector-all for the test to enfoce the use of the guard variable
64 AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
65 ssp_old_cflags="$CFLAGS"
66 CFLAGS="$CFLAGS -fstack-protector-all"
67 AC_TRY_LINK(,,, ssp_cc=no)
69 CFLAGS="$ssp_old_cflags"
70 if test "X$ssp_cc" = "Xyes"; then
71 CFLAGS="$CFLAGS -fstack-protector"
72 AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
77 if test "$GCC" = "yes"; then
78 # We are using the GNU C compiler. Good!
79 CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
86 # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
87 # (tested with HP/UX 11.11)
88 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
92 # Add additional CFLAGS, eventually specified on the command line:
93 test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
95 CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
104 ctype.h errno.h fcntl.h netdb.h netinet/in.h stdlib.h string.h \
105 strings.h sys/socket.h sys/time.h unistd.h \
106 ],,AC_MSG_ERROR([required C header missing!]))
108 AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdbool.h stddef.h varargs.h])
112 AC_MSG_CHECKING(whether socklen_t exists)
114 #include <sys/types.h>
115 #include <sys/socket.h>
118 a = 2; b = 4; a += b;
120 AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
131 AC_CHECK_LIB(UTIL,memmove)
132 AC_CHECK_LIB(socket,bind)
133 AC_CHECK_LIB(nsl,gethostent)
141 bind gethostbyaddr gethostbyname gethostname inet_ntoa malloc memmove \
142 memset realloc setsid setsockopt socket strcasecmp strchr strcspn strerror \
143 strstr waitpid],,AC_MSG_ERROR([required function missing!]))
145 AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strdup strlcpy strlcat)
147 # -- Configuration options --
153 [ --without-syslog disable syslog (autodetected by default)],
154 [ if test "$withval" != "no"; then
155 if test "$withval" != "yes"; then
156 CFLAGS="-I$withval/include $CFLAGS"
157 CPPFLAGS="-I$withval/include $CPPFLAGS"
158 LDFLAGS="-L$withval/lib $LDFLAGS"
160 AC_CHECK_LIB(be, syslog)
161 AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
162 AC_MSG_ERROR([Can't enable syslog!])
167 AC_CHECK_LIB(be, syslog)
168 AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
171 if test "$x_syslog_on" = "yes"; then
173 AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
176 # use zlib compression?
180 [ --without-zlib disable zlib compression (autodetected by default)],
181 [ if test "$withval" != "no"; then
182 if test "$withval" != "yes"; then
183 CFLAGS="-I$withval/include $CFLAGS"
184 CPPFLAGS="-I$withval/include $CPPFLAGS"
185 LDFLAGS="-L$withval/lib $LDFLAGS"
187 AC_CHECK_LIB(z, deflate)
188 AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
189 AC_MSG_ERROR([Can't enable zlib!])
193 [ AC_CHECK_LIB(z, deflate)
194 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
197 if test "$x_zlib_on" = "yes"; then
199 AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
202 # detect which IO API to use:
207 [ --without-select disable select IO support (autodetected by default)],
208 [ if test "$withval" != "no"; then
209 if test "$withval" != "yes"; then
210 CFLAGS="-I$withval/include $CFLAGS"
211 CPPFLAGS="-I$withval/include $CPPFLAGS"
212 LDFLAGS="-L$withval/lib $LDFLAGS"
214 AC_CHECK_FUNCS(select, x_io_select=yes,
215 AC_MSG_ERROR([Can't enable select IO support!])
220 AC_CHECK_FUNCS(select, x_io_select=yes)
225 [ --without-poll disable poll support (autodetected by default)],
226 [ if test "$withval" != "no"; then
227 if test "$withval" != "yes"; then
228 CFLAGS="-I$withval/include $CFLAGS"
229 CPPFLAGS="-I$withval/include $CPPFLAGS"
230 LDFLAGS="-L$withval/lib $LDFLAGS"
232 AC_CHECK_FUNCS(poll, x_io_backend=poll\(\),
233 AC_MSG_ERROR([Can't enable poll IO support!])
238 AC_CHECK_FUNCS(poll, x_io_backend=poll\(\))
243 [ --without-devpoll disable /dev/poll IO support (autodetected by default)],
244 [ if test "$withval" != "no"; then
245 if test "$withval" != "yes"; then
246 CFLAGS="-I$withval/include $CFLAGS"
247 CPPFLAGS="-I$withval/include $CPPFLAGS"
248 LDFLAGS="-L$withval/lib $LDFLAGS"
251 AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
255 AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
260 [ --without-epoll disable epoll IO support (autodetected by default)],
261 [ if test "$withval" != "no"; then
262 if test "$withval" != "yes"; then
263 CFLAGS="-I$withval/include $CFLAGS"
264 CPPFLAGS="-I$withval/include $CPPFLAGS"
265 LDFLAGS="-L$withval/lib $LDFLAGS"
267 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
268 AC_MSG_ERROR([Can't enable epoll IO support!])
273 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
278 [ --without-kqueue disable kqueue IO support (autodetected by default)],
279 [ if test "$withval" != "no"; then
280 if test "$withval" != "yes"; then
281 CFLAGS="-I$withval/include $CFLAGS"
282 CPPFLAGS="-I$withval/include $CPPFLAGS"
283 LDFLAGS="-L$withval/lib $LDFLAGS"
285 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
286 AC_MSG_ERROR([Can't enable kqueue IO support!])
291 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
295 if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
296 # when epoll() and select() are available, we'll use both!
297 x_io_backend="epoll(), select()"
299 if test "$x_io_epoll" = "yes"; then
300 # we prefere epoll() if it is available
301 x_io_backend="epoll()"
303 if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
304 # we'll use select, when available and no "better"
305 # interface has been detected ...
306 x_io_backend="select()"
311 if test "$x_io_backend" = "none"; then
312 AC_MSG_ERROR([No useabe IO API activated/found!?])
318 AC_ARG_WITH(tcp-wrappers,
319 [ --with-tcp-wrappers enable TCP wrappers support],
320 [ if test "$withval" != "no"; then
321 if test "$withval" != "yes"; then
322 CFLAGS="-I$withval/include $CFLAGS"
323 CPPFLAGS="-I$withval/include $CPPFLAGS"
324 LDFLAGS="-L$withval/lib $LDFLAGS"
326 AC_MSG_CHECKING(for hosts_access)
330 int allow_severity = 0;
331 int deny_severity = 0;
333 tcpd_warn("link test");
336 AC_DEFINE(TCPWRAP, 1)
340 AC_MSG_ERROR([Can't enable TCP wrappers!])
346 # include support for "zeroconf"?
349 AC_ARG_WITH(zeroconf,
350 [ --with-zeroconf enable support for "Zeroconf"],
351 [ if test "$withval" != "no"; then
352 if test "$withval" != "yes"; then
353 CFLAGS="-I$withval/include $CFLAGS"
354 CPPFLAGS="-I$withval/include $CPPFLAGS"
355 LDFLAGS="-L$withval/lib $LDFLAGS"
357 AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_zeroconf_on=osx,
359 AC_CHECK_LIB(pthread, pthread_mutexattr_init)
360 AC_CHECK_LIB(howl, sw_discovery_init)
361 AC_CHECK_FUNCS(sw_discovery_init, \
362 x_zeroconf_on=howl, \
363 AC_MSG_ERROR([Can't enable Zeroconf!]))
368 if test "$x_zeroconf_on" = "osx"; then
369 AC_CHECK_HEADERS([DNSServiceDiscovery/DNSServiceDiscovery.h \
370 mach/port.h],,AC_MSG_ERROR([required C header missing!]))
371 AC_DEFINE(ZEROCONF, 1)
373 if test "$x_zeroconf_on" = "howl"; then
374 for dir in /usr/local/include /usr/local/include/howl* \
375 /usr/include /usr/include/howl* \
376 /usr/local/include/avahi* /usr/include/avahi*; do
377 test -d "$dir" || continue
378 AC_MSG_CHECKING([for Howl headers in $dir])
379 if test -f "$dir/rendezvous/rendezvous.h"; then
380 if test "$dir" != "/usr/local/include" -a \
381 "$dir" != "/usr/include"; then
382 CFLAGS="-I$dir $CFLAGS"
383 CPPFLAGS="-I$dir $CPPFLAGS"
391 AC_CHECK_HEADERS([rendezvous/rendezvous.h],, \
392 AC_MSG_ERROR([required C header missing!]))
393 AC_DEFINE(ZEROCONF, 1)
396 # do IDENT requests using libident?
400 [ --with-ident enable "IDENT" ("AUTH") protocol support],
401 [ if test "$withval" != "no"; then
402 if test "$withval" != "yes"; then
403 CFLAGS="-I$withval/include $CFLAGS"
404 CPPFLAGS="-I$withval/include $CPPFLAGS"
405 LDFLAGS="-L$withval/lib $LDFLAGS"
407 AC_CHECK_LIB(ident, ident_id)
408 AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
409 AC_MSG_ERROR([Can't enable IDENT support!])
414 if test "$x_identauth_on" = "yes"; then
415 AC_DEFINE(IDENTAUTH, 1)
416 AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
419 # compile in IRC+ protocol support?
422 AC_ARG_ENABLE(ircplus,
423 [ --disable-ircplus disable IRC+ protocol],
424 if test "$enableval" = "no"; then x_ircplus_on=no; fi
426 if test "$x_ircplus_on" = "yes"; then
427 AC_DEFINE(IRCPLUS, 1)
430 # enable support for IPv6?
433 [ --enable-ipv6, enable IPv6 protocol support],
434 if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
436 if test "$x_ipv6_on" = "yes"; then
438 getaddrinfo getnameinfo \
439 ],,AC_MSG_ERROR([required function missing for IPv6 support!]))
440 AC_DEFINE(WANT_IPV6, 1)
443 # compile in IRC "sniffer"?
445 x_sniffer_on=no; x_debug_on=no
446 AC_ARG_ENABLE(sniffer,
447 [ --enable-sniffer enable IRC traffic sniffer (enables debug mode)],
448 if test "$enableval" = "yes"; then
449 AC_DEFINE(SNIFFER, 1)
450 x_sniffer_on=yes; x_debug_on=yes
454 # enable additional debugging code?
457 [ --enable-debug show additional debug output],
458 if test "$enableval" = "yes"; then x_debug_on=yes; fi
460 if test "$x_debug_on" = "yes"; then
462 test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
465 # enable "strict RFC rules"?
468 AC_ARG_ENABLE(strict-rfc,
469 [ --enable-strict-rfc strict RFC conformance -- may break clients!],
470 if test "$enableval" = "yes"; then
471 AC_DEFINE(STRICT_RFC, 1)
478 AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
479 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
480 AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
482 # Add additional CFLAGS, eventually specified on the command line, but after
483 # running this configure script. Useful for "-Werror" for example.
484 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
486 # -- Generate files --
493 src/portab/Makefile \
494 src/ipaddr/Makefile \
496 src/ngircd/Makefile \
497 src/testsuite/Makefile \
500 contrib/Debian/Makefile \
501 contrib/MacOSX/Makefile \
502 contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
505 type dpkg >/dev/null 2>&1
506 if test $? -eq 0; then
507 # Generate debian/ link if the dpkg command exists
508 # (read: if we are running on a debian compatible system)
509 echo "creating Debian-specific links ..."
510 test -f debian/rules || ln -s contrib/Debian debian
516 echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
519 # Someone please show me a better way :) [borrowed by OpenSSH]
520 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
521 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
522 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
523 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
524 D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
526 echo " Target: ${target}"
527 test "$target" != "$host" && echo " Host: ${host}"
528 echo " Compiler: ${CC}"
529 test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
530 test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
531 test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
532 test -n "$LIBS" && echo " Libraries: ${LIBS}"
534 echo " 'ngircd' binary: $S"
535 echo " Configuration file: $C"
536 echo " Manual pages: $M"
537 echo " Documentation: $D"
540 echo $ECHO_N " Syslog support: $ECHO_C"
541 test "$x_syslog_on" = "yes" \
542 && echo $ECHO_N "yes $ECHO_C" \
543 || echo $ECHO_N "no $ECHO_C"
544 echo $ECHO_N " Enable debug code: $ECHO_C"
545 test "$x_debug_on" = "yes" \
549 echo $ECHO_N " zlib compression: $ECHO_C"
550 test "$x_zlib_on" = "yes" \
551 && echo $ECHO_N "yes $ECHO_C" \
552 || echo $ECHO_N "no $ECHO_C"
553 echo $ECHO_N " IRC sniffer: $ECHO_C"
554 test "$x_sniffer_on" = "yes" \
558 echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
559 test "$x_tcpwrap_on" = "yes" \
560 && echo $ECHO_N "yes $ECHO_C" \
561 || echo $ECHO_N "no $ECHO_C"
562 echo $ECHO_N " Strict RFC mode: $ECHO_C"
563 test "$x_strict_rfc_on" = "yes" \
567 echo $ECHO_N " Zeroconf support: $ECHO_C"
568 case "$x_zeroconf_on" in
570 echo $ECHO_N "Apple $ECHO_C"
573 echo $ECHO_N "Howl $ECHO_C"
576 echo $ECHO_N "no $ECHO_C"
579 echo $ECHO_N " IRC+ protocol: $ECHO_C"
580 test "$x_ircplus_on" = "yes" \
584 echo $ECHO_N " IDENT support: $ECHO_C"
585 test "$x_identauth_on" = "yes" \
586 && echo $ECHO_N "yes $ECHO_C" \
587 || echo $ECHO_N "no $ECHO_C"
588 echo $ECHO_N " I/O backend: $ECHO_C"
589 echo "\"$x_io_backend\""
591 echo $ECHO_N " IPv6 protocol: $ECHO_C"