2 8cfb9104 2012-09-24 alex # ngIRCd -- The Next Generation IRC Daemon
3 bc098794 2014-01-02 alex # Copyright (c)2001-2014 Alexander Barton (alex@barton.de) and Contributors
5 8cfb9104 2012-09-24 alex # This program is free software; you can redistribute it and/or modify
6 8cfb9104 2012-09-24 alex # it under the terms of the GNU General Public License as published by
7 8cfb9104 2012-09-24 alex # the Free Software Foundation; either version 2 of the License, or
8 8cfb9104 2012-09-24 alex # (at your option) any later version.
9 8cfb9104 2012-09-24 alex # Please read the file COPYING, README and AUTHORS for more information.
12 8cfb9104 2012-09-24 alex define(VERSION_ID,esyscmd([
13 8cfb9104 2012-09-24 alex V=`git describe 2>/dev/null | sed -e 's/rel-//g' | sed -e 's/-/~/'`;
14 8cfb9104 2012-09-24 alex [ -z "$V" -a -r configure ] \
15 8cfb9104 2012-09-24 alex && V=`grep "PACKAGE_STRING=" configure | cut -d"'" -f2 | cut -d' ' -f2`
16 8cfb9104 2012-09-24 alex ( [ -n "$V" ] && echo "$V" || echo "??" ) | tr -d '\n';
19 8cfb9104 2012-09-24 alex m4_ifdef([AM_SILENT_RULES],
20 8cfb9104 2012-09-24 alex [m4_define([ng_color_tests], [color-tests])],
21 8cfb9104 2012-09-24 alex [m4_define([ng_color_tests], [])])
23 8cfb9104 2012-09-24 alex # -- Initialisation --
25 8872653e 2014-01-04 alex AC_PREREQ([2.61])
26 bc098794 2014-01-02 alex AC_INIT([ngIRCd],[VERSION_ID],[ngircd-ml@ngircd.barton.de],[ngircd],[http://ngircd.barton.de/])
28 8cfb9104 2012-09-24 alex AC_CONFIG_SRCDIR([src/ngircd/ngircd.c])
29 8cfb9104 2012-09-24 alex AC_CONFIG_HEADER([src/config.h])
30 8cfb9104 2012-09-24 alex AC_CANONICAL_HOST
32 8cfb9104 2012-09-24 alex AM_INIT_AUTOMAKE([-Wall 1.10 ]ng_color_tests)
34 8cfb9104 2012-09-24 alex m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
36 8cfb9104 2012-09-24 alex # -- Templates for config.h --
38 8cfb9104 2012-09-24 alex AH_TEMPLATE([DEBUG], [Define if debug-mode should be enabled])
39 8cfb9104 2012-09-24 alex AH_TEMPLATE([HAVE_sockaddr_in_len], [Define if sockaddr_in.sin_len exists])
40 8cfb9104 2012-09-24 alex AH_TEMPLATE([HAVE_socklen_t], [Define if socklen_t exists])
41 46b0eef7 2012-10-06 alex AH_TEMPLATE([ICONV], [Define if libiconv can be used, e.g. for CHARCONV])
42 8cfb9104 2012-09-24 alex AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
43 8cfb9104 2012-09-24 alex AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
44 8cfb9104 2012-09-24 alex AH_TEMPLATE([PAM], [Define if PAM should be used])
45 8cfb9104 2012-09-24 alex AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
46 8cfb9104 2012-09-24 alex AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
47 8cfb9104 2012-09-24 alex AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging])
48 8cfb9104 2012-09-24 alex AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
49 8cfb9104 2012-09-24 alex AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled])
50 8cfb9104 2012-09-24 alex AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
52 8cfb9104 2012-09-24 alex AH_TEMPLATE([HOST_OS], [Target operating system name])
53 8cfb9104 2012-09-24 alex AH_TEMPLATE([HOST_VENDOR], [Target system vendor])
54 8cfb9104 2012-09-24 alex AH_TEMPLATE([HOST_CPU], [Target CPU name])
56 8cfb9104 2012-09-24 alex # -- C Compiler --
59 8cfb9104 2012-09-24 alex AC_PROG_CC_STDC
61 8cfb9104 2012-09-24 alex # -- Helper programs --
63 b730b64b 2012-09-24 alex m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
66 8cfb9104 2012-09-24 alex AC_PROG_INSTALL
67 8cfb9104 2012-09-24 alex AC_PROG_LN_S
68 8cfb9104 2012-09-24 alex AC_PROG_MAKE_SET
69 90062111 2014-01-17 alex AC_PROG_MKDIR_P
70 8cfb9104 2012-09-24 alex AC_PROG_RANLIB
72 8cfb9104 2012-09-24 alex # -- Compiler Features --
76 8cfb9104 2012-09-24 alex __ng_PROTOTYPES__
78 34824abe 2013-11-11 alex # -- Function Definitions --
80 8cfb9104 2012-09-24 alex AC_DEFUN([GCC_STACK_PROTECT_CC],[
82 34824abe 2013-11-11 alex # Use -fstack-protector-all for the test to enfoce the use of the
83 34824abe 2013-11-11 alex # guard variable
84 34824abe 2013-11-11 alex AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
85 34824abe 2013-11-11 alex ssp_old_cflags="$CFLAGS"
86 34824abe 2013-11-11 alex CFLAGS="$CFLAGS -fstack-protector-all"
87 bc098794 2014-01-02 alex AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],[],[ssp_cc=no])
88 34824abe 2013-11-11 alex echo $ssp_cc
89 34824abe 2013-11-11 alex CFLAGS="$ssp_old_cflags"
90 34824abe 2013-11-11 alex if test "X$ssp_cc" = "Xyes"; then
91 34824abe 2013-11-11 alex CFLAGS="$CFLAGS -fstack-protector"
92 34824abe 2013-11-11 alex AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
96 b8433e92 2013-12-27 alex AC_DEFUN([WORKING_GETADDRINFO],[
97 b8433e92 2013-12-27 alex AC_CHECK_FUNCS([getaddrinfo],[
98 b8433e92 2013-12-27 alex AC_MSG_CHECKING([whether getaddrinfo() works])
99 bc098794 2014-01-02 alex AC_RUN_IFELSE([AC_LANG_SOURCE([[
100 b8433e92 2013-12-27 alex #include <stdio.h>
101 b8433e92 2013-12-27 alex #include <sys/types.h>
102 b8433e92 2013-12-27 alex #include <sys/socket.h>
103 b8433e92 2013-12-27 alex #include <netdb.h>
105 b8433e92 2013-12-27 alex main(int argc, char **argv)
107 b8433e92 2013-12-27 alex struct addrinfo hints, *ai;
108 b8433e92 2013-12-27 alex memset(&hints, 0, sizeof(hints));
109 b8433e92 2013-12-27 alex hints.ai_flags = AI_PASSIVE;
110 b8433e92 2013-12-27 alex hints.ai_socktype = SOCK_STREAM;
111 b8433e92 2013-12-27 alex hints.ai_family = PF_UNSPEC;
112 b8433e92 2013-12-27 alex if(getaddrinfo(NULL, "0", &hints, &ai) != 0)
117 b8433e92 2013-12-27 alex AC_DEFINE([HAVE_WORKING_GETADDRINFO], 1, [getaddrinfo(0)])
118 b8433e92 2013-12-27 alex AC_MSG_RESULT(yes)
120 b8433e92 2013-12-27 alex AC_MSG_RESULT(no)
122 bc098794 2014-01-02 alex AC_MSG_RESULT(no)
127 34824abe 2013-11-11 alex # -- Hard coded system and compiler dependencies/features/options ... --
129 8cfb9104 2012-09-24 alex if test "$GCC" = "yes"; then
130 8cfb9104 2012-09-24 alex # We are using the GNU C compiler. Good!
131 8cfb9104 2012-09-24 alex CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
133 8cfb9104 2012-09-24 alex GCC_STACK_PROTECT_CC
136 8cfb9104 2012-09-24 alex case "$host_os" in
138 8cfb9104 2012-09-24 alex # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
139 8cfb9104 2012-09-24 alex # (tested with HP/UX 11.11)
140 8cfb9104 2012-09-24 alex CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
144 8cfb9104 2012-09-24 alex # Add additional CFLAGS, eventually specified on the command line:
145 8cfb9104 2012-09-24 alex test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
147 68cb1a8c 2013-01-02 alex CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"' -DDOCDIR='\"\$(docdir)\"'"
149 8cfb9104 2012-09-24 alex # -- Headers --
151 8cfb9104 2012-09-24 alex AC_HEADER_STDC
152 8cfb9104 2012-09-24 alex AC_HEADER_SYS_WAIT
153 8cfb9104 2012-09-24 alex AC_HEADER_TIME
155 8cfb9104 2012-09-24 alex # Required header files
156 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS([ \
157 fd260404 2013-01-24 alex fcntl.h netdb.h netinet/in.h stdlib.h string.h \
158 67256f9d 2014-03-16 alex strings.h sys/socket.h sys/time.h sys/types.h unistd.h \
159 8cfb9104 2012-09-24 alex ],,AC_MSG_ERROR([required C header missing!]))
161 8cfb9104 2012-09-24 alex # Optional header files
162 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS_ONCE([ \
163 fd260404 2013-01-24 alex arpa/inet.h inttypes.h malloc.h netinet/in_systm.h netinet/ip.h \
164 fd260404 2013-01-24 alex stdbool.h stddef.h stdint.h varargs.h \
167 8cfb9104 2012-09-24 alex # -- Datatypes --
169 8cfb9104 2012-09-24 alex AC_MSG_CHECKING(whether socklen_t exists)
170 bc098794 2014-01-02 alex AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
171 8cfb9104 2012-09-24 alex #include <sys/types.h>
172 8cfb9104 2012-09-24 alex #include <sys/socket.h>
174 8cfb9104 2012-09-24 alex socklen_t a, b;
175 8cfb9104 2012-09-24 alex a = 2; b = 4; a += b;
177 8cfb9104 2012-09-24 alex AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
179 8cfb9104 2012-09-24 alex AC_MSG_RESULT(no)
182 8cfb9104 2012-09-24 alex AC_TYPE_PID_T
183 8cfb9104 2012-09-24 alex AC_TYPE_SIZE_T
184 8cfb9104 2012-09-24 alex AC_TYPE_SSIZE_T
185 8cfb9104 2012-09-24 alex AC_TYPE_UID_T
186 8cfb9104 2012-09-24 alex AC_TYPE_UINT16_T
187 8cfb9104 2012-09-24 alex AC_TYPE_UINT32_T
188 8cfb9104 2012-09-24 alex AC_TYPE_UINT8_T
190 8cfb9104 2012-09-24 alex AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE(HAVE_sockaddr_in_len),,
191 8cfb9104 2012-09-24 alex [#include <arpa/inet.h>])
193 8cfb9104 2012-09-24 alex # -- Libraries --
195 8cfb9104 2012-09-24 alex # memmove: A/UX libUTIL
196 8cfb9104 2012-09-24 alex AC_SEARCH_LIBS([memmove], [UTIL], [], [
197 8cfb9104 2012-09-24 alex AC_MSG_ERROR([unable to find the memmove() function])
199 8cfb9104 2012-09-24 alex # gethostbyname: Solaris libnsl
200 cdaaae0c 2012-10-11 alex AC_SEARCH_LIBS([gethostbyname], [bind nsl network], [], [
201 8cfb9104 2012-09-24 alex AC_MSG_ERROR([unable to find the gethostbyname() function])
203 8cfb9104 2012-09-24 alex # bind: SVR4 libsocket
204 cdaaae0c 2012-10-11 alex AC_SEARCH_LIBS([bind], [socket network], [], [
205 8cfb9104 2012-09-24 alex AC_MSG_ERROR([unable to find the bind() function])
208 8cfb9104 2012-09-24 alex # -- Functions --
210 8cfb9104 2012-09-24 alex AC_FUNC_FORK
211 8cfb9104 2012-09-24 alex AC_FUNC_STRFTIME
213 8cfb9104 2012-09-24 alex # Required functions
214 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS([ \
215 8cfb9104 2012-09-24 alex alarm dup2 endpwent gethostbyaddr gethostbyname gethostname \
216 8cfb9104 2012-09-24 alex gettimeofday inet_ntoa memmove memset setsid socket strcasecmp \
217 8cfb9104 2012-09-24 alex strchr strcspn strerror strncasecmp strrchr strspn strstr \
219 8cfb9104 2012-09-24 alex AC_MSG_ERROR([required function missing!]))
221 8cfb9104 2012-09-24 alex # Optional functions
222 b8433e92 2013-12-27 alex AC_CHECK_FUNCS_ONCE([
223 b8433e92 2013-12-27 alex arc4random arc4random_stir gai_strerror getnameinfo inet_aton \
224 2fc61ce8 2015-06-06 alex setgroups sigaction sigprocmask snprintf strdup strlcat strlcpy \
225 2fc61ce8 2015-06-06 alex strndup strtok_r unsetenv vsnprintf waitpid])
227 b8433e92 2013-12-27 alex WORKING_GETADDRINFO
229 8cfb9104 2012-09-24 alex # -- Configuration options --
231 8cfb9104 2012-09-24 alex # use syslog?
233 8cfb9104 2012-09-24 alex x_syslog_on=no
234 8cfb9104 2012-09-24 alex AC_ARG_WITH(syslog,
235 8cfb9104 2012-09-24 alex AS_HELP_STRING([--without-syslog],
236 8cfb9104 2012-09-24 alex [disable syslog (autodetected by default)]),
237 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
238 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
239 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
240 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
241 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
243 8cfb9104 2012-09-24 alex AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes], [
244 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable syslog!])
248 8cfb9104 2012-09-24 alex [ AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes])
251 8cfb9104 2012-09-24 alex if test "$x_syslog_on" = "yes"; then
252 8cfb9104 2012-09-24 alex AC_DEFINE(SYSLOG, 1)
253 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
256 8cfb9104 2012-09-24 alex # use zlib compression?
258 8cfb9104 2012-09-24 alex x_zlib_on=no
259 8cfb9104 2012-09-24 alex AC_ARG_WITH(zlib,
260 8cfb9104 2012-09-24 alex AS_HELP_STRING([--without-zlib],
261 8cfb9104 2012-09-24 alex [disable zlib compression (autodetected by default)]),
262 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
263 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
264 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
265 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
266 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
268 8cfb9104 2012-09-24 alex AC_CHECK_LIB(z, deflate)
269 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
270 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable zlib!])
274 8cfb9104 2012-09-24 alex [ AC_CHECK_LIB(z, deflate)
275 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
278 8cfb9104 2012-09-24 alex if test "$x_zlib_on" = "yes"; then
279 8cfb9104 2012-09-24 alex AC_DEFINE(ZLIB, 1)
280 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
283 8cfb9104 2012-09-24 alex # detect which IO API to use:
285 8cfb9104 2012-09-24 alex x_io_backend=none
287 8cfb9104 2012-09-24 alex AC_ARG_WITH(select,
288 8cfb9104 2012-09-24 alex AS_HELP_STRING([--without-select],
289 8cfb9104 2012-09-24 alex [disable select IO support (autodetected by default)]),
290 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
291 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
292 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
293 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
294 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
296 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(select, x_io_select=yes,
297 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable select IO support!])
302 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(select, x_io_select=yes)
306 8cfb9104 2012-09-24 alex AC_ARG_WITH(poll,
307 8cfb9104 2012-09-24 alex AS_HELP_STRING([--without-poll],
308 8cfb9104 2012-09-24 alex [disable poll support (autodetected by default)]),
309 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
310 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
311 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
312 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
313 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
315 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(poll, [
316 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS(poll.h,
317 8cfb9104 2012-09-24 alex x_io_backend=poll\(\),
318 8cfb9104 2012-09-24 alex AC_MSG_ERROR(
319 8cfb9104 2012-09-24 alex [Can't enable poll IO support!])
322 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable poll IO support!])
327 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(poll, [
328 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\))
333 8cfb9104 2012-09-24 alex AC_ARG_WITH(devpoll,
334 8cfb9104 2012-09-24 alex AS_HELP_STRING([--without-devpoll],
335 8cfb9104 2012-09-24 alex [disable /dev/poll IO support (autodetected by default)]),
336 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
337 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
338 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
339 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
340 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
343 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
347 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
351 8cfb9104 2012-09-24 alex AC_ARG_WITH(epoll,
352 8cfb9104 2012-09-24 alex AS_HELP_STRING([--without-epoll],
353 8cfb9104 2012-09-24 alex [disable epoll IO support (autodetected by default)]),
354 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
355 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
356 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
357 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
358 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
360 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
361 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable epoll IO support!])
366 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
370 8cfb9104 2012-09-24 alex AC_ARG_WITH(kqueue,
371 8cfb9104 2012-09-24 alex AS_HELP_STRING([--without-kqueue],
372 8cfb9104 2012-09-24 alex [disable kqueue IO support (autodetected by default)]),
373 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
374 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
375 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
376 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
377 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
379 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
380 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable kqueue IO support!])
385 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
389 8cfb9104 2012-09-24 alex if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
390 8cfb9104 2012-09-24 alex # when epoll() and select() are available, we'll use both!
391 8cfb9104 2012-09-24 alex x_io_backend="epoll(), select()"
393 8cfb9104 2012-09-24 alex if test "$x_io_epoll" = "yes"; then
394 8cfb9104 2012-09-24 alex # we prefere epoll() if it is available
395 8cfb9104 2012-09-24 alex x_io_backend="epoll()"
397 8cfb9104 2012-09-24 alex if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
398 8cfb9104 2012-09-24 alex # we'll use select, when available and no "better"
399 8cfb9104 2012-09-24 alex # interface has been detected ...
400 8cfb9104 2012-09-24 alex x_io_backend="select()"
405 8cfb9104 2012-09-24 alex if test "$x_io_backend" = "none"; then
406 8cfb9104 2012-09-24 alex AC_MSG_ERROR([No useable IO API activated/found!?])
411 8cfb9104 2012-09-24 alex AC_ARG_WITH(openssl,
412 8cfb9104 2012-09-24 alex AS_HELP_STRING([--with-openssl],
413 8cfb9104 2012-09-24 alex [enable SSL support using OpenSSL]),
414 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
415 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
416 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
417 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
418 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
420 8cfb9104 2012-09-24 alex AC_CHECK_LIB(crypto, BIO_s_mem)
421 daa88b76 2016-12-05 alex AC_CHECK_LIB(ssl, SSL_new)
422 daa88b76 2016-12-05 alex AC_CHECK_FUNCS(SSL_new, x_ssl_openssl=yes,
423 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable openssl])
429 8cfb9104 2012-09-24 alex AC_ARG_WITH(gnutls,
430 8cfb9104 2012-09-24 alex AS_HELP_STRING([--with-gnutls],
431 8cfb9104 2012-09-24 alex [enable SSL support using gnutls]),
432 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
433 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
434 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
435 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
436 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
438 8cfb9104 2012-09-24 alex AC_CHECK_LIB(gnutls, gnutls_global_init)
439 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(gnutls_global_init, x_ssl_gnutls=yes,
440 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable gnutls])
446 8cfb9104 2012-09-24 alex x_ssl_lib="no"
447 8cfb9104 2012-09-24 alex if test "$x_ssl_gnutls" = "yes"; then
448 8cfb9104 2012-09-24 alex if test "$x_ssl_openssl" = "yes";then
449 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Cannot enable both gnutls and openssl])
451 8cfb9104 2012-09-24 alex x_ssl_lib=gnutls
453 8cfb9104 2012-09-24 alex if test "$x_ssl_openssl" = "yes"; then
454 8cfb9104 2012-09-24 alex x_ssl_lib=openssl
457 8cfb9104 2012-09-24 alex # use TCP wrappers?
459 8cfb9104 2012-09-24 alex x_tcpwrap_on=no
460 8cfb9104 2012-09-24 alex AC_ARG_WITH(tcp-wrappers,
461 8cfb9104 2012-09-24 alex AS_HELP_STRING([--with-tcp-wrappers],
462 8cfb9104 2012-09-24 alex [enable TCP wrappers support]),
463 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
464 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
465 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
466 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
467 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
469 8cfb9104 2012-09-24 alex AC_MSG_CHECKING(for hosts_access)
470 0f85c4c6 2014-01-17 alex saved_LIBS="$LIBS"
471 8cfb9104 2012-09-24 alex LIBS="-lwrap $LIBS"
472 0f85c4c6 2014-01-17 alex LIBS_END="-lwrap $LIBS_END"
473 bc098794 2014-01-02 alex AC_LINK_IFELSE([AC_LANG_PROGRAM([[
474 e747fe92 2014-01-17 alex #include <sys/types.h>
475 e747fe92 2014-01-17 alex #include <sys/socket.h>
476 8cfb9104 2012-09-24 alex #include <tcpd.h>
477 8cfb9104 2012-09-24 alex int allow_severity = 0;
478 8cfb9104 2012-09-24 alex int deny_severity = 0;
480 8cfb9104 2012-09-24 alex tcpd_warn("link test");
482 8cfb9104 2012-09-24 alex AC_MSG_RESULT(yes)
483 8cfb9104 2012-09-24 alex AC_DEFINE(TCPWRAP, 1)
484 8cfb9104 2012-09-24 alex x_tcpwrap_on=yes
486 8cfb9104 2012-09-24 alex AC_MSG_RESULT(no)
487 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable TCP wrappers!])
489 0f85c4c6 2014-01-17 alex LIBS="$saved_LIBS"
494 8cfb9104 2012-09-24 alex # do IDENT requests using libident?
496 8cfb9104 2012-09-24 alex x_identauth_on=no
497 8cfb9104 2012-09-24 alex AC_ARG_WITH(ident,
498 8cfb9104 2012-09-24 alex AS_HELP_STRING([--with-ident],
499 8cfb9104 2012-09-24 alex [enable "IDENT" ("AUTH") protocol support]),
500 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
501 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
502 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
503 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
504 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
506 8cfb9104 2012-09-24 alex AC_CHECK_LIB(ident, ident_id)
507 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
508 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable IDENT support!])
513 8cfb9104 2012-09-24 alex if test "$x_identauth_on" = "yes"; then
514 8cfb9104 2012-09-24 alex AC_DEFINE(IDENTAUTH, 1)
515 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
518 8cfb9104 2012-09-24 alex # compile in PAM support?
520 8cfb9104 2012-09-24 alex x_pam_on=no
521 8cfb9104 2012-09-24 alex AC_ARG_WITH(pam,
522 8cfb9104 2012-09-24 alex AS_HELP_STRING([--with-pam],
523 8cfb9104 2012-09-24 alex [enable user authentication using PAM]),
524 8cfb9104 2012-09-24 alex [ if test "$withval" != "no"; then
525 8cfb9104 2012-09-24 alex if test "$withval" != "yes"; then
526 8cfb9104 2012-09-24 alex CFLAGS="-I$withval/include $CFLAGS"
527 8cfb9104 2012-09-24 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
528 8cfb9104 2012-09-24 alex LDFLAGS="-L$withval/lib $LDFLAGS"
530 8cfb9104 2012-09-24 alex AC_CHECK_LIB(pam, pam_authenticate)
531 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes,
532 8cfb9104 2012-09-24 alex AC_MSG_ERROR([Can't enable PAM support!])
537 8cfb9104 2012-09-24 alex if test "$x_pam_on" = "yes"; then
538 8cfb9104 2012-09-24 alex AC_DEFINE(PAM, 1)
539 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes)
540 8cfb9104 2012-09-24 alex if test "$pam_ok" != "yes"; then
541 8cfb9104 2012-09-24 alex AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes,
542 8cfb9104 2012-09-24 alex AC_MSG_ERROR([required C header missing!]))
546 8cfb9104 2012-09-24 alex # compile in IRC+ protocol support?
548 8cfb9104 2012-09-24 alex x_ircplus_on=yes
549 8cfb9104 2012-09-24 alex AC_ARG_ENABLE(ircplus,
550 8cfb9104 2012-09-24 alex AS_HELP_STRING([--disable-ircplus],
551 8cfb9104 2012-09-24 alex [disable IRC+ protocol]),
552 8cfb9104 2012-09-24 alex if test "$enableval" = "no"; then x_ircplus_on=no; fi
554 8cfb9104 2012-09-24 alex if test "$x_ircplus_on" = "yes"; then
555 8cfb9104 2012-09-24 alex AC_DEFINE(IRCPLUS, 1)
557 46b0eef7 2012-10-06 alex # Compile in iconv support?
558 46b0eef7 2012-10-06 alex # We only check for it when IRC+ is enabled, because the IRC+ command
559 46b0eef7 2012-10-06 alex # CHARCONV is the only function depending on it.
560 46b0eef7 2012-10-06 alex x_iconv_on=no
561 46b0eef7 2012-10-06 alex AC_ARG_WITH(iconv,
562 b4966aa1 2013-01-06 alex AS_HELP_STRING([--with-iconv],
563 d5763937 2013-02-15 alex [enable character conversion using libiconv]),
564 46b0eef7 2012-10-06 alex [ if test "$withval" != "no"; then
565 46b0eef7 2012-10-06 alex if test "$withval" != "yes"; then
566 46b0eef7 2012-10-06 alex CFLAGS="-I$withval/include $CFLAGS"
567 46b0eef7 2012-10-06 alex CPPFLAGS="-I$withval/include $CPPFLAGS"
568 46b0eef7 2012-10-06 alex LDFLAGS="-L$withval/lib $LDFLAGS"
570 46b0eef7 2012-10-06 alex AC_CHECK_LIB(iconv, iconv_open)
571 a14eb495 2013-03-24 alex AC_CHECK_FUNCS(iconv_open, x_iconv_on=yes)
572 a14eb495 2013-03-24 alex if test "$x_iconv_on" != "yes"; then
573 2c969664 2013-02-15 alex AC_CHECK_LIB(iconv, libiconv_open)
574 a14eb495 2013-03-24 alex AC_CHECK_FUNCS(libiconv_open, x_iconv_on=yes)
576 a14eb495 2013-03-24 alex if test "$x_iconv_on" != "yes"; then
577 a14eb495 2013-03-24 alex AC_MSG_ERROR([Can't enable libiconv support!])
581 46b0eef7 2012-10-06 alex if test "$x_iconv_on" = "yes"; then
582 46b0eef7 2012-10-06 alex AC_DEFINE(ICONV, 1)
586 8cfb9104 2012-09-24 alex # enable support for IPv6?
587 8cfb9104 2012-09-24 alex x_ipv6_on=no
588 8cfb9104 2012-09-24 alex AC_ARG_ENABLE(ipv6,
589 8cfb9104 2012-09-24 alex AS_HELP_STRING([--enable-ipv6],
590 8cfb9104 2012-09-24 alex [enable IPv6 protocol support]),
591 8cfb9104 2012-09-24 alex if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
593 8cfb9104 2012-09-24 alex if test "$x_ipv6_on" = "yes"; then
594 8cfb9104 2012-09-24 alex # getaddrinfo() and getnameinfo() are optional when not compiling
595 8cfb9104 2012-09-24 alex # with IPv6 support, but are required for IPv6 to work!
596 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS([ \
597 8cfb9104 2012-09-24 alex getaddrinfo getnameinfo \
598 8cfb9104 2012-09-24 alex ],,AC_MSG_ERROR([required function missing for IPv6 support!]))
599 8cfb9104 2012-09-24 alex AC_DEFINE(WANT_IPV6, 1)
602 8cfb9104 2012-09-24 alex # compile in IRC "sniffer"?
604 8cfb9104 2012-09-24 alex x_sniffer_on=no; x_debug_on=no
605 8cfb9104 2012-09-24 alex AC_ARG_ENABLE(sniffer,
606 8cfb9104 2012-09-24 alex AS_HELP_STRING([--enable-sniffer],
607 8cfb9104 2012-09-24 alex [enable IRC traffic sniffer (enables debug mode)]),
608 8cfb9104 2012-09-24 alex if test "$enableval" = "yes"; then
609 8cfb9104 2012-09-24 alex AC_DEFINE(SNIFFER, 1)
610 8cfb9104 2012-09-24 alex x_sniffer_on=yes; x_debug_on=yes
614 8cfb9104 2012-09-24 alex # enable additional debugging code?
616 8cfb9104 2012-09-24 alex AC_ARG_ENABLE(debug,
617 8cfb9104 2012-09-24 alex AS_HELP_STRING([--enable-debug],
618 8cfb9104 2012-09-24 alex [show additional debug output]),
619 8cfb9104 2012-09-24 alex if test "$enableval" = "yes"; then x_debug_on=yes; fi
621 8cfb9104 2012-09-24 alex if test "$x_debug_on" = "yes"; then
622 8cfb9104 2012-09-24 alex AC_DEFINE(DEBUG, 1)
623 8cfb9104 2012-09-24 alex test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
624 8cfb9104 2012-09-24 alex AC_CHECK_FUNCS(mtrace)
627 8cfb9104 2012-09-24 alex # enable "strict RFC rules"?
629 8cfb9104 2012-09-24 alex x_strict_rfc_on=no
630 8cfb9104 2012-09-24 alex AC_ARG_ENABLE(strict-rfc,
631 8cfb9104 2012-09-24 alex AS_HELP_STRING([--enable-strict-rfc],
632 8cfb9104 2012-09-24 alex [strict RFC conformance -- may break clients!]),
633 8cfb9104 2012-09-24 alex if test "$enableval" = "yes"; then
634 8cfb9104 2012-09-24 alex AC_DEFINE(STRICT_RFC, 1)
635 8cfb9104 2012-09-24 alex x_strict_rfc_on=yes
639 8cfb9104 2012-09-24 alex # -- Definitions --
641 8cfb9104 2012-09-24 alex AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
642 8cfb9104 2012-09-24 alex AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
643 8cfb9104 2012-09-24 alex AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
645 0f85c4c6 2014-01-17 alex # Add additional CFLAGS, LDFLAGS and LIBS which were specified on the command
646 0f85c4c6 2014-01-17 alex # line or by some tests from above, but after running this script. Useful for
647 0f85c4c6 2014-01-17 alex # adding "-Werror", for example:
648 8cfb9104 2012-09-24 alex test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
649 0f85c4c6 2014-01-17 alex test -n "$LDFLAGS_END" && LDFLAGS="$LDFLAGS $LDFLAGS_END"
650 0f85c4c6 2014-01-17 alex test -n "$LIBS_END" && LIBS="$LIBS $LIBS_END"
652 8cfb9104 2012-09-24 alex # -- Generate files --
654 8cfb9104 2012-09-24 alex AC_CONFIG_FILES([ \
656 8cfb9104 2012-09-24 alex contrib/Debian/Makefile \
657 8cfb9104 2012-09-24 alex contrib/MacOSX/Makefile \
658 8cfb9104 2012-09-24 alex contrib/MacOSX/ngIRCd.pmdoc/Makefile \
659 8cfb9104 2012-09-24 alex contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
660 8cfb9104 2012-09-24 alex contrib/Makefile \
661 8cfb9104 2012-09-24 alex doc/Makefile \
662 8cfb9104 2012-09-24 alex doc/src/Makefile \
663 8cfb9104 2012-09-24 alex man/Makefile \
664 8cfb9104 2012-09-24 alex src/ipaddr/Makefile \
665 8cfb9104 2012-09-24 alex src/Makefile \
666 8cfb9104 2012-09-24 alex src/ngircd/Makefile \
667 8cfb9104 2012-09-24 alex src/portab/Makefile \
668 8cfb9104 2012-09-24 alex src/testsuite/Makefile \
669 8cfb9104 2012-09-24 alex src/tool/Makefile \
674 8cfb9104 2012-09-24 alex type dpkg >/dev/null 2>&1
675 8cfb9104 2012-09-24 alex if test $? -eq 0; then
676 8cfb9104 2012-09-24 alex # Generate debian/ link if the dpkg command exists
677 8cfb9104 2012-09-24 alex # (read: if we are running on a debian compatible system)
678 8cfb9104 2012-09-24 alex echo "creating Debian-specific links ..."
679 14a84dfc 2014-01-26 alex if test ! -f debian/rules -a -f contrib/Debian/rules; then
680 14a84dfc 2014-01-26 alex ln -s contrib/Debian debian
684 8cfb9104 2012-09-24 alex # -- Result --
687 8cfb9104 2012-09-24 alex echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
690 8cfb9104 2012-09-24 alex # Someone please show me a better way :) [borrowed by OpenSSH]
691 8cfb9104 2012-09-24 alex B=`eval echo ${bindir}` ; B=`eval echo ${B}`
692 8cfb9104 2012-09-24 alex S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
693 8cfb9104 2012-09-24 alex C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
694 8cfb9104 2012-09-24 alex M=`eval echo ${mandir}` ; M=`eval echo ${M}`
695 8cfb9104 2012-09-24 alex D=`eval echo ${docdir}` ; D=`eval echo ${D}`
697 8cfb9104 2012-09-24 alex echo " Host: ${host}"
698 8cfb9104 2012-09-24 alex echo " Compiler: ${CC}"
699 8cfb9104 2012-09-24 alex test -n "$CFLAGS" && echo " Compiler flags: ${CFLAGS}"
700 8cfb9104 2012-09-24 alex test -n "$CPPFLAGS" && echo " Preprocessor flags: ${CPPFLAGS}"
701 8cfb9104 2012-09-24 alex test -n "$LDFLAGS" && echo " Linker flags: ${LDFLAGS}"
702 8cfb9104 2012-09-24 alex test -n "$LIBS" && echo " Libraries: ${LIBS}"
704 8cfb9104 2012-09-24 alex echo " 'ngircd' binary: $S"
705 8cfb9104 2012-09-24 alex echo " Configuration file: $C"
706 8cfb9104 2012-09-24 alex echo " Manual pages: $M"
707 8cfb9104 2012-09-24 alex echo " Documentation: $D"
710 8cfb9104 2012-09-24 alex echo $ECHO_N " Syslog support: $ECHO_C"
711 8cfb9104 2012-09-24 alex test "$x_syslog_on" = "yes" \
712 8cfb9104 2012-09-24 alex && echo $ECHO_N "yes $ECHO_C" \
713 8cfb9104 2012-09-24 alex || echo $ECHO_N "no $ECHO_C"
714 8cfb9104 2012-09-24 alex echo $ECHO_N " Enable debug code: $ECHO_C"
715 8cfb9104 2012-09-24 alex test "$x_debug_on" = "yes" \
716 8cfb9104 2012-09-24 alex && echo "yes" \
717 8cfb9104 2012-09-24 alex || echo "no"
719 8cfb9104 2012-09-24 alex echo $ECHO_N " zlib compression: $ECHO_C"
720 8cfb9104 2012-09-24 alex test "$x_zlib_on" = "yes" \
721 8cfb9104 2012-09-24 alex && echo $ECHO_N "yes $ECHO_C" \
722 8cfb9104 2012-09-24 alex || echo $ECHO_N "no $ECHO_C"
723 8cfb9104 2012-09-24 alex echo $ECHO_N " IRC sniffer: $ECHO_C"
724 8cfb9104 2012-09-24 alex test "$x_sniffer_on" = "yes" \
725 8cfb9104 2012-09-24 alex && echo "yes" \
726 8cfb9104 2012-09-24 alex || echo "no"
728 8cfb9104 2012-09-24 alex echo $ECHO_N " Use TCP Wrappers: $ECHO_C"
729 8cfb9104 2012-09-24 alex test "$x_tcpwrap_on" = "yes" \
730 8cfb9104 2012-09-24 alex && echo $ECHO_N "yes $ECHO_C" \
731 8cfb9104 2012-09-24 alex || echo $ECHO_N "no $ECHO_C"
732 8cfb9104 2012-09-24 alex echo $ECHO_N " Strict RFC mode: $ECHO_C"
733 8cfb9104 2012-09-24 alex test "$x_strict_rfc_on" = "yes" \
734 8cfb9104 2012-09-24 alex && echo "yes" \
735 8cfb9104 2012-09-24 alex || echo "no"
737 8cfb9104 2012-09-24 alex echo $ECHO_N " IDENT support: $ECHO_C"
738 8cfb9104 2012-09-24 alex test "$x_identauth_on" = "yes" \
739 8cfb9104 2012-09-24 alex && echo $ECHO_N "yes $ECHO_C" \
740 8cfb9104 2012-09-24 alex || echo $ECHO_N "no $ECHO_C"
741 8cfb9104 2012-09-24 alex echo $ECHO_N " IRC+ protocol: $ECHO_C"
742 8cfb9104 2012-09-24 alex test "$x_ircplus_on" = "yes" \
743 8cfb9104 2012-09-24 alex && echo "yes" \
744 8cfb9104 2012-09-24 alex || echo "no"
746 8cfb9104 2012-09-24 alex echo $ECHO_N " IPv6 protocol: $ECHO_C"
747 8cfb9104 2012-09-24 alex test "$x_ipv6_on" = "yes" \
748 8cfb9104 2012-09-24 alex && echo $ECHO_N "yes $ECHO_C" \
749 8cfb9104 2012-09-24 alex || echo $ECHO_N "no $ECHO_C"
750 8cfb9104 2012-09-24 alex echo $ECHO_N " I/O backend: $ECHO_C"
751 aeebde46 2013-08-11 alex echo "$x_io_backend"
753 8cfb9104 2012-09-24 alex echo $ECHO_N " PAM support: $ECHO_C"
754 8cfb9104 2012-09-24 alex test "$x_pam_on" = "yes" \
755 8cfb9104 2012-09-24 alex && echo $ECHO_N "yes $ECHO_C" \
756 8cfb9104 2012-09-24 alex || echo $ECHO_N "no $ECHO_C"
757 8cfb9104 2012-09-24 alex echo $ECHO_N " SSL support: $ECHO_C"
758 8cfb9104 2012-09-24 alex echo "$x_ssl_lib"
760 46b0eef7 2012-10-06 alex echo $ECHO_N " libiconv support: $ECHO_C"
761 46b0eef7 2012-10-06 alex echo "$x_iconv_on"
765 0703fcd7 2013-01-05 alex define(_automake_regex_,[[^AUTOMAKE_OPTIONS = [a-z .\-]*/portab/ansi2knr]])
766 0703fcd7 2013-01-05 alex if ! grep "_automake_regex_" src/ngircd/Makefile.am >/dev/null 2>&1; then
767 8cfb9104 2012-09-24 alex echo "WARNING:"
768 8cfb9104 2012-09-24 alex echo "This GNU automake generated build system does not support \"de-ANSI-fication\","
769 8cfb9104 2012-09-24 alex echo "therefore don't use it to generate \"official\" distribution archives!"
770 8cfb9104 2012-09-24 alex echo "(Most probably you want to use GNU automake 1.11.x for this purpose ...)"