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
116 AC_CHECK_HEADERS_ONCE([ \
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])
170 alarm dup2 endpwent gethostbyaddr gethostbyname gethostname \
171 gettimeofday inet_ntoa memmove memset setsid socket strcasecmp \
172 strchr strcspn strerror strncasecmp strrchr strspn strstr \
174 AC_MSG_ERROR([required function missing!]))
177 AC_CHECK_FUNCS_ONCE([ \
178 gai_strerror getaddrinfo getnameinfo inet_aton sigaction sigprocmask \
179 snprintf vsnprintf strdup strlcpy strlcat strtok_r waitpid])
181 # -- Configuration options --
187 AS_HELP_STRING([--without-syslog],
188 [disable syslog (autodetected by default)]),
189 [ if test "$withval" != "no"; then
190 if test "$withval" != "yes"; then
191 CFLAGS="-I$withval/include $CFLAGS"
192 CPPFLAGS="-I$withval/include $CPPFLAGS"
193 LDFLAGS="-L$withval/lib $LDFLAGS"
195 AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes], [
196 AC_MSG_ERROR([Can't enable syslog!])
200 [ AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes])
203 if test "$x_syslog_on" = "yes"; then
205 AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
208 # use zlib compression?
212 AS_HELP_STRING([--without-zlib],
213 [disable zlib compression (autodetected by default)]),
214 [ if test "$withval" != "no"; then
215 if test "$withval" != "yes"; then
216 CFLAGS="-I$withval/include $CFLAGS"
217 CPPFLAGS="-I$withval/include $CPPFLAGS"
218 LDFLAGS="-L$withval/lib $LDFLAGS"
220 AC_CHECK_LIB(z, deflate)
221 AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
222 AC_MSG_ERROR([Can't enable zlib!])
226 [ AC_CHECK_LIB(z, deflate)
227 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
230 if test "$x_zlib_on" = "yes"; then
232 AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
235 # detect which IO API to use:
240 AS_HELP_STRING([--without-select],
241 [disable select IO support (autodetected by default)]),
242 [ if test "$withval" != "no"; then
243 if test "$withval" != "yes"; then
244 CFLAGS="-I$withval/include $CFLAGS"
245 CPPFLAGS="-I$withval/include $CPPFLAGS"
246 LDFLAGS="-L$withval/lib $LDFLAGS"
248 AC_CHECK_FUNCS(select, x_io_select=yes,
249 AC_MSG_ERROR([Can't enable select IO support!])
254 AC_CHECK_FUNCS(select, x_io_select=yes)
259 AS_HELP_STRING([--without-poll],
260 [disable poll support (autodetected by default)]),
261 [ if test "$withval" != "no"; then
262 if test "$withval" != "yes"; then
263 CFLAGS="-I$withval/include $CFLAGS"
264 CPPFLAGS="-I$withval/include $CPPFLAGS"
265 LDFLAGS="-L$withval/lib $LDFLAGS"
267 AC_CHECK_FUNCS(poll, [
268 AC_CHECK_HEADERS(poll.h,
269 x_io_backend=poll\(\),
271 [Can't enable poll IO support!])
274 AC_MSG_ERROR([Can't enable poll IO support!])
279 AC_CHECK_FUNCS(poll, [
280 AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\))
286 AS_HELP_STRING([--without-devpoll],
287 [disable /dev/poll IO support (autodetected by default)]),
288 [ if test "$withval" != "no"; then
289 if test "$withval" != "yes"; then
290 CFLAGS="-I$withval/include $CFLAGS"
291 CPPFLAGS="-I$withval/include $CPPFLAGS"
292 LDFLAGS="-L$withval/lib $LDFLAGS"
295 AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
299 AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
304 AS_HELP_STRING([--without-epoll],
305 [disable epoll IO support (autodetected by default)]),
306 [ if test "$withval" != "no"; then
307 if test "$withval" != "yes"; then
308 CFLAGS="-I$withval/include $CFLAGS"
309 CPPFLAGS="-I$withval/include $CPPFLAGS"
310 LDFLAGS="-L$withval/lib $LDFLAGS"
312 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
313 AC_MSG_ERROR([Can't enable epoll IO support!])
318 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
323 AS_HELP_STRING([--without-kqueue],
324 [disable kqueue IO support (autodetected by default)]),
325 [ if test "$withval" != "no"; then
326 if test "$withval" != "yes"; then
327 CFLAGS="-I$withval/include $CFLAGS"
328 CPPFLAGS="-I$withval/include $CPPFLAGS"
329 LDFLAGS="-L$withval/lib $LDFLAGS"
331 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
332 AC_MSG_ERROR([Can't enable kqueue IO support!])
337 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
341 if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
342 # when epoll() and select() are available, we'll use both!
343 x_io_backend="epoll(), select()"
345 if test "$x_io_epoll" = "yes"; then
346 # we prefere epoll() if it is available
347 x_io_backend="epoll()"
349 if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
350 # we'll use select, when available and no "better"
351 # interface has been detected ...
352 x_io_backend="select()"
357 if test "$x_io_backend" = "none"; then
358 AC_MSG_ERROR([No useable IO API activated/found!?])
364 AS_HELP_STRING([--with-openssl],
365 [enable SSL support using OpenSSL]),
366 [ if test "$withval" != "no"; then
367 if test "$withval" != "yes"; then
368 CFLAGS="-I$withval/include $CFLAGS"
369 CPPFLAGS="-I$withval/include $CPPFLAGS"
370 LDFLAGS="-L$withval/lib $LDFLAGS"
372 AC_CHECK_LIB(crypto, BIO_s_mem)
373 AC_CHECK_LIB(ssl, SSL_library_init)
374 AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes,
375 AC_MSG_ERROR([Can't enable openssl])
382 AS_HELP_STRING([--with-gnutls],
383 [enable SSL support using gnutls]),
384 [ if test "$withval" != "no"; then
385 if test "$withval" != "yes"; then
386 CFLAGS="-I$withval/include $CFLAGS"
387 CPPFLAGS="-I$withval/include $CPPFLAGS"
388 LDFLAGS="-L$withval/lib $LDFLAGS"
390 AC_CHECK_LIB(gnutls, gnutls_global_init)
391 AC_CHECK_FUNCS(gnutls_global_init, x_ssl_gnutls=yes,
392 AC_MSG_ERROR([Can't enable gnutls])
399 if test "$x_ssl_gnutls" = "yes"; then
400 if test "$x_ssl_openssl" = "yes";then
401 AC_MSG_ERROR([Cannot enable both gnutls and openssl])
405 if test "$x_ssl_openssl" = "yes"; then
412 AC_ARG_WITH(tcp-wrappers,
413 AS_HELP_STRING([--with-tcp-wrappers],
414 [enable TCP wrappers support]),
415 [ if test "$withval" != "no"; then
416 if test "$withval" != "yes"; then
417 CFLAGS="-I$withval/include $CFLAGS"
418 CPPFLAGS="-I$withval/include $CPPFLAGS"
419 LDFLAGS="-L$withval/lib $LDFLAGS"
421 AC_MSG_CHECKING(for hosts_access)
425 int allow_severity = 0;
426 int deny_severity = 0;
428 tcpd_warn("link test");
431 AC_DEFINE(TCPWRAP, 1)
435 AC_MSG_ERROR([Can't enable TCP wrappers!])
441 # do IDENT requests using libident?
445 AS_HELP_STRING([--with-ident],
446 [enable "IDENT" ("AUTH") protocol support]),
447 [ if test "$withval" != "no"; then
448 if test "$withval" != "yes"; then
449 CFLAGS="-I$withval/include $CFLAGS"
450 CPPFLAGS="-I$withval/include $CPPFLAGS"
451 LDFLAGS="-L$withval/lib $LDFLAGS"
453 AC_CHECK_LIB(ident, ident_id)
454 AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
455 AC_MSG_ERROR([Can't enable IDENT support!])
460 if test "$x_identauth_on" = "yes"; then
461 AC_DEFINE(IDENTAUTH, 1)
462 AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
465 # compile in PAM support?
469 AS_HELP_STRING([--with-pam],
470 [enable user authentication using PAM]),
471 [ if test "$withval" != "no"; then
472 if test "$withval" != "yes"; then
473 CFLAGS="-I$withval/include $CFLAGS"
474 CPPFLAGS="-I$withval/include $CPPFLAGS"
475 LDFLAGS="-L$withval/lib $LDFLAGS"
477 AC_CHECK_LIB(pam, pam_authenticate)
478 AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes,
479 AC_MSG_ERROR([Can't enable PAM support!])
484 if test "$x_pam_on" = "yes"; then
486 AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes)
487 if test "$pam_ok" != "yes"; then
488 AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes,
489 AC_MSG_ERROR([required C header missing!]))
493 # compile in IRC+ protocol support?
496 AC_ARG_ENABLE(ircplus,
497 AS_HELP_STRING([--disable-ircplus],
498 [disable IRC+ protocol]),
499 if test "$enableval" = "no"; then x_ircplus_on=no; fi
501 if test "$x_ircplus_on" = "yes"; then
502 AC_DEFINE(IRCPLUS, 1)
505 # enable support for IPv6?
508 AS_HELP_STRING([--enable-ipv6],
509 [enable IPv6 protocol support]),
510 if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
512 if test "$x_ipv6_on" = "yes"; then
513 # getaddrinfo() and getnameinfo() are optional when not compiling
514 # with IPv6 support, but are required for IPv6 to work!
516 getaddrinfo getnameinfo \
517 ],,AC_MSG_ERROR([required function missing for IPv6 support!]))
518 AC_DEFINE(WANT_IPV6, 1)
521 # compile in IRC "sniffer"?
523 x_sniffer_on=no; x_debug_on=no
524 AC_ARG_ENABLE(sniffer,
525 AS_HELP_STRING([--enable-sniffer],
526 [enable IRC traffic sniffer (enables debug mode)]),
527 if test "$enableval" = "yes"; then
528 AC_DEFINE(SNIFFER, 1)
529 x_sniffer_on=yes; x_debug_on=yes
533 # enable additional debugging code?
536 AS_HELP_STRING([--enable-debug],
537 [show additional debug output]),
538 if test "$enableval" = "yes"; then x_debug_on=yes; fi
540 if test "$x_debug_on" = "yes"; then
542 test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
543 AC_CHECK_FUNCS(mtrace)
546 # enable "strict RFC rules"?
549 AC_ARG_ENABLE(strict-rfc,
550 AS_HELP_STRING([--enable-strict-rfc],
551 [strict RFC conformance -- may break clients!]),
552 if test "$enableval" = "yes"; then
553 AC_DEFINE(STRICT_RFC, 1)
560 AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
561 AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
562 AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
564 # Add additional CFLAGS, eventually specified on the command line, but after
565 # running this configure script. Useful for "-Werror" for example.
566 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
568 # -- Generate files --
572 contrib/Anope/Makefile \
573 contrib/Debian/Makefile \
574 contrib/MacOSX/Makefile \
575 contrib/MacOSX/ngIRCd.pmdoc/Makefile \
576 contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
581 src/ipaddr/Makefile \
583 src/ngircd/Makefile \
584 src/portab/Makefile \
585 src/testsuite/Makefile \
591 type dpkg >/dev/null 2>&1
592 if test $? -eq 0; then
593 # Generate debian/ link if the dpkg command exists
594 # (read: if we are running on a debian compatible system)
595 echo "creating Debian-specific links ..."
596 test -f debian/rules || ln -s contrib/Debian debian
602 echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
605 # Someone please show me a better way :) [borrowed by OpenSSH]
606 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
607 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
608 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
609 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
610 D=`eval echo ${docdir}` ; D=`eval echo ${D}`
612 echo " Host: ${host}"
613 echo " Compiler: ${CC}"
614 test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
615 test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
616 test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
617 test -n "$LIBS" && echo " Libraries: ${LIBS}"
619 echo " 'ngircd' binary: $S"
620 echo " Configuration file: $C"
621 echo " Manual pages: $M"
622 echo " Documentation: $D"
625 echo $ECHO_N " Syslog support: $ECHO_C"
626 test "$x_syslog_on" = "yes" \
627 && echo $ECHO_N "yes $ECHO_C" \
628 || echo $ECHO_N "no $ECHO_C"
629 echo $ECHO_N " Enable debug code: $ECHO_C"
630 test "$x_debug_on" = "yes" \
634 echo $ECHO_N " zlib compression: $ECHO_C"
635 test "$x_zlib_on" = "yes" \
636 && echo $ECHO_N "yes $ECHO_C" \
637 || echo $ECHO_N "no $ECHO_C"
638 echo $ECHO_N " IRC sniffer: $ECHO_C"
639 test "$x_sniffer_on" = "yes" \
643 echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
644 test "$x_tcpwrap_on" = "yes" \
645 && echo $ECHO_N "yes $ECHO_C" \
646 || echo $ECHO_N "no $ECHO_C"
647 echo $ECHO_N " Strict RFC mode: $ECHO_C"
648 test "$x_strict_rfc_on" = "yes" \
652 echo $ECHO_N " IDENT support: $ECHO_C"
653 test "$x_identauth_on" = "yes" \
654 && echo $ECHO_N "yes $ECHO_C" \
655 || echo $ECHO_N "no $ECHO_C"
656 echo $ECHO_N " IRC+ protocol: $ECHO_C"
657 test "$x_ircplus_on" = "yes" \
661 echo $ECHO_N " IPv6 protocol: $ECHO_C"
662 test "$x_ipv6_on" = "yes" \
663 && echo $ECHO_N "yes $ECHO_C" \
664 || echo $ECHO_N "no $ECHO_C"
665 echo $ECHO_N " I/O backend: $ECHO_C"
666 echo "\"$x_io_backend\""
668 echo $ECHO_N " PAM support: $ECHO_C"
669 test "$x_pam_on" = "yes" \
670 && echo $ECHO_N "yes $ECHO_C" \
671 || echo $ECHO_N "no $ECHO_C"
672 echo $ECHO_N " SSL support: $ECHO_C"