2 # ngIRCd -- The Next Generation IRC Daemon
3 # Copyright (c)2001-2008 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.
12 # -- Initialisation --
16 AC_CONFIG_SRCDIR(src/ngircd/ngircd.c)
19 AM_CONFIG_HEADER(src/config.h)
21 # -- Templates for config.h --
23 AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
24 AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
25 AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
26 AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
27 AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging])
28 AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
29 AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
30 AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
31 AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled])
32 AH_TEMPLATE([ZEROCONF], [Define if support for Zeroconf should be included])
33 AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
35 AH_TEMPLATE([TARGET_OS], [Target operating system name])
36 AH_TEMPLATE([TARGET_VENDOR], [Target system vendor])
37 AH_TEMPLATE([TARGET_CPU], [Target CPU name])
43 # -- Helper programs --
51 # -- Compiler Features --
57 # -- Hard coded system and compiler dependencies/features/options ... --
59 AC_DEFUN([GCC_STACK_PROTECT_CC],[
61 # we use -fstack-protector-all for the test to enfoce the use of the guard variable
62 AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
63 ssp_old_cflags="$CFLAGS"
64 CFLAGS="$CFLAGS -fstack-protector-all"
65 AC_TRY_LINK(,,, ssp_cc=no)
67 CFLAGS="$ssp_old_cflags"
68 if test "X$ssp_cc" = "Xyes"; then
69 CFLAGS="$CFLAGS -fstack-protector"
70 AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
75 if test "$GCC" = "yes"; then
76 # We are using the GNU C compiler. Good!
77 CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
84 # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
85 # (tested with HP/UX 11.11)
86 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
90 # Add additional CFLAGS, eventually specified on the command line:
91 test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
93 CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
102 ctype.h errno.h fcntl.h netdb.h netinet/in.h stdlib.h string.h \
103 strings.h sys/socket.h sys/time.h unistd.h \
104 ],,AC_MSG_ERROR([required C header missing!]))
106 AC_CHECK_HEADERS([arpa/inet.h ctype.h malloc.h stdbool.h stddef.h varargs.h])
110 AC_MSG_CHECKING(whether socklen_t exists)
112 #include <sys/types.h>
113 #include <sys/socket.h>
116 a = 2; b = 4; a += b;
118 AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
128 AC_CHECK_LIB(socket,bind)
136 bind gethostbyaddr gethostbyname gethostname inet_ntoa \
137 setsid setsockopt socket strcasecmp waitpid],,AC_MSG_ERROR([required function missing!]))
139 AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strdup strlcpy strlcat strtok_r)
141 # -- Configuration options --
147 [ --without-syslog disable syslog (autodetected by default)],
148 [ if test "$withval" != "no"; then
149 if test "$withval" != "yes"; then
150 CFLAGS="-I$withval/include $CFLAGS"
151 CPPFLAGS="-I$withval/include $CPPFLAGS"
152 LDFLAGS="-L$withval/lib $LDFLAGS"
154 AC_CHECK_LIB(be, syslog)
155 AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
156 AC_MSG_ERROR([Can't enable syslog!])
161 AC_CHECK_LIB(be, syslog)
162 AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
165 if test "$x_syslog_on" = "yes"; then
167 AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
170 # use zlib compression?
174 [ --without-zlib disable zlib compression (autodetected by default)],
175 [ if test "$withval" != "no"; then
176 if test "$withval" != "yes"; then
177 CFLAGS="-I$withval/include $CFLAGS"
178 CPPFLAGS="-I$withval/include $CPPFLAGS"
179 LDFLAGS="-L$withval/lib $LDFLAGS"
181 AC_CHECK_LIB(z, deflate)
182 AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
183 AC_MSG_ERROR([Can't enable zlib!])
187 [ AC_CHECK_LIB(z, deflate)
188 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
191 if test "$x_zlib_on" = "yes"; then
193 AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
196 # detect which IO API to use:
201 [ --without-select disable select IO support (autodetected by default)],
202 [ if test "$withval" != "no"; then
203 if test "$withval" != "yes"; then
204 CFLAGS="-I$withval/include $CFLAGS"
205 CPPFLAGS="-I$withval/include $CPPFLAGS"
206 LDFLAGS="-L$withval/lib $LDFLAGS"
208 AC_CHECK_FUNCS(select, x_io_select=yes,
209 AC_MSG_ERROR([Can't enable select IO support!])
214 AC_CHECK_FUNCS(select, x_io_select=yes)
219 [ --without-poll disable poll support (autodetected by default)],
220 [ if test "$withval" != "no"; then
221 if test "$withval" != "yes"; then
222 CFLAGS="-I$withval/include $CFLAGS"
223 CPPFLAGS="-I$withval/include $CPPFLAGS"
224 LDFLAGS="-L$withval/lib $LDFLAGS"
226 AC_CHECK_FUNCS(poll, x_io_backend=poll\(\),
227 AC_MSG_ERROR([Can't enable poll IO support!])
232 AC_CHECK_FUNCS(poll, x_io_backend=poll\(\))
237 [ --without-devpoll disable /dev/poll IO support (autodetected by default)],
238 [ if test "$withval" != "no"; then
239 if test "$withval" != "yes"; then
240 CFLAGS="-I$withval/include $CFLAGS"
241 CPPFLAGS="-I$withval/include $CPPFLAGS"
242 LDFLAGS="-L$withval/lib $LDFLAGS"
245 AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
249 AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
254 [ --without-epoll disable epoll IO support (autodetected by default)],
255 [ if test "$withval" != "no"; then
256 if test "$withval" != "yes"; then
257 CFLAGS="-I$withval/include $CFLAGS"
258 CPPFLAGS="-I$withval/include $CPPFLAGS"
259 LDFLAGS="-L$withval/lib $LDFLAGS"
261 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
262 AC_MSG_ERROR([Can't enable epoll IO support!])
267 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
272 [ --without-kqueue disable kqueue IO support (autodetected by default)],
273 [ if test "$withval" != "no"; then
274 if test "$withval" != "yes"; then
275 CFLAGS="-I$withval/include $CFLAGS"
276 CPPFLAGS="-I$withval/include $CPPFLAGS"
277 LDFLAGS="-L$withval/lib $LDFLAGS"
279 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
280 AC_MSG_ERROR([Can't enable kqueue IO support!])
285 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
289 if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
290 # when epoll() and select() are available, we'll use both!
291 x_io_backend="epoll(), select()"
293 if test "$x_io_epoll" = "yes"; then
294 # we prefere epoll() if it is available
295 x_io_backend="epoll()"
297 if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
298 # we'll use select, when available and no "better"
299 # interface has been detected ...
300 x_io_backend="select()"
305 if test "$x_io_backend" = "none"; then
306 AC_MSG_ERROR([No useabe IO API activated/found!?])
312 AC_ARG_WITH(tcp-wrappers,
313 [ --with-tcp-wrappers enable TCP wrappers support],
314 [ if test "$withval" != "no"; then
315 if test "$withval" != "yes"; then
316 CFLAGS="-I$withval/include $CFLAGS"
317 CPPFLAGS="-I$withval/include $CPPFLAGS"
318 LDFLAGS="-L$withval/lib $LDFLAGS"
320 AC_MSG_CHECKING(for hosts_access)
324 int allow_severity = 0;
325 int deny_severity = 0;
327 tcpd_warn("link test");
330 AC_DEFINE(TCPWRAP, 1)
334 AC_MSG_ERROR([Can't enable TCP wrappers!])
340 # include support for "zeroconf"?
343 AC_ARG_WITH(zeroconf,
344 [ --with-zeroconf enable support for "Zeroconf"],
345 [ if test "$withval" != "no"; then
346 if test "$withval" != "yes"; then
347 CFLAGS="-I$withval/include $CFLAGS"
348 CPPFLAGS="-I$withval/include $CPPFLAGS"
349 LDFLAGS="-L$withval/lib $LDFLAGS"
351 AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_zeroconf_on=osx,
353 AC_CHECK_LIB(pthread, pthread_mutexattr_init)
354 AC_CHECK_LIB(howl, sw_discovery_init)
355 AC_CHECK_FUNCS(sw_discovery_init, \
356 x_zeroconf_on=howl, \
357 AC_MSG_ERROR([Can't enable Zeroconf!]))
362 if test "$x_zeroconf_on" = "osx"; then
363 AC_CHECK_HEADERS([DNSServiceDiscovery/DNSServiceDiscovery.h \
364 mach/port.h],,AC_MSG_ERROR([required C header missing!]))
365 AC_DEFINE(ZEROCONF, 1)
367 if test "$x_zeroconf_on" = "howl"; then
368 for dir in /usr/local/include /usr/local/include/howl* \
369 /usr/include /usr/include/howl* \
370 /usr/local/include/avahi* /usr/include/avahi*; do
371 test -d "$dir" || continue
372 AC_MSG_CHECKING([for Howl headers in $dir])
373 if test -f "$dir/rendezvous/rendezvous.h"; then
374 if test "$dir" != "/usr/local/include" -a \
375 "$dir" != "/usr/include"; then
376 CFLAGS="-I$dir $CFLAGS"
377 CPPFLAGS="-I$dir $CPPFLAGS"
385 AC_CHECK_HEADERS([rendezvous/rendezvous.h],, \
386 AC_MSG_ERROR([required C header missing!]))
387 AC_DEFINE(ZEROCONF, 1)
390 # do IDENT requests using libident?
394 [ --with-ident enable "IDENT" ("AUTH") protocol support],
395 [ if test "$withval" != "no"; then
396 if test "$withval" != "yes"; then
397 CFLAGS="-I$withval/include $CFLAGS"
398 CPPFLAGS="-I$withval/include $CPPFLAGS"
399 LDFLAGS="-L$withval/lib $LDFLAGS"
401 AC_CHECK_LIB(ident, ident_id)
402 AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
403 AC_MSG_ERROR([Can't enable IDENT support!])
408 if test "$x_identauth_on" = "yes"; then
409 AC_DEFINE(IDENTAUTH, 1)
410 AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
413 # compile in IRC+ protocol support?
416 AC_ARG_ENABLE(ircplus,
417 [ --disable-ircplus disable IRC+ protocol],
418 if test "$enableval" = "no"; then x_ircplus_on=no; fi
420 if test "$x_ircplus_on" = "yes"; then
421 AC_DEFINE(IRCPLUS, 1)
424 # enable support for IPv6?
427 [ --enable-ipv6 enable IPv6 protocol support],
428 if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
430 if test "$x_ipv6_on" = "yes"; then
432 getaddrinfo getnameinfo \
433 ],,AC_MSG_ERROR([required function missing for IPv6 support!]))
434 AC_DEFINE(WANT_IPV6, 1)
437 # compile in IRC "sniffer"?
439 x_sniffer_on=no; x_debug_on=no
440 AC_ARG_ENABLE(sniffer,
441 [ --enable-sniffer enable IRC traffic sniffer (enables debug mode)],
442 if test "$enableval" = "yes"; then
443 AC_DEFINE(SNIFFER, 1)
444 x_sniffer_on=yes; x_debug_on=yes
448 # enable additional debugging code?
451 [ --enable-debug show additional debug output],
452 if test "$enableval" = "yes"; then x_debug_on=yes; fi
454 if test "$x_debug_on" = "yes"; then
456 test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
459 # enable "strict RFC rules"?
462 AC_ARG_ENABLE(strict-rfc,
463 [ --enable-strict-rfc strict RFC conformance -- may break clients!],
464 if test "$enableval" = "yes"; then
465 AC_DEFINE(STRICT_RFC, 1)
472 AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
473 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
474 AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
476 # Add additional CFLAGS, eventually specified on the command line, but after
477 # running this configure script. Useful for "-Werror" for example.
478 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
480 # -- Generate files --
487 src/portab/Makefile \
488 src/ipaddr/Makefile \
490 src/ngircd/Makefile \
491 src/testsuite/Makefile \
494 contrib/Debian/Makefile \
495 contrib/MacOSX/Makefile \
496 contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
499 type dpkg >/dev/null 2>&1
500 if test $? -eq 0; then
501 # Generate debian/ link if the dpkg command exists
502 # (read: if we are running on a debian compatible system)
503 echo "creating Debian-specific links ..."
504 test -f debian/rules || ln -s contrib/Debian debian
510 echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
513 # Someone please show me a better way :) [borrowed by OpenSSH]
514 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
515 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
516 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
517 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
518 D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
520 echo " Target: ${target}"
521 test "$target" != "$host" && echo " Host: ${host}"
522 echo " Compiler: ${CC}"
523 test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
524 test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
525 test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
526 test -n "$LIBS" && echo " Libraries: ${LIBS}"
528 echo " 'ngircd' binary: $S"
529 echo " Configuration file: $C"
530 echo " Manual pages: $M"
531 echo " Documentation: $D"
534 echo $ECHO_N " Syslog support: $ECHO_C"
535 test "$x_syslog_on" = "yes" \
536 && echo $ECHO_N "yes $ECHO_C" \
537 || echo $ECHO_N "no $ECHO_C"
538 echo $ECHO_N " Enable debug code: $ECHO_C"
539 test "$x_debug_on" = "yes" \
543 echo $ECHO_N " zlib compression: $ECHO_C"
544 test "$x_zlib_on" = "yes" \
545 && echo $ECHO_N "yes $ECHO_C" \
546 || echo $ECHO_N "no $ECHO_C"
547 echo $ECHO_N " IRC sniffer: $ECHO_C"
548 test "$x_sniffer_on" = "yes" \
552 echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
553 test "$x_tcpwrap_on" = "yes" \
554 && echo $ECHO_N "yes $ECHO_C" \
555 || echo $ECHO_N "no $ECHO_C"
556 echo $ECHO_N " Strict RFC mode: $ECHO_C"
557 test "$x_strict_rfc_on" = "yes" \
561 echo $ECHO_N " Zeroconf support: $ECHO_C"
562 case "$x_zeroconf_on" in
564 echo $ECHO_N "Apple $ECHO_C"
567 echo $ECHO_N "Howl $ECHO_C"
570 echo $ECHO_N "no $ECHO_C"
573 echo $ECHO_N " IRC+ protocol: $ECHO_C"
574 test "$x_ircplus_on" = "yes" \
578 echo $ECHO_N " IDENT support: $ECHO_C"
579 test "$x_identauth_on" = "yes" \
580 && echo $ECHO_N "yes $ECHO_C" \
581 || echo $ECHO_N "no $ECHO_C"
582 echo $ECHO_N " I/O backend: $ECHO_C"
583 echo "\"$x_io_backend\""
585 echo $ECHO_N " IPv6 protocol: $ECHO_C"