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(git describe|sed -e 's/rel-//g'|sed -e 's/-/~/'|tr -d \\n))
14 # -- Initialisation --
17 AC_INIT([ngIRCd], VERSION_ID,
18 [ngircd-ml@ngircd.barton.de], [ngircd], [http://ngircd.barton.de/])
20 AC_CONFIG_SRCDIR([src/ngircd/ngircd.c])
21 AC_CONFIG_HEADER([src/config.h])
24 AM_INIT_AUTOMAKE([1.11])
26 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
28 # -- Templates for config.h --
30 AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
31 AH_TEMPLATE([HAVE_sockaddr_in_len], [Define if sockaddr_in.sin_len exists])
32 AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
33 AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
34 AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
35 AH_TEMPLATE([PAM], [Define if PAM should be used])
36 AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
37 AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
38 AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging])
39 AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
40 AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled])
41 AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
43 AH_TEMPLATE([HOST_OS], [Target operating system name])
44 AH_TEMPLATE([HOST_VENDOR], [Target system vendor])
45 AH_TEMPLATE([HOST_CPU], [Target CPU name])
52 # -- Helper programs --
60 # -- Compiler Features --
66 # -- Hard coded system and compiler dependencies/features/options ... --
68 AC_DEFUN([GCC_STACK_PROTECT_CC],[
70 # we use -fstack-protector-all for the test to enfoce the use of the guard variable
71 AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
72 ssp_old_cflags="$CFLAGS"
73 CFLAGS="$CFLAGS -fstack-protector-all"
74 AC_TRY_LINK(,,, ssp_cc=no)
76 CFLAGS="$ssp_old_cflags"
77 if test "X$ssp_cc" = "Xyes"; then
78 CFLAGS="$CFLAGS -fstack-protector"
79 AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
83 if test "$GCC" = "yes"; then
84 # We are using the GNU C compiler. Good!
85 CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
92 # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
93 # (tested with HP/UX 11.11)
94 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
98 # Add additional CFLAGS, eventually specified on the command line:
99 test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
101 CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"'"
109 # Required header files
111 fcntl.h netdb.h netinet/in.h netinet/in_systm.h stdlib.h string.h \
112 strings.h sys/socket.h sys/time.h unistd.h \
113 ],,AC_MSG_ERROR([required C header missing!]))
115 # Optional header files
117 arpa/inet.h inttypes.h malloc.h netinet/ip.h stdbool.h stddef.h \
123 AC_MSG_CHECKING(whether socklen_t exists)
125 #include <sys/types.h>
126 #include <sys/socket.h>
129 a = 2; b = 4; a += b;
131 AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
145 AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE(HAVE_sockaddr_in_len),,
146 [#include <arpa/inet.h>])
150 # memmove: A/UX libUTIL
151 AC_SEARCH_LIBS([memmove], [UTIL], [], [
152 AC_MSG_ERROR([unable to find the memmove() function])
154 # gethostbyname: Solaris libnsl
155 AC_SEARCH_LIBS([gethostbyname], [nsl], [], [
156 AC_MSG_ERROR([unable to find the gethostbyname() function])
158 # bind: SVR4 libsocket
159 AC_SEARCH_LIBS([bind], [socket], [], [
160 AC_MSG_ERROR([unable to find the bind() function])
172 alarm dup2 endpwent gethostbyaddr gethostbyname gethostname \
173 gettimeofday inet_ntoa memmove memset setsid socket strcasecmp \
174 strchr strcspn strerror strncasecmp strrchr strspn strstr \
176 AC_MSG_ERROR([required function missing!]))
180 gai_strerror getaddrinfo getnameinfo inet_aton sigaction sigprocmask \
181 snprintf vsnprintf strdup strlcpy strlcat strtok_r waitpid])
183 # -- Configuration options --
189 AS_HELP_STRING([--without-syslog],
190 [disable syslog (autodetected by default)]),
191 [ if test "$withval" != "no"; then
192 if test "$withval" != "yes"; then
193 CFLAGS="-I$withval/include $CFLAGS"
194 CPPFLAGS="-I$withval/include $CPPFLAGS"
195 LDFLAGS="-L$withval/lib $LDFLAGS"
197 AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes], [
198 AC_MSG_ERROR([Can't enable syslog!])
202 [ AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes])
205 if test "$x_syslog_on" = "yes"; then
207 AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
210 # use zlib compression?
214 AS_HELP_STRING([--without-zlib],
215 [disable zlib compression (autodetected by default)]),
216 [ if test "$withval" != "no"; then
217 if test "$withval" != "yes"; then
218 CFLAGS="-I$withval/include $CFLAGS"
219 CPPFLAGS="-I$withval/include $CPPFLAGS"
220 LDFLAGS="-L$withval/lib $LDFLAGS"
222 AC_CHECK_LIB(z, deflate)
223 AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
224 AC_MSG_ERROR([Can't enable zlib!])
228 [ AC_CHECK_LIB(z, deflate)
229 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
232 if test "$x_zlib_on" = "yes"; then
234 AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
237 # detect which IO API to use:
242 AS_HELP_STRING([--without-select],
243 [disable select IO support (autodetected by default)]),
244 [ if test "$withval" != "no"; then
245 if test "$withval" != "yes"; then
246 CFLAGS="-I$withval/include $CFLAGS"
247 CPPFLAGS="-I$withval/include $CPPFLAGS"
248 LDFLAGS="-L$withval/lib $LDFLAGS"
250 AC_CHECK_FUNCS(select, x_io_select=yes,
251 AC_MSG_ERROR([Can't enable select IO support!])
256 AC_CHECK_FUNCS(select, x_io_select=yes)
261 AS_HELP_STRING([--without-poll],
262 [disable poll support (autodetected by default)]),
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_CHECK_FUNCS(poll, [
270 AC_CHECK_HEADERS(poll.h,
271 x_io_backend=poll\(\),
273 [Can't enable poll IO support!])
276 AC_MSG_ERROR([Can't enable poll IO support!])
281 AC_CHECK_FUNCS(poll, [
282 AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\))
288 AS_HELP_STRING([--without-devpoll],
289 [disable /dev/poll IO support (autodetected by default)]),
290 [ if test "$withval" != "no"; then
291 if test "$withval" != "yes"; then
292 CFLAGS="-I$withval/include $CFLAGS"
293 CPPFLAGS="-I$withval/include $CPPFLAGS"
294 LDFLAGS="-L$withval/lib $LDFLAGS"
297 AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
301 AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
306 AS_HELP_STRING([--without-epoll],
307 [disable epoll IO support (autodetected by default)]),
308 [ if test "$withval" != "no"; then
309 if test "$withval" != "yes"; then
310 CFLAGS="-I$withval/include $CFLAGS"
311 CPPFLAGS="-I$withval/include $CPPFLAGS"
312 LDFLAGS="-L$withval/lib $LDFLAGS"
314 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
315 AC_MSG_ERROR([Can't enable epoll IO support!])
320 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
325 AS_HELP_STRING([--without-kqueue],
326 [disable kqueue IO support (autodetected by default)]),
327 [ if test "$withval" != "no"; then
328 if test "$withval" != "yes"; then
329 CFLAGS="-I$withval/include $CFLAGS"
330 CPPFLAGS="-I$withval/include $CPPFLAGS"
331 LDFLAGS="-L$withval/lib $LDFLAGS"
333 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
334 AC_MSG_ERROR([Can't enable kqueue IO support!])
339 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
343 if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
344 # when epoll() and select() are available, we'll use both!
345 x_io_backend="epoll(), select()"
347 if test "$x_io_epoll" = "yes"; then
348 # we prefere epoll() if it is available
349 x_io_backend="epoll()"
351 if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
352 # we'll use select, when available and no "better"
353 # interface has been detected ...
354 x_io_backend="select()"
359 if test "$x_io_backend" = "none"; then
360 AC_MSG_ERROR([No useable IO API activated/found!?])
366 AS_HELP_STRING([--with-openssl],
367 [enable SSL support using OpenSSL]),
368 [ if test "$withval" != "no"; then
369 if test "$withval" != "yes"; then
370 CFLAGS="-I$withval/include $CFLAGS"
371 CPPFLAGS="-I$withval/include $CPPFLAGS"
372 LDFLAGS="-L$withval/lib $LDFLAGS"
374 AC_CHECK_LIB(crypto, BIO_s_mem)
375 AC_CHECK_LIB(ssl, SSL_library_init)
376 AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes,
377 AC_MSG_ERROR([Can't enable openssl])
384 AS_HELP_STRING([--with-gnutls],
385 [enable SSL support using gnutls]),
386 [ if test "$withval" != "no"; then
387 if test "$withval" != "yes"; then
388 CFLAGS="-I$withval/include $CFLAGS"
389 CPPFLAGS="-I$withval/include $CPPFLAGS"
390 LDFLAGS="-L$withval/lib $LDFLAGS"
392 AC_CHECK_LIB(gnutls, gnutls_global_init)
393 AC_CHECK_FUNCS(gnutls_global_init, x_ssl_gnutls=yes,
394 AC_MSG_ERROR([Can't enable gnutls])
401 if test "$x_ssl_gnutls" = "yes"; then
402 if test "$x_ssl_openssl" = "yes";then
403 AC_MSG_ERROR([Cannot enable both gnutls and openssl])
407 if test "$x_ssl_openssl" = "yes"; then
414 AC_ARG_WITH(tcp-wrappers,
415 AS_HELP_STRING([--with-tcp-wrappers],
416 [enable TCP wrappers support]),
417 [ if test "$withval" != "no"; then
418 if test "$withval" != "yes"; then
419 CFLAGS="-I$withval/include $CFLAGS"
420 CPPFLAGS="-I$withval/include $CPPFLAGS"
421 LDFLAGS="-L$withval/lib $LDFLAGS"
423 AC_MSG_CHECKING(for hosts_access)
427 int allow_severity = 0;
428 int deny_severity = 0;
430 tcpd_warn("link test");
433 AC_DEFINE(TCPWRAP, 1)
437 AC_MSG_ERROR([Can't enable TCP wrappers!])
443 # do IDENT requests using libident?
447 AS_HELP_STRING([--with-ident],
448 [enable "IDENT" ("AUTH") protocol support]),
449 [ if test "$withval" != "no"; then
450 if test "$withval" != "yes"; then
451 CFLAGS="-I$withval/include $CFLAGS"
452 CPPFLAGS="-I$withval/include $CPPFLAGS"
453 LDFLAGS="-L$withval/lib $LDFLAGS"
455 AC_CHECK_LIB(ident, ident_id)
456 AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
457 AC_MSG_ERROR([Can't enable IDENT support!])
462 if test "$x_identauth_on" = "yes"; then
463 AC_DEFINE(IDENTAUTH, 1)
464 AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
467 # compile in PAM support?
471 AS_HELP_STRING([--with-pam],
472 [enable user authentication using PAM]),
473 [ if test "$withval" != "no"; then
474 if test "$withval" != "yes"; then
475 CFLAGS="-I$withval/include $CFLAGS"
476 CPPFLAGS="-I$withval/include $CPPFLAGS"
477 LDFLAGS="-L$withval/lib $LDFLAGS"
479 AC_CHECK_LIB(pam, pam_authenticate)
480 AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes,
481 AC_MSG_ERROR([Can't enable PAM support!])
486 if test "$x_pam_on" = "yes"; then
488 AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes)
489 if test "$pam_ok" != "yes"; then
490 AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes,
491 AC_MSG_ERROR([required C header missing!]))
495 # compile in IRC+ protocol support?
498 AC_ARG_ENABLE(ircplus,
499 AS_HELP_STRING([--disable-ircplus],
500 [disable IRC+ protocol]),
501 if test "$enableval" = "no"; then x_ircplus_on=no; fi
503 if test "$x_ircplus_on" = "yes"; then
504 AC_DEFINE(IRCPLUS, 1)
507 # enable support for IPv6?
510 AS_HELP_STRING([--enable-ipv6],
511 [enable IPv6 protocol support]),
512 if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
514 if test "$x_ipv6_on" = "yes"; then
515 # getaddrinfo() and getnameinfo() are optional when not compiling
516 # with IPv6 support, but are required for IPv6 to work!
518 getaddrinfo getnameinfo \
519 ],,AC_MSG_ERROR([required function missing for IPv6 support!]))
520 AC_DEFINE(WANT_IPV6, 1)
523 # compile in IRC "sniffer"?
525 x_sniffer_on=no; x_debug_on=no
526 AC_ARG_ENABLE(sniffer,
527 AS_HELP_STRING([--enable-sniffer],
528 [enable IRC traffic sniffer (enables debug mode)]),
529 if test "$enableval" = "yes"; then
530 AC_DEFINE(SNIFFER, 1)
531 x_sniffer_on=yes; x_debug_on=yes
535 # enable additional debugging code?
538 AS_HELP_STRING([--enable-debug],
539 [show additional debug output]),
540 if test "$enableval" = "yes"; then x_debug_on=yes; fi
542 if test "$x_debug_on" = "yes"; then
544 test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
545 AC_CHECK_FUNCS(mtrace)
548 # enable "strict RFC rules"?
551 AC_ARG_ENABLE(strict-rfc,
552 AS_HELP_STRING([--enable-strict-rfc],
553 [strict RFC conformance -- may break clients!]),
554 if test "$enableval" = "yes"; then
555 AC_DEFINE(STRICT_RFC, 1)
562 AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
563 AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
564 AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
566 # Add additional CFLAGS, eventually specified on the command line, but after
567 # running this configure script. Useful for "-Werror" for example.
568 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
570 # -- Generate files --
574 contrib/Anope/Makefile \
575 contrib/Debian/Makefile \
576 contrib/MacOSX/Makefile \
577 contrib/MacOSX/ngIRCd.pmdoc/Makefile \
578 contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
583 src/ipaddr/Makefile \
585 src/ngircd/Makefile \
586 src/portab/Makefile \
587 src/testsuite/Makefile \
593 type dpkg >/dev/null 2>&1
594 if test $? -eq 0; then
595 # Generate debian/ link if the dpkg command exists
596 # (read: if we are running on a debian compatible system)
597 echo "creating Debian-specific links ..."
598 test -f debian/rules || ln -s contrib/Debian debian
604 echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
607 # Someone please show me a better way :) [borrowed by OpenSSH]
608 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
609 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
610 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
611 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
612 D=`eval echo ${docdir}` ; D=`eval echo ${D}`
614 echo " Host: ${host}"
615 echo " Compiler: ${CC}"
616 test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
617 test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
618 test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
619 test -n "$LIBS" && echo " Libraries: ${LIBS}"
621 echo " 'ngircd' binary: $S"
622 echo " Configuration file: $C"
623 echo " Manual pages: $M"
624 echo " Documentation: $D"
627 echo $ECHO_N " Syslog support: $ECHO_C"
628 test "$x_syslog_on" = "yes" \
629 && echo $ECHO_N "yes $ECHO_C" \
630 || echo $ECHO_N "no $ECHO_C"
631 echo $ECHO_N " Enable debug code: $ECHO_C"
632 test "$x_debug_on" = "yes" \
636 echo $ECHO_N " zlib compression: $ECHO_C"
637 test "$x_zlib_on" = "yes" \
638 && echo $ECHO_N "yes $ECHO_C" \
639 || echo $ECHO_N "no $ECHO_C"
640 echo $ECHO_N " IRC sniffer: $ECHO_C"
641 test "$x_sniffer_on" = "yes" \
645 echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
646 test "$x_tcpwrap_on" = "yes" \
647 && echo $ECHO_N "yes $ECHO_C" \
648 || echo $ECHO_N "no $ECHO_C"
649 echo $ECHO_N " Strict RFC mode: $ECHO_C"
650 test "$x_strict_rfc_on" = "yes" \
654 echo $ECHO_N " IDENT support: $ECHO_C"
655 test "$x_identauth_on" = "yes" \
656 && echo $ECHO_N "yes $ECHO_C" \
657 || echo $ECHO_N "no $ECHO_C"
658 echo $ECHO_N " IRC+ protocol: $ECHO_C"
659 test "$x_ircplus_on" = "yes" \
663 echo $ECHO_N " IPv6 protocol: $ECHO_C"
664 test "$x_ipv6_on" = "yes" \
665 && echo $ECHO_N "yes $ECHO_C" \
666 || echo $ECHO_N "no $ECHO_C"
667 echo $ECHO_N " I/O backend: $ECHO_C"
668 echo "\"$x_io_backend\""
670 echo $ECHO_N " PAM support: $ECHO_C"
671 test "$x_pam_on" = "yes" \
672 && echo $ECHO_N "yes $ECHO_C" \
673 || echo $ECHO_N "no $ECHO_C"
674 echo $ECHO_N " SSL support: $ECHO_C"