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 # -- Initialisation --
22 AC_INIT([ngIRCd], VERSION_ID,
23 [ngircd-ml@ngircd.barton.de], [ngircd], [http://ngircd.barton.de/])
25 AC_CONFIG_SRCDIR([src/ngircd/ngircd.c])
26 AC_CONFIG_HEADER([src/config.h])
29 AM_INIT_AUTOMAKE([1.11])
31 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
33 # -- Templates for config.h --
35 AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
36 AH_TEMPLATE([HAVE_sockaddr_in_len], [Define if sockaddr_in.sin_len exists])
37 AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
38 AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
39 AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
40 AH_TEMPLATE([PAM], [Define if PAM should be used])
41 AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
42 AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
43 AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging])
44 AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
45 AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled])
46 AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
48 AH_TEMPLATE([HOST_OS], [Target operating system name])
49 AH_TEMPLATE([HOST_VENDOR], [Target system vendor])
50 AH_TEMPLATE([HOST_CPU], [Target CPU name])
57 # -- Helper programs --
65 # -- Compiler Features --
71 # -- Hard coded system and compiler dependencies/features/options ... --
73 AC_DEFUN([GCC_STACK_PROTECT_CC],[
75 # we use -fstack-protector-all for the test to enfoce the use of the guard variable
76 AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
77 ssp_old_cflags="$CFLAGS"
78 CFLAGS="$CFLAGS -fstack-protector-all"
79 AC_TRY_LINK(,,, ssp_cc=no)
81 CFLAGS="$ssp_old_cflags"
82 if test "X$ssp_cc" = "Xyes"; then
83 CFLAGS="$CFLAGS -fstack-protector"
84 AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
88 if test "$GCC" = "yes"; then
89 # We are using the GNU C compiler. Good!
90 CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
97 # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
98 # (tested with HP/UX 11.11)
99 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
103 # Add additional CFLAGS, eventually specified on the command line:
104 test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
106 CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
114 # Required header files
116 fcntl.h netdb.h netinet/in.h netinet/in_systm.h stdlib.h string.h \
117 strings.h sys/socket.h sys/time.h unistd.h \
118 ],,AC_MSG_ERROR([required C header missing!]))
120 # Optional header files
121 AC_CHECK_HEADERS_ONCE([ \
122 arpa/inet.h inttypes.h malloc.h netinet/ip.h stdbool.h stddef.h \
128 AC_MSG_CHECKING(whether socklen_t exists)
130 #include <sys/types.h>
131 #include <sys/socket.h>
134 a = 2; b = 4; a += b;
136 AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
150 AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE(HAVE_sockaddr_in_len),,
151 [#include <arpa/inet.h>])
155 # memmove: A/UX libUTIL
156 AC_SEARCH_LIBS([memmove], [UTIL], [], [
157 AC_MSG_ERROR([unable to find the memmove() function])
159 # gethostbyname: Solaris libnsl
160 AC_SEARCH_LIBS([gethostbyname], [nsl], [], [
161 AC_MSG_ERROR([unable to find the gethostbyname() function])
163 # bind: SVR4 libsocket
164 AC_SEARCH_LIBS([bind], [socket], [], [
165 AC_MSG_ERROR([unable to find the bind() function])
175 alarm dup2 endpwent gethostbyaddr gethostbyname gethostname \
176 gettimeofday inet_ntoa memmove memset setsid socket strcasecmp \
177 strchr strcspn strerror strncasecmp strrchr strspn strstr \
179 AC_MSG_ERROR([required function missing!]))
182 AC_CHECK_FUNCS_ONCE([ \
183 gai_strerror getaddrinfo getnameinfo inet_aton sigaction sigprocmask \
184 snprintf vsnprintf strdup strlcpy strlcat strtok_r waitpid])
186 # -- Configuration options --
192 AS_HELP_STRING([--without-syslog],
193 [disable syslog (autodetected by default)]),
194 [ if test "$withval" != "no"; then
195 if test "$withval" != "yes"; then
196 CFLAGS="-I$withval/include $CFLAGS"
197 CPPFLAGS="-I$withval/include $CPPFLAGS"
198 LDFLAGS="-L$withval/lib $LDFLAGS"
200 AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes], [
201 AC_MSG_ERROR([Can't enable syslog!])
205 [ AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes])
208 if test "$x_syslog_on" = "yes"; then
210 AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
213 # use zlib compression?
217 AS_HELP_STRING([--without-zlib],
218 [disable zlib compression (autodetected by default)]),
219 [ if test "$withval" != "no"; then
220 if test "$withval" != "yes"; then
221 CFLAGS="-I$withval/include $CFLAGS"
222 CPPFLAGS="-I$withval/include $CPPFLAGS"
223 LDFLAGS="-L$withval/lib $LDFLAGS"
225 AC_CHECK_LIB(z, deflate)
226 AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
227 AC_MSG_ERROR([Can't enable zlib!])
231 [ AC_CHECK_LIB(z, deflate)
232 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
235 if test "$x_zlib_on" = "yes"; then
237 AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
240 # detect which IO API to use:
245 AS_HELP_STRING([--without-select],
246 [disable select IO support (autodetected by default)]),
247 [ if test "$withval" != "no"; then
248 if test "$withval" != "yes"; then
249 CFLAGS="-I$withval/include $CFLAGS"
250 CPPFLAGS="-I$withval/include $CPPFLAGS"
251 LDFLAGS="-L$withval/lib $LDFLAGS"
253 AC_CHECK_FUNCS(select, x_io_select=yes,
254 AC_MSG_ERROR([Can't enable select IO support!])
259 AC_CHECK_FUNCS(select, x_io_select=yes)
264 AS_HELP_STRING([--without-poll],
265 [disable poll support (autodetected by default)]),
266 [ if test "$withval" != "no"; then
267 if test "$withval" != "yes"; then
268 CFLAGS="-I$withval/include $CFLAGS"
269 CPPFLAGS="-I$withval/include $CPPFLAGS"
270 LDFLAGS="-L$withval/lib $LDFLAGS"
272 AC_CHECK_FUNCS(poll, [
273 AC_CHECK_HEADERS(poll.h,
274 x_io_backend=poll\(\),
276 [Can't enable poll IO support!])
279 AC_MSG_ERROR([Can't enable poll IO support!])
284 AC_CHECK_FUNCS(poll, [
285 AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\))
291 AS_HELP_STRING([--without-devpoll],
292 [disable /dev/poll IO support (autodetected by default)]),
293 [ if test "$withval" != "no"; then
294 if test "$withval" != "yes"; then
295 CFLAGS="-I$withval/include $CFLAGS"
296 CPPFLAGS="-I$withval/include $CPPFLAGS"
297 LDFLAGS="-L$withval/lib $LDFLAGS"
300 AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
304 AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
309 AS_HELP_STRING([--without-epoll],
310 [disable epoll IO support (autodetected by default)]),
311 [ if test "$withval" != "no"; then
312 if test "$withval" != "yes"; then
313 CFLAGS="-I$withval/include $CFLAGS"
314 CPPFLAGS="-I$withval/include $CPPFLAGS"
315 LDFLAGS="-L$withval/lib $LDFLAGS"
317 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
318 AC_MSG_ERROR([Can't enable epoll IO support!])
323 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
328 AS_HELP_STRING([--without-kqueue],
329 [disable kqueue IO support (autodetected by default)]),
330 [ if test "$withval" != "no"; then
331 if test "$withval" != "yes"; then
332 CFLAGS="-I$withval/include $CFLAGS"
333 CPPFLAGS="-I$withval/include $CPPFLAGS"
334 LDFLAGS="-L$withval/lib $LDFLAGS"
336 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
337 AC_MSG_ERROR([Can't enable kqueue IO support!])
342 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
346 if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
347 # when epoll() and select() are available, we'll use both!
348 x_io_backend="epoll(), select()"
350 if test "$x_io_epoll" = "yes"; then
351 # we prefere epoll() if it is available
352 x_io_backend="epoll()"
354 if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
355 # we'll use select, when available and no "better"
356 # interface has been detected ...
357 x_io_backend="select()"
362 if test "$x_io_backend" = "none"; then
363 AC_MSG_ERROR([No useable IO API activated/found!?])
369 AS_HELP_STRING([--with-openssl],
370 [enable SSL support using OpenSSL]),
371 [ if test "$withval" != "no"; then
372 if test "$withval" != "yes"; then
373 CFLAGS="-I$withval/include $CFLAGS"
374 CPPFLAGS="-I$withval/include $CPPFLAGS"
375 LDFLAGS="-L$withval/lib $LDFLAGS"
377 AC_CHECK_LIB(crypto, BIO_s_mem)
378 AC_CHECK_LIB(ssl, SSL_library_init)
379 AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes,
380 AC_MSG_ERROR([Can't enable openssl])
387 AS_HELP_STRING([--with-gnutls],
388 [enable SSL support using gnutls]),
389 [ if test "$withval" != "no"; then
390 if test "$withval" != "yes"; then
391 CFLAGS="-I$withval/include $CFLAGS"
392 CPPFLAGS="-I$withval/include $CPPFLAGS"
393 LDFLAGS="-L$withval/lib $LDFLAGS"
395 AC_CHECK_LIB(gnutls, gnutls_global_init)
396 AC_CHECK_FUNCS(gnutls_global_init, x_ssl_gnutls=yes,
397 AC_MSG_ERROR([Can't enable gnutls])
404 if test "$x_ssl_gnutls" = "yes"; then
405 if test "$x_ssl_openssl" = "yes";then
406 AC_MSG_ERROR([Cannot enable both gnutls and openssl])
410 if test "$x_ssl_openssl" = "yes"; then
417 AC_ARG_WITH(tcp-wrappers,
418 AS_HELP_STRING([--with-tcp-wrappers],
419 [enable TCP wrappers support]),
420 [ if test "$withval" != "no"; then
421 if test "$withval" != "yes"; then
422 CFLAGS="-I$withval/include $CFLAGS"
423 CPPFLAGS="-I$withval/include $CPPFLAGS"
424 LDFLAGS="-L$withval/lib $LDFLAGS"
426 AC_MSG_CHECKING(for hosts_access)
430 int allow_severity = 0;
431 int deny_severity = 0;
433 tcpd_warn("link test");
436 AC_DEFINE(TCPWRAP, 1)
440 AC_MSG_ERROR([Can't enable TCP wrappers!])
446 # do IDENT requests using libident?
450 AS_HELP_STRING([--with-ident],
451 [enable "IDENT" ("AUTH") protocol support]),
452 [ if test "$withval" != "no"; then
453 if test "$withval" != "yes"; then
454 CFLAGS="-I$withval/include $CFLAGS"
455 CPPFLAGS="-I$withval/include $CPPFLAGS"
456 LDFLAGS="-L$withval/lib $LDFLAGS"
458 AC_CHECK_LIB(ident, ident_id)
459 AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
460 AC_MSG_ERROR([Can't enable IDENT support!])
465 if test "$x_identauth_on" = "yes"; then
466 AC_DEFINE(IDENTAUTH, 1)
467 AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
470 # compile in PAM support?
474 AS_HELP_STRING([--with-pam],
475 [enable user authentication using PAM]),
476 [ if test "$withval" != "no"; then
477 if test "$withval" != "yes"; then
478 CFLAGS="-I$withval/include $CFLAGS"
479 CPPFLAGS="-I$withval/include $CPPFLAGS"
480 LDFLAGS="-L$withval/lib $LDFLAGS"
482 AC_CHECK_LIB(pam, pam_authenticate)
483 AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes,
484 AC_MSG_ERROR([Can't enable PAM support!])
489 if test "$x_pam_on" = "yes"; then
491 AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes)
492 if test "$pam_ok" != "yes"; then
493 AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes,
494 AC_MSG_ERROR([required C header missing!]))
498 # compile in IRC+ protocol support?
501 AC_ARG_ENABLE(ircplus,
502 AS_HELP_STRING([--disable-ircplus],
503 [disable IRC+ protocol]),
504 if test "$enableval" = "no"; then x_ircplus_on=no; fi
506 if test "$x_ircplus_on" = "yes"; then
507 AC_DEFINE(IRCPLUS, 1)
510 # enable support for IPv6?
513 AS_HELP_STRING([--enable-ipv6],
514 [enable IPv6 protocol support]),
515 if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
517 if test "$x_ipv6_on" = "yes"; then
518 # getaddrinfo() and getnameinfo() are optional when not compiling
519 # with IPv6 support, but are required for IPv6 to work!
521 getaddrinfo getnameinfo \
522 ],,AC_MSG_ERROR([required function missing for IPv6 support!]))
523 AC_DEFINE(WANT_IPV6, 1)
526 # compile in IRC "sniffer"?
528 x_sniffer_on=no; x_debug_on=no
529 AC_ARG_ENABLE(sniffer,
530 AS_HELP_STRING([--enable-sniffer],
531 [enable IRC traffic sniffer (enables debug mode)]),
532 if test "$enableval" = "yes"; then
533 AC_DEFINE(SNIFFER, 1)
534 x_sniffer_on=yes; x_debug_on=yes
538 # enable additional debugging code?
541 AS_HELP_STRING([--enable-debug],
542 [show additional debug output]),
543 if test "$enableval" = "yes"; then x_debug_on=yes; fi
545 if test "$x_debug_on" = "yes"; then
547 test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
548 AC_CHECK_FUNCS(mtrace)
551 # enable "strict RFC rules"?
554 AC_ARG_ENABLE(strict-rfc,
555 AS_HELP_STRING([--enable-strict-rfc],
556 [strict RFC conformance -- may break clients!]),
557 if test "$enableval" = "yes"; then
558 AC_DEFINE(STRICT_RFC, 1)
565 AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
566 AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
567 AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
569 # Add additional CFLAGS, eventually specified on the command line, but after
570 # running this configure script. Useful for "-Werror" for example.
571 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
573 # -- Generate files --
577 contrib/Anope/Makefile \
578 contrib/Debian/Makefile \
579 contrib/MacOSX/Makefile \
580 contrib/MacOSX/ngIRCd.pmdoc/Makefile \
581 contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
586 src/ipaddr/Makefile \
588 src/ngircd/Makefile \
589 src/portab/Makefile \
590 src/testsuite/Makefile \
596 type dpkg >/dev/null 2>&1
597 if test $? -eq 0; then
598 # Generate debian/ link if the dpkg command exists
599 # (read: if we are running on a debian compatible system)
600 echo "creating Debian-specific links ..."
601 test -f debian/rules || ln -s contrib/Debian debian
607 echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
610 # Someone please show me a better way :) [borrowed by OpenSSH]
611 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
612 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
613 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
614 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
615 D=`eval echo ${docdir}` ; D=`eval echo ${D}`
617 echo " Host: ${host}"
618 echo " Compiler: ${CC}"
619 test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
620 test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
621 test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
622 test -n "$LIBS" && echo " Libraries: ${LIBS}"
624 echo " 'ngircd' binary: $S"
625 echo " Configuration file: $C"
626 echo " Manual pages: $M"
627 echo " Documentation: $D"
630 echo $ECHO_N " Syslog support: $ECHO_C"
631 test "$x_syslog_on" = "yes" \
632 && echo $ECHO_N "yes $ECHO_C" \
633 || echo $ECHO_N "no $ECHO_C"
634 echo $ECHO_N " Enable debug code: $ECHO_C"
635 test "$x_debug_on" = "yes" \
639 echo $ECHO_N " zlib compression: $ECHO_C"
640 test "$x_zlib_on" = "yes" \
641 && echo $ECHO_N "yes $ECHO_C" \
642 || echo $ECHO_N "no $ECHO_C"
643 echo $ECHO_N " IRC sniffer: $ECHO_C"
644 test "$x_sniffer_on" = "yes" \
648 echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
649 test "$x_tcpwrap_on" = "yes" \
650 && echo $ECHO_N "yes $ECHO_C" \
651 || echo $ECHO_N "no $ECHO_C"
652 echo $ECHO_N " Strict RFC mode: $ECHO_C"
653 test "$x_strict_rfc_on" = "yes" \
657 echo $ECHO_N " IDENT support: $ECHO_C"
658 test "$x_identauth_on" = "yes" \
659 && echo $ECHO_N "yes $ECHO_C" \
660 || echo $ECHO_N "no $ECHO_C"
661 echo $ECHO_N " IRC+ protocol: $ECHO_C"
662 test "$x_ircplus_on" = "yes" \
666 echo $ECHO_N " IPv6 protocol: $ECHO_C"
667 test "$x_ipv6_on" = "yes" \
668 && echo $ECHO_N "yes $ECHO_C" \
669 || echo $ECHO_N "no $ECHO_C"
670 echo $ECHO_N " I/O backend: $ECHO_C"
671 echo "\"$x_io_backend\""
673 echo $ECHO_N " PAM support: $ECHO_C"
674 test "$x_pam_on" = "yes" \
675 && echo $ECHO_N "yes $ECHO_C" \
676 || echo $ECHO_N "no $ECHO_C"
677 echo $ECHO_N " SSL support: $ECHO_C"
682 if ! grep "^AUTOMAKE_OPTIONS = ../portab/ansi2knr" src/ngircd/Makefile.am >/dev/null 2>&1; then
684 echo "This GNU automake generated build system does not support \"de-ANSI-fication\","
685 echo "therefore don't use it to generate \"official\" distribution archives!"
686 echo "(Most probably you want to use GNU automake 1.11.x for this purpose ...)"