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.122 2006/09/16 15:00:09 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([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 strerror \
142 strstr waitpid],,AC_MSG_ERROR([required function missing!]))
144 AC_CHECK_FUNCS(inet_aton isdigit sigaction snprintf vsnprintf strdup strlcpy strlcat)
146 AC_CHECK_FUNCS(select,[AC_CHECK_HEADERS(sys/select.h)],
147 AC_MSG_ERROR([required function select() is missing!])
150 # -- Configuration options --
154 [ --without-syslog disable syslog (autodetected by default)],
155 [ if test "$withval" != "no"; then
156 if test "$withval" != "yes"; then
157 CFLAGS="-I$withval/include $CFLAGS"
158 CPPFLAGS="-I$withval/include $CPPFLAGS"
159 LDFLAGS="-L$withval/lib $LDFLAGS"
161 AC_CHECK_LIB(be, syslog)
162 AC_CHECK_FUNCS(syslog, x_syslog_on=yes,
163 AC_MSG_ERROR([Can't enable syslog!])
168 AC_CHECK_LIB(be, syslog)
169 AC_CHECK_FUNCS(syslog, x_syslog_on=yes)
172 if test "$x_syslog_on" = "yes"; then
174 AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
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!]))
204 [ --without-poll disable poll support (autodetected by default)],
205 [ if test "$withval" != "no"; then
206 if test "$withval" != "yes"; then
207 CFLAGS="-I$withval/include $CFLAGS"
208 CPPFLAGS="-I$withval/include $CPPFLAGS"
209 LDFLAGS="-L$withval/lib $LDFLAGS"
211 AC_CHECK_FUNCS(poll, x_io_backend=poll,
212 AC_MSG_ERROR([Can't enable poll support!])
217 AC_CHECK_FUNCS(poll, x_io_backend=poll)
223 [ --without-epoll disable epoll support (autodetected by default)],
224 [ if test "$withval" != "no"; then
225 if test "$withval" != "yes"; then
226 CFLAGS="-I$withval/include $CFLAGS"
227 CPPFLAGS="-I$withval/include $CPPFLAGS"
228 LDFLAGS="-L$withval/lib $LDFLAGS"
230 AC_CHECK_FUNCS(epoll_create, x_io_backend=epoll,
231 AC_MSG_ERROR([Can't enable epoll support!])
236 AC_CHECK_FUNCS(epoll_create, x_io_backend=epoll)
242 [ --without-kqueue disable kqueue 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"
249 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue,
250 AC_MSG_ERROR([Can't enable kqueue support!])
255 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue)
261 AC_ARG_WITH(tcp-wrappers,
262 [ --with-tcp-wrappers enable TCP wrappers support],
263 [ if test "$withval" != "no"; then
264 if test "$withval" != "yes"; then
265 CFLAGS="-I$withval/include $CFLAGS"
266 CPPFLAGS="-I$withval/include $CPPFLAGS"
267 LDFLAGS="-L$withval/lib $LDFLAGS"
269 AC_MSG_CHECKING(for hosts_access)
273 int allow_severity = 0;
274 int deny_severity = 0;
276 tcpd_warn("link test");
279 AC_DEFINE(TCPWRAP, 1)
283 AC_MSG_ERROR([Can't enable TCP wrappers!])
290 AC_ARG_WITH(zeroconf,
291 [ --with-zeroconf enable support for "Zeroconf"],
292 [ if test "$withval" != "no"; then
293 if test "$withval" != "yes"; then
294 CFLAGS="-I$withval/include $CFLAGS"
295 CPPFLAGS="-I$withval/include $CPPFLAGS"
296 LDFLAGS="-L$withval/lib $LDFLAGS"
298 AC_CHECK_FUNCS(DNSServiceRegistrationCreate, x_zeroconf_on=osx,
300 AC_CHECK_LIB(pthread, pthread_mutexattr_init)
301 AC_CHECK_LIB(howl, sw_discovery_init)
302 AC_CHECK_FUNCS(sw_discovery_init, \
303 x_zeroconf_on=howl, \
304 AC_MSG_ERROR([Can't enable Zeroconf!]))
309 if test "$x_zeroconf_on" = "osx"; then
310 AC_CHECK_HEADERS([DNSServiceDiscovery/DNSServiceDiscovery.h \
311 mach/port.h],,AC_MSG_ERROR([required C header missing!]))
312 AC_DEFINE(ZEROCONF, 1)
314 if test "$x_zeroconf_on" = "howl"; then
315 for dir in /usr/local/include /usr/local/include/howl* \
316 /usr/include /usr/include/howl* \
317 /usr/local/include/avahi* /usr/include/avahi*; do
318 test -d "$dir" || continue
319 AC_MSG_CHECKING([for Howl headers in $dir])
320 if test -f "$dir/rendezvous/rendezvous.h"; then
321 if test "$dir" != "/usr/local/include" -a \
322 "$dir" != "/usr/include"; then
323 CFLAGS="-I$dir $CFLAGS"
324 CPPFLAGS="-I$dir $CPPFLAGS"
332 AC_CHECK_HEADERS([rendezvous/rendezvous.h],, \
333 AC_MSG_ERROR([required C header missing!]))
334 AC_DEFINE(ZEROCONF, 1)
339 [ --with-ident enable "IDENT" ("AUTH") protocol support],
340 [ if test "$withval" != "no"; then
341 if test "$withval" != "yes"; then
342 CFLAGS="-I$withval/include $CFLAGS"
343 CPPFLAGS="-I$withval/include $CPPFLAGS"
344 LDFLAGS="-L$withval/lib $LDFLAGS"
346 AC_CHECK_LIB(ident, ident_id)
347 AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
348 AC_MSG_ERROR([Can't enable IDENT support!])
353 if test "$x_identauth_on" = "yes"; then
354 AC_DEFINE(IDENTAUTH, 1)
355 AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
359 AC_ARG_ENABLE(ircplus,
360 [ --disable-ircplus disable IRC+ protocol],
361 if test "$enableval" = "no"; then x_ircplus_on=no; fi
363 if test "$x_ircplus_on" = "yes"; then
364 AC_DEFINE(IRCPLUS, 1)
367 x_sniffer_on=no; x_debug_on=no
368 AC_ARG_ENABLE(sniffer,
369 [ --enable-sniffer enable IRC traffic sniffer (enables debug mode)],
370 if test "$enableval" = "yes"; then
371 AC_DEFINE(SNIFFER, 1)
372 x_sniffer_on=yes; x_debug_on=yes
377 [ --enable-debug show additional debug output],
378 if test "$enableval" = "yes"; then x_debug_on=yes; fi
380 if test "$x_debug_on" = "yes"; then
382 test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
386 AC_ARG_ENABLE(strict-rfc,
387 [ --enable-strict-rfc strict RFC conformance -- may break clients!],
388 if test "$enableval" = "yes"; then
389 AC_DEFINE(STRICT_RFC, 1)
396 AC_DEFINE_UNQUOTED(TARGET_CPU, "$target_cpu" )
397 AC_DEFINE_UNQUOTED(TARGET_VENDOR, "$target_vendor" )
398 AC_DEFINE_UNQUOTED(TARGET_OS, "$target_os" )
400 # Add additional CFLAGS, eventually specified on the command line, but after
401 # running this configure script. Useful for "-Werror" for example.
402 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
404 # -- Generate files --
411 src/portab/Makefile \
413 src/ngircd/Makefile \
414 src/testsuite/Makefile \
417 contrib/Debian/Makefile \
418 contrib/MacOSX/Makefile \
421 type dpkg >/dev/null 2>&1
422 if test $? -eq 0; then
423 # Generate debian/ link if the dpkg command exists
424 # (read: if we are running on a debian compatible system)
425 echo "creating Debian-specific links ..."
426 test -f debian/rules || ln -s contrib/Debian debian
432 echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
435 # Someone please show me a better way :) [borrowed by OpenSSH]
436 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
437 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
438 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
439 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
440 D=`eval echo ${datadir}/doc/${PACKAGE}` ; D=`eval echo ${D}`
442 echo " Target: ${target}"
443 test "$target" != "$host" && echo " Host: ${host}"
444 echo " Compiler: ${CC}"
445 test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
446 test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
447 test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
448 test -n "$LIBS" && echo " Libraries: ${LIBS}"
450 echo " 'ngircd' binary: $S"
451 echo " Configuration file: $C"
452 echo " Manual pages: $M"
453 echo " Documentation: $D"
456 echo $ECHO_N " Syslog support: $ECHO_C"
457 test "$x_syslog_on" = "yes" \
458 && echo $ECHO_N "yes $ECHO_C" \
459 || echo $ECHO_N "no $ECHO_C"
460 echo $ECHO_N " Enable debug code: $ECHO_C"
461 test "$x_debug_on" = "yes" \
465 echo $ECHO_N " zlib compression: $ECHO_C"
466 test "$x_zlib_on" = "yes" \
467 && echo $ECHO_N "yes $ECHO_C" \
468 || echo $ECHO_N "no $ECHO_C"
469 echo $ECHO_N " IRC sniffer: $ECHO_C"
470 test "$x_sniffer_on" = "yes" \
474 echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
475 test "$x_tcpwrap_on" = "yes" \
476 && echo $ECHO_N "yes $ECHO_C" \
477 || echo $ECHO_N "no $ECHO_C"
478 echo $ECHO_N " Strict RFC mode: $ECHO_C"
479 test "$x_strict_rfc_on" = "yes" \
483 echo $ECHO_N " Zeroconf support: $ECHO_C"
484 case "$x_zeroconf_on" in
486 echo $ECHO_N "Apple $ECHO_C"
489 echo $ECHO_N "Howl $ECHO_C"
492 echo $ECHO_N "no $ECHO_C"
495 echo $ECHO_N " IRC+ protocol: $ECHO_C"
496 test "$x_ircplus_on" = "yes" \
500 echo $ECHO_N " IDENT support: $ECHO_C"
501 test "$x_identauth_on" = "yes" \
502 && echo $ECHO_N "yes $ECHO_C" \
503 || echo $ECHO_N "no $ECHO_C"
504 echo $ECHO_N " I/O backend: $ECHO_C"
505 echo "\"$x_io_backend()\""