2 # ngIRCd -- The Next Generation IRC Daemon
3 # Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors
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 define(VERSION_ID,esyscmd([
13 V=`git describe 2>/dev/null | sed -e 's/rel-//g' | sed -e 's/-/~/'`;
14 [ -z "$V" -a -r configure ] \
15 && V=`grep "PACKAGE_STRING=" configure | cut -d"'" -f2 | cut -d' ' -f2`
16 ( [ -n "$V" ] && echo "$V" || echo "??" ) | tr -d '\n';
19 m4_ifdef([AM_SILENT_RULES],
20 [m4_define([ng_color_tests], [color-tests])],
21 [m4_define([ng_color_tests], [])])
23 # -- Initialisation --
26 AC_INIT([ngIRCd], VERSION_ID,
27 [ngircd-ml@ngircd.barton.de], [ngircd], [http://ngircd.barton.de/])
29 AC_CONFIG_SRCDIR([src/ngircd/ngircd.c])
30 AC_CONFIG_HEADER([src/config.h])
33 AM_INIT_AUTOMAKE([-Wall 1.10 ]ng_color_tests)
35 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
37 # -- Templates for config.h --
39 AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
40 AH_TEMPLATE([HAVE_sockaddr_in_len], [Define if sockaddr_in.sin_len exists])
41 AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
42 AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
43 AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
44 AH_TEMPLATE([PAM], [Define if PAM should be used])
45 AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
46 AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
47 AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging])
48 AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
49 AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled])
50 AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
52 AH_TEMPLATE([HOST_OS], [Target operating system name])
53 AH_TEMPLATE([HOST_VENDOR], [Target system vendor])
54 AH_TEMPLATE([HOST_CPU], [Target CPU name])
61 # -- Helper programs --
70 # -- Compiler Features --
76 # -- Hard coded system and compiler dependencies/features/options ... --
78 AC_DEFUN([GCC_STACK_PROTECT_CC],[
80 # we use -fstack-protector-all for the test to enfoce the use of the guard variable
81 AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
82 ssp_old_cflags="$CFLAGS"
83 CFLAGS="$CFLAGS -fstack-protector-all"
84 AC_TRY_LINK(,,, ssp_cc=no)
86 CFLAGS="$ssp_old_cflags"
87 if test "X$ssp_cc" = "Xyes"; then
88 CFLAGS="$CFLAGS -fstack-protector"
89 AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
93 if test "$GCC" = "yes"; then
94 # We are using the GNU C compiler. Good!
95 CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
102 # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
103 # (tested with HP/UX 11.11)
104 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
108 # Add additional CFLAGS, eventually specified on the command line:
109 test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
111 CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
119 # Required header files
121 fcntl.h netdb.h netinet/in.h netinet/in_systm.h stdlib.h string.h \
122 strings.h sys/socket.h sys/time.h unistd.h \
123 ],,AC_MSG_ERROR([required C header missing!]))
125 # Optional header files
126 AC_CHECK_HEADERS_ONCE([ \
127 arpa/inet.h inttypes.h malloc.h netinet/ip.h stdbool.h stddef.h \
133 AC_MSG_CHECKING(whether socklen_t exists)
135 #include <sys/types.h>
136 #include <sys/socket.h>
139 a = 2; b = 4; a += b;
141 AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
155 AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE(HAVE_sockaddr_in_len),,
156 [#include <arpa/inet.h>])
160 # memmove: A/UX libUTIL
161 AC_SEARCH_LIBS([memmove], [UTIL], [], [
162 AC_MSG_ERROR([unable to find the memmove() function])
164 # gethostbyname: Solaris libnsl
165 AC_SEARCH_LIBS([gethostbyname], [nsl], [], [
166 AC_MSG_ERROR([unable to find the gethostbyname() function])
168 # bind: SVR4 libsocket
169 AC_SEARCH_LIBS([bind], [socket], [], [
170 AC_MSG_ERROR([unable to find the bind() function])
180 alarm dup2 endpwent gethostbyaddr gethostbyname gethostname \
181 gettimeofday inet_ntoa memmove memset setsid socket strcasecmp \
182 strchr strcspn strerror strncasecmp strrchr strspn strstr \
184 AC_MSG_ERROR([required function missing!]))
187 AC_CHECK_FUNCS_ONCE([ \
188 gai_strerror getaddrinfo getnameinfo inet_aton sigaction sigprocmask \
189 snprintf vsnprintf strdup strlcpy strlcat strtok_r waitpid])
191 # -- Configuration options --
197 AS_HELP_STRING([--without-syslog],
198 [disable syslog (autodetected by default)]),
199 [ if test "$withval" != "no"; then
200 if test "$withval" != "yes"; then
201 CFLAGS="-I$withval/include $CFLAGS"
202 CPPFLAGS="-I$withval/include $CPPFLAGS"
203 LDFLAGS="-L$withval/lib $LDFLAGS"
205 AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes], [
206 AC_MSG_ERROR([Can't enable syslog!])
210 [ AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes])
213 if test "$x_syslog_on" = "yes"; then
215 AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
218 # use zlib compression?
222 AS_HELP_STRING([--without-zlib],
223 [disable zlib compression (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_LIB(z, deflate)
231 AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
232 AC_MSG_ERROR([Can't enable zlib!])
236 [ AC_CHECK_LIB(z, deflate)
237 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
240 if test "$x_zlib_on" = "yes"; then
242 AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
245 # detect which IO API to use:
250 AS_HELP_STRING([--without-select],
251 [disable select IO support (autodetected by default)]),
252 [ if test "$withval" != "no"; then
253 if test "$withval" != "yes"; then
254 CFLAGS="-I$withval/include $CFLAGS"
255 CPPFLAGS="-I$withval/include $CPPFLAGS"
256 LDFLAGS="-L$withval/lib $LDFLAGS"
258 AC_CHECK_FUNCS(select, x_io_select=yes,
259 AC_MSG_ERROR([Can't enable select IO support!])
264 AC_CHECK_FUNCS(select, x_io_select=yes)
269 AS_HELP_STRING([--without-poll],
270 [disable poll support (autodetected by default)]),
271 [ if test "$withval" != "no"; then
272 if test "$withval" != "yes"; then
273 CFLAGS="-I$withval/include $CFLAGS"
274 CPPFLAGS="-I$withval/include $CPPFLAGS"
275 LDFLAGS="-L$withval/lib $LDFLAGS"
277 AC_CHECK_FUNCS(poll, [
278 AC_CHECK_HEADERS(poll.h,
279 x_io_backend=poll\(\),
281 [Can't enable poll IO support!])
284 AC_MSG_ERROR([Can't enable poll IO support!])
289 AC_CHECK_FUNCS(poll, [
290 AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\))
296 AS_HELP_STRING([--without-devpoll],
297 [disable /dev/poll IO support (autodetected by default)]),
298 [ if test "$withval" != "no"; then
299 if test "$withval" != "yes"; then
300 CFLAGS="-I$withval/include $CFLAGS"
301 CPPFLAGS="-I$withval/include $CPPFLAGS"
302 LDFLAGS="-L$withval/lib $LDFLAGS"
305 AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
309 AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
314 AS_HELP_STRING([--without-epoll],
315 [disable epoll IO support (autodetected by default)]),
316 [ if test "$withval" != "no"; then
317 if test "$withval" != "yes"; then
318 CFLAGS="-I$withval/include $CFLAGS"
319 CPPFLAGS="-I$withval/include $CPPFLAGS"
320 LDFLAGS="-L$withval/lib $LDFLAGS"
322 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
323 AC_MSG_ERROR([Can't enable epoll IO support!])
328 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
333 AS_HELP_STRING([--without-kqueue],
334 [disable kqueue IO support (autodetected by default)]),
335 [ if test "$withval" != "no"; then
336 if test "$withval" != "yes"; then
337 CFLAGS="-I$withval/include $CFLAGS"
338 CPPFLAGS="-I$withval/include $CPPFLAGS"
339 LDFLAGS="-L$withval/lib $LDFLAGS"
341 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
342 AC_MSG_ERROR([Can't enable kqueue IO support!])
347 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
351 if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
352 # when epoll() and select() are available, we'll use both!
353 x_io_backend="epoll(), select()"
355 if test "$x_io_epoll" = "yes"; then
356 # we prefere epoll() if it is available
357 x_io_backend="epoll()"
359 if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
360 # we'll use select, when available and no "better"
361 # interface has been detected ...
362 x_io_backend="select()"
367 if test "$x_io_backend" = "none"; then
368 AC_MSG_ERROR([No useable IO API activated/found!?])
374 AS_HELP_STRING([--with-openssl],
375 [enable SSL support using OpenSSL]),
376 [ if test "$withval" != "no"; then
377 if test "$withval" != "yes"; then
378 CFLAGS="-I$withval/include $CFLAGS"
379 CPPFLAGS="-I$withval/include $CPPFLAGS"
380 LDFLAGS="-L$withval/lib $LDFLAGS"
382 AC_CHECK_LIB(crypto, BIO_s_mem)
383 AC_CHECK_LIB(ssl, SSL_library_init)
384 AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes,
385 AC_MSG_ERROR([Can't enable openssl])
392 AS_HELP_STRING([--with-gnutls],
393 [enable SSL support using gnutls]),
394 [ if test "$withval" != "no"; then
395 if test "$withval" != "yes"; then
396 CFLAGS="-I$withval/include $CFLAGS"
397 CPPFLAGS="-I$withval/include $CPPFLAGS"
398 LDFLAGS="-L$withval/lib $LDFLAGS"
400 AC_CHECK_LIB(gnutls, gnutls_global_init)
401 AC_CHECK_FUNCS(gnutls_global_init, x_ssl_gnutls=yes,
402 AC_MSG_ERROR([Can't enable gnutls])
409 if test "$x_ssl_gnutls" = "yes"; then
410 if test "$x_ssl_openssl" = "yes";then
411 AC_MSG_ERROR([Cannot enable both gnutls and openssl])
415 if test "$x_ssl_openssl" = "yes"; then
422 AC_ARG_WITH(tcp-wrappers,
423 AS_HELP_STRING([--with-tcp-wrappers],
424 [enable TCP wrappers support]),
425 [ if test "$withval" != "no"; then
426 if test "$withval" != "yes"; then
427 CFLAGS="-I$withval/include $CFLAGS"
428 CPPFLAGS="-I$withval/include $CPPFLAGS"
429 LDFLAGS="-L$withval/lib $LDFLAGS"
431 AC_MSG_CHECKING(for hosts_access)
435 int allow_severity = 0;
436 int deny_severity = 0;
438 tcpd_warn("link test");
441 AC_DEFINE(TCPWRAP, 1)
445 AC_MSG_ERROR([Can't enable TCP wrappers!])
451 # do IDENT requests using libident?
455 AS_HELP_STRING([--with-ident],
456 [enable "IDENT" ("AUTH") protocol support]),
457 [ if test "$withval" != "no"; then
458 if test "$withval" != "yes"; then
459 CFLAGS="-I$withval/include $CFLAGS"
460 CPPFLAGS="-I$withval/include $CPPFLAGS"
461 LDFLAGS="-L$withval/lib $LDFLAGS"
463 AC_CHECK_LIB(ident, ident_id)
464 AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
465 AC_MSG_ERROR([Can't enable IDENT support!])
470 if test "$x_identauth_on" = "yes"; then
471 AC_DEFINE(IDENTAUTH, 1)
472 AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
475 # compile in PAM support?
479 AS_HELP_STRING([--with-pam],
480 [enable user authentication using PAM]),
481 [ if test "$withval" != "no"; then
482 if test "$withval" != "yes"; then
483 CFLAGS="-I$withval/include $CFLAGS"
484 CPPFLAGS="-I$withval/include $CPPFLAGS"
485 LDFLAGS="-L$withval/lib $LDFLAGS"
487 AC_CHECK_LIB(pam, pam_authenticate)
488 AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes,
489 AC_MSG_ERROR([Can't enable PAM support!])
494 if test "$x_pam_on" = "yes"; then
496 AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes)
497 if test "$pam_ok" != "yes"; then
498 AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes,
499 AC_MSG_ERROR([required C header missing!]))
503 # compile in IRC+ protocol support?
506 AC_ARG_ENABLE(ircplus,
507 AS_HELP_STRING([--disable-ircplus],
508 [disable IRC+ protocol]),
509 if test "$enableval" = "no"; then x_ircplus_on=no; fi
511 if test "$x_ircplus_on" = "yes"; then
512 AC_DEFINE(IRCPLUS, 1)
515 # enable support for IPv6?
518 AS_HELP_STRING([--enable-ipv6],
519 [enable IPv6 protocol support]),
520 if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
522 if test "$x_ipv6_on" = "yes"; then
523 # getaddrinfo() and getnameinfo() are optional when not compiling
524 # with IPv6 support, but are required for IPv6 to work!
526 getaddrinfo getnameinfo \
527 ],,AC_MSG_ERROR([required function missing for IPv6 support!]))
528 AC_DEFINE(WANT_IPV6, 1)
531 # compile in IRC "sniffer"?
533 x_sniffer_on=no; x_debug_on=no
534 AC_ARG_ENABLE(sniffer,
535 AS_HELP_STRING([--enable-sniffer],
536 [enable IRC traffic sniffer (enables debug mode)]),
537 if test "$enableval" = "yes"; then
538 AC_DEFINE(SNIFFER, 1)
539 x_sniffer_on=yes; x_debug_on=yes
543 # enable additional debugging code?
546 AS_HELP_STRING([--enable-debug],
547 [show additional debug output]),
548 if test "$enableval" = "yes"; then x_debug_on=yes; fi
550 if test "$x_debug_on" = "yes"; then
552 test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
553 AC_CHECK_FUNCS(mtrace)
556 # enable "strict RFC rules"?
559 AC_ARG_ENABLE(strict-rfc,
560 AS_HELP_STRING([--enable-strict-rfc],
561 [strict RFC conformance -- may break clients!]),
562 if test "$enableval" = "yes"; then
563 AC_DEFINE(STRICT_RFC, 1)
570 AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
571 AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
572 AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
574 # Add additional CFLAGS, eventually specified on the command line, but after
575 # running this configure script. Useful for "-Werror" for example.
576 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
578 # -- Generate files --
582 contrib/Anope/Makefile \
583 contrib/Debian/Makefile \
584 contrib/MacOSX/Makefile \
585 contrib/MacOSX/ngIRCd.pmdoc/Makefile \
586 contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
591 src/ipaddr/Makefile \
593 src/ngircd/Makefile \
594 src/portab/Makefile \
595 src/testsuite/Makefile \
601 type dpkg >/dev/null 2>&1
602 if test $? -eq 0; then
603 # Generate debian/ link if the dpkg command exists
604 # (read: if we are running on a debian compatible system)
605 echo "creating Debian-specific links ..."
606 test -f debian/rules || ln -s contrib/Debian debian
612 echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
615 # Someone please show me a better way :) [borrowed by OpenSSH]
616 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
617 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
618 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
619 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
620 D=`eval echo ${docdir}` ; D=`eval echo ${D}`
622 echo " Host: ${host}"
623 echo " Compiler: ${CC}"
624 test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
625 test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
626 test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
627 test -n "$LIBS" && echo " Libraries: ${LIBS}"
629 echo " 'ngircd' binary: $S"
630 echo " Configuration file: $C"
631 echo " Manual pages: $M"
632 echo " Documentation: $D"
635 echo $ECHO_N " Syslog support: $ECHO_C"
636 test "$x_syslog_on" = "yes" \
637 && echo $ECHO_N "yes $ECHO_C" \
638 || echo $ECHO_N "no $ECHO_C"
639 echo $ECHO_N " Enable debug code: $ECHO_C"
640 test "$x_debug_on" = "yes" \
644 echo $ECHO_N " zlib compression: $ECHO_C"
645 test "$x_zlib_on" = "yes" \
646 && echo $ECHO_N "yes $ECHO_C" \
647 || echo $ECHO_N "no $ECHO_C"
648 echo $ECHO_N " IRC sniffer: $ECHO_C"
649 test "$x_sniffer_on" = "yes" \
653 echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
654 test "$x_tcpwrap_on" = "yes" \
655 && echo $ECHO_N "yes $ECHO_C" \
656 || echo $ECHO_N "no $ECHO_C"
657 echo $ECHO_N " Strict RFC mode: $ECHO_C"
658 test "$x_strict_rfc_on" = "yes" \
662 echo $ECHO_N " IDENT support: $ECHO_C"
663 test "$x_identauth_on" = "yes" \
664 && echo $ECHO_N "yes $ECHO_C" \
665 || echo $ECHO_N "no $ECHO_C"
666 echo $ECHO_N " IRC+ protocol: $ECHO_C"
667 test "$x_ircplus_on" = "yes" \
671 echo $ECHO_N " IPv6 protocol: $ECHO_C"
672 test "$x_ipv6_on" = "yes" \
673 && echo $ECHO_N "yes $ECHO_C" \
674 || echo $ECHO_N "no $ECHO_C"
675 echo $ECHO_N " I/O backend: $ECHO_C"
676 echo "\"$x_io_backend\""
678 echo $ECHO_N " PAM support: $ECHO_C"
679 test "$x_pam_on" = "yes" \
680 && echo $ECHO_N "yes $ECHO_C" \
681 || echo $ECHO_N "no $ECHO_C"
682 echo $ECHO_N " SSL support: $ECHO_C"
687 if ! grep "^AUTOMAKE_OPTIONS = ../portab/ansi2knr" src/ngircd/Makefile.am >/dev/null 2>&1; then
689 echo "This GNU automake generated build system does not support \"de-ANSI-fication\","
690 echo "therefore don't use it to generate \"official\" distribution archives!"
691 echo "(Most probably you want to use GNU automake 1.11.x for this purpose ...)"