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.125 2006/12/26 16:00:45 alex 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([ZEROCONF], [Define if support for Zeroconf should be included])
34 AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
36 AH_TEMPLATE([TARGET_OS], [Target operating system name])
37 AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
38 AH_TEMPLATE([TARGET_CPU], [Target CPU name])
44 # -- Helper programs --
52 # -- Compiler Features --
58 # -- Hard coded system and compiler dependencies/features/options ... --
60 AC_DEFUN([GCC_STACK_PROTECT_CC],[
62 # we use -fstack-protector-all for the test to enfoce the use of the guard variable
63 AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
64 ssp_old_cflags="$CFLAGS"
65 CFLAGS="$CFLAGS -fstack-protector-all"
66 AC_TRY_LINK(,,, ssp_cc=no)
68 CFLAGS="$ssp_old_cflags"
69 if test "X$ssp_cc" = "Xyes"; then
70 CFLAGS="$CFLAGS -fstack-protector"
71 AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
76 if test "$GCC" = "yes"; then
77 # We are using the GNU C compiler. Good!
78 CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
85 # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
86 # (tested with HP/UX 11.11)
87 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
91 # Add additional CFLAGS, eventually specified on the command line:
92 test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
94 CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
103 ctype.h errno.h fcntl.h netdb.h netinet/in.h stdlib.h string.h \
104 strings.h sys/socket.h sys/time.h unistd.h \
105 ],,AC_MSG_ERROR([required C header missing!]))
107 AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdbool.h stddef.h varargs.h])
111 AC_MSG_CHECKING(whether socklen_t exists)
113 #include <sys/types.h>
114 #include <sys/socket.h>
117 a = 2; b = 4; a += b;
119 AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
130 AC_CHECK_LIB(UTIL,memmove)
131 AC_CHECK_LIB(socket,bind)
132 AC_CHECK_LIB(nsl,gethostent)
140 bind gethostbyaddr gethostbyname gethostname inet_ntoa malloc memmove \
141 memset realloc setsid setsockopt socket strcasecmp strchr strcspn strerror \
142 strstr waitpid],,AC_MSG_ERROR([required function missing!]))
144 AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strdup strlcpy strlcat)
146 # -- Configuration options --
152 [ --without-syslog disable syslog (autodetected by default)],
153 [ if test "$withval" != "no"; then
154 if test "$withval" != "yes"; then
155 CFLAGS="-I$withval/include $CFLAGS"
156 CPPFLAGS="-I$withval/include $CPPFLAGS"
157 LDFLAGS="-L$withval/lib $LDFLAGS"
159 AC_CHECK_LIB(be, syslog)
160 AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
161 AC_MSG_ERROR([Can't enable syslog!])
166 AC_CHECK_LIB(be, syslog)
167 AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
170 if test "$x_syslog_on" = "yes"; then
172 AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
175 # use zlib compression?
179 [ --without-zlib disable zlib compression (autodetected by default)],
180 [ if test "$withval" != "no"; then
181 if test "$withval" != "yes"; then
182 CFLAGS="-I$withval/include $CFLAGS"
183 CPPFLAGS="-I$withval/include $CPPFLAGS"
184 LDFLAGS="-L$withval/lib $LDFLAGS"
186 AC_CHECK_LIB(z, deflate)
187 AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
188 AC_MSG_ERROR([Can't enable zlib!])
192 [ AC_CHECK_LIB(z, deflate)
193 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
196 if test "$x_zlib_on" = "yes"; then
198 AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
201 # detect which IO API to use:
206 [ --without-select disable select IO support (autodetected by default)],
207 [ if test "$withval" != "no"; then
208 if test "$withval" != "yes"; then
209 CFLAGS="-I$withval/include $CFLAGS"
210 CPPFLAGS="-I$withval/include $CPPFLAGS"
211 LDFLAGS="-L$withval/lib $LDFLAGS"
213 AC_CHECK_FUNCS(select, x_io_select=yes,
214 AC_MSG_ERROR([Can't enable select IO support!])
219 AC_CHECK_FUNCS(select, x_io_select=yes)
224 [ --without-poll disable poll support (autodetected by default)],
225 [ if test "$withval" != "no"; then
226 if test "$withval" != "yes"; then
227 CFLAGS="-I$withval/include $CFLAGS"
228 CPPFLAGS="-I$withval/include $CPPFLAGS"
229 LDFLAGS="-L$withval/lib $LDFLAGS"
231 AC_CHECK_FUNCS(poll, x_io_backend=poll\(\),
232 AC_MSG_ERROR([Can't enable poll IO support!])
237 AC_CHECK_FUNCS(poll, x_io_backend=poll\(\))
242 [ --without-devpoll disable /dev/poll IO support (autodetected by default)],
243 [ if test "$withval" != "no"; then
244 if test "$withval" != "yes"; then
245 CFLAGS="-I$withval/include $CFLAGS"
246 CPPFLAGS="-I$withval/include $CPPFLAGS"
247 LDFLAGS="-L$withval/lib $LDFLAGS"
250 AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
254 AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
259 [ --without-epoll disable epoll IO support (autodetected by default)],
260 [ if test "$withval" != "no"; then
261 if test "$withval" != "yes"; then
262 CFLAGS="-I$withval/include $CFLAGS"
263 CPPFLAGS="-I$withval/include $CPPFLAGS"
264 LDFLAGS="-L$withval/lib $LDFLAGS"
266 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
267 AC_MSG_ERROR([Can't enable epoll IO support!])
272 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
277 [ --without-kqueue disable kqueue IO support (autodetected by default)],
278 [ if test "$withval" != "no"; then
279 if test "$withval" != "yes"; then
280 CFLAGS="-I$withval/include $CFLAGS"
281 CPPFLAGS="-I$withval/include $CPPFLAGS"
282 LDFLAGS="-L$withval/lib $LDFLAGS"
284 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
285 AC_MSG_ERROR([Can't enable kqueue IO support!])
290 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
294 if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
295 # when epoll() and select() are available, we'll use both!
296 x_io_backend="epoll(), select()"
298 if test "$x_io_epoll" = "yes"; then
299 # we prefere epoll() if it is available
300 x_io_backend="epoll()"
302 if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
303 # we'll use select, when available and no "better"
304 # interface has been detected ...
305 x_io_backend="select()"
310 if test "$x_io_backend" = "none"; then
311 AC_MSG_ERROR([No useabe IO API activated/found!?])
317 AC_ARG_WITH(tcp-wrappers,
318 [ --with-tcp-wrappers enable TCP wrappers support],
319 [ if test "$withval" != "no"; then
320 if test "$withval" != "yes"; then
321 CFLAGS="-I$withval/include $CFLAGS"
322 CPPFLAGS="-I$withval/include $CPPFLAGS"
323 LDFLAGS="-L$withval/lib $LDFLAGS"
325 AC_MSG_CHECKING(for hosts_access)
329 int allow_severity = 0;
330 int deny_severity = 0;
332 tcpd_warn("link test");
335 AC_DEFINE(TCPWRAP, 1)
339 AC_MSG_ERROR([Can't enable TCP wrappers!])
345 # include support for "zeroconf"?
348 AC_ARG_WITH(zeroconf,
349 [ --with-zeroconf enable support for "Zeroconf"],
350 [ if test "$withval" != "no"; then
351 if test "$withval" != "yes"; then
352 CFLAGS="-I$withval/include $CFLAGS"
353 CPPFLAGS="-I$withval/include $CPPFLAGS"
354 LDFLAGS="-L$withval/lib $LDFLAGS"
356 AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_zeroconf_on=osx,
358 AC_CHECK_LIB(pthread, pthread_mutexattr_init)
359 AC_CHECK_LIB(howl, sw_discovery_init)
360 AC_CHECK_FUNCS(sw_discovery_init, \
361 x_zeroconf_on=howl, \
362 AC_MSG_ERROR([Can't enable Zeroconf!]))
367 if test "$x_zeroconf_on" = "osx"; then
368 AC_CHECK_HEADERS([DNSServiceDiscovery/DNSServiceDiscovery.h \
369 mach/port.h],,AC_MSG_ERROR([required C header missing!]))
370 AC_DEFINE(ZEROCONF, 1)
372 if test "$x_zeroconf_on" = "howl"; then
373 for dir in /usr/local/include /usr/local/include/howl* \
374 /usr/include /usr/include/howl* \
375 /usr/local/include/avahi* /usr/include/avahi*; do
376 test -d "$dir" || continue
377 AC_MSG_CHECKING([for Howl headers in $dir])
378 if test -f "$dir/rendezvous/rendezvous.h"; then
379 if test "$dir" != "/usr/local/include" -a \
380 "$dir" != "/usr/include"; then
381 CFLAGS="-I$dir $CFLAGS"
382 CPPFLAGS="-I$dir $CPPFLAGS"
390 AC_CHECK_HEADERS([rendezvous/rendezvous.h],, \
391 AC_MSG_ERROR([required C header missing!]))
392 AC_DEFINE(ZEROCONF, 1)
395 # do IDENT requests using libident?
399 [ --with-ident enable "IDENT" ("AUTH") protocol support],
400 [ if test "$withval" != "no"; then
401 if test "$withval" != "yes"; then
402 CFLAGS="-I$withval/include $CFLAGS"
403 CPPFLAGS="-I$withval/include $CPPFLAGS"
404 LDFLAGS="-L$withval/lib $LDFLAGS"
406 AC_CHECK_LIB(ident, ident_id)
407 AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
408 AC_MSG_ERROR([Can't enable IDENT support!])
413 if test "$x_identauth_on" = "yes"; then
414 AC_DEFINE(IDENTAUTH, 1)
415 AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
418 # compile in IRC+ protocol support?
421 AC_ARG_ENABLE(ircplus,
422 [ --disable-ircplus disable IRC+ protocol],
423 if test "$enableval" = "no"; then x_ircplus_on=no; fi
425 if test "$x_ircplus_on" = "yes"; then
426 AC_DEFINE(IRCPLUS, 1)
429 # compile in IRC "sniffer"?
431 x_sniffer_on=no; x_debug_on=no
432 AC_ARG_ENABLE(sniffer,
433 [ --enable-sniffer enable IRC traffic sniffer (enables debug mode)],
434 if test "$enableval" = "yes"; then
435 AC_DEFINE(SNIFFER, 1)
436 x_sniffer_on=yes; x_debug_on=yes
440 # enable additional debugging code?
443 [ --enable-debug show additional debug output],
444 if test "$enableval" = "yes"; then x_debug_on=yes; fi
446 if test "$x_debug_on" = "yes"; then
448 test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
451 # enable "strict RFC rules"?
454 AC_ARG_ENABLE(strict-rfc,
455 [ --enable-strict-rfc strict RFC conformance -- may break clients!],
456 if test "$enableval" = "yes"; then
457 AC_DEFINE(STRICT_RFC, 1)
464 AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
465 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
466 AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
468 # Add additional CFLAGS, eventually specified on the command line, but after
469 # running this configure script. Useful for "-Werror" for example.
470 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
472 # -- Generate files --
479 src/portab/Makefile \
481 src/ngircd/Makefile \
482 src/testsuite/Makefile \
485 contrib/Debian/Makefile \
486 contrib/MacOSX/Makefile \
489 type dpkg >/dev/null 2>&1
490 if test $? -eq 0; then
491 # Generate debian/ link if the dpkg command exists
492 # (read: if we are running on a debian compatible system)
493 echo "creating Debian-specific links ..."
494 test -f debian/rules || ln -s contrib/Debian debian
500 echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
503 # Someone please show me a better way :) [borrowed by OpenSSH]
504 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
505 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
506 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
507 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
508 D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
510 echo " Target: ${target}"
511 test "$target" != "$host" && echo " Host: ${host}"
512 echo " Compiler: ${CC}"
513 test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
514 test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
515 test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
516 test -n "$LIBS" && echo " Libraries: ${LIBS}"
518 echo " 'ngircd' binary: $S"
519 echo " Configuration file: $C"
520 echo " Manual pages: $M"
521 echo " Documentation: $D"
524 echo $ECHO_N " Syslog support: $ECHO_C"
525 test "$x_syslog_on" = "yes" \
526 && echo $ECHO_N "yes $ECHO_C" \
527 || echo $ECHO_N "no $ECHO_C"
528 echo $ECHO_N " Enable debug code: $ECHO_C"
529 test "$x_debug_on" = "yes" \
533 echo $ECHO_N " zlib compression: $ECHO_C"
534 test "$x_zlib_on" = "yes" \
535 && echo $ECHO_N "yes $ECHO_C" \
536 || echo $ECHO_N "no $ECHO_C"
537 echo $ECHO_N " IRC sniffer: $ECHO_C"
538 test "$x_sniffer_on" = "yes" \
542 echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
543 test "$x_tcpwrap_on" = "yes" \
544 && echo $ECHO_N "yes $ECHO_C" \
545 || echo $ECHO_N "no $ECHO_C"
546 echo $ECHO_N " Strict RFC mode: $ECHO_C"
547 test "$x_strict_rfc_on" = "yes" \
551 echo $ECHO_N " Zeroconf support: $ECHO_C"
552 case "$x_zeroconf_on" in
554 echo $ECHO_N "Apple $ECHO_C"
557 echo $ECHO_N "Howl $ECHO_C"
560 echo $ECHO_N "no $ECHO_C"
563 echo $ECHO_N " IRC+ protocol: $ECHO_C"
564 test "$x_ircplus_on" = "yes" \
568 echo $ECHO_N " IDENT support: $ECHO_C"
569 test "$x_identauth_on" = "yes" \
570 && echo $ECHO_N "yes $ECHO_C" \
571 || echo $ECHO_N "no $ECHO_C"
572 echo $ECHO_N " I/O backend: $ECHO_C"
573 echo "\"$x_io_backend\""