]> arthur.barton.de Git - ngircd.git/blob - configure.ng
Fix configure script and "make check" for TCP Wrappers
[ngircd.git] / configure.ng
1 #
2 # ngIRCd -- The Next Generation IRC Daemon
3 # Copyright (c)2001-2013 Alexander Barton (alex@barton.de) and Contributors
4 #
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.
10 #
11
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';
17 ]))
18
19 m4_ifdef([AM_SILENT_RULES],
20         [m4_define([ng_color_tests], [color-tests])],
21         [m4_define([ng_color_tests], [])])
22
23 # -- Initialisation --
24
25 AC_PREREQ([2.61])
26 AC_INIT([ngIRCd], VERSION_ID,
27         [ngircd-ml@ngircd.barton.de], [ngircd], [http://ngircd.barton.de/])
28
29 AC_CONFIG_SRCDIR([src/ngircd/ngircd.c])
30 AC_CONFIG_HEADER([src/config.h])
31 AC_CANONICAL_HOST
32
33 AM_INIT_AUTOMAKE([-Wall 1.10 ]ng_color_tests)
34
35 m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
36
37 # -- Templates for config.h --
38
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([ICONV], [Define if libiconv can be used, e.g. for CHARCONV])
43 AH_TEMPLATE([IDENTAUTH], [Define if the server should do IDENT requests])
44 AH_TEMPLATE([IRCPLUS], [Define if IRC+ protocol should be used])
45 AH_TEMPLATE([PAM], [Define if PAM should be used])
46 AH_TEMPLATE([SNIFFER], [Define if IRC sniffer should be enabled])
47 AH_TEMPLATE([STRICT_RFC], [Define if ngIRCd should behave strict RFC compliant])
48 AH_TEMPLATE([SYSLOG], [Define if syslog should be used for logging])
49 AH_TEMPLATE([TCPWRAP], [Define if TCP wrappers should be used])
50 AH_TEMPLATE([WANT_IPV6], [Define if IPV6 protocol should be enabled])
51 AH_TEMPLATE([ZLIB], [Define if zlib compression should be enabled])
52
53 AH_TEMPLATE([HOST_OS], [Target operating system name])
54 AH_TEMPLATE([HOST_VENDOR], [Target system vendor])
55 AH_TEMPLATE([HOST_CPU], [Target CPU name])
56
57 # -- C Compiler --
58
59 AC_PROG_CC
60 AC_PROG_CC_STDC
61
62 # -- Helper programs --
63
64 m4_ifdef([AM_PROG_AR], [AM_PROG_AR])
65
66 AC_PROG_AWK
67 AC_PROG_INSTALL
68 AC_PROG_LN_S
69 AC_PROG_MAKE_SET
70 AC_PROG_RANLIB
71
72 # -- Compiler Features --
73
74 AC_C_CONST
75 AC_C_INLINE
76 __ng_PROTOTYPES__
77
78 # -- Hard coded system and compiler dependencies/features/options ... --
79
80 AC_DEFUN([GCC_STACK_PROTECT_CC],[
81   ssp_cc=yes
82   # we use -fstack-protector-all for the test to enfoce the use of the guard variable 
83   AC_MSG_CHECKING([whether ${CC} accepts -fstack-protector])
84   ssp_old_cflags="$CFLAGS"
85   CFLAGS="$CFLAGS -fstack-protector-all"
86   AC_TRY_LINK(,,, ssp_cc=no)
87   echo $ssp_cc
88   CFLAGS="$ssp_old_cflags"
89   if test "X$ssp_cc" = "Xyes"; then
90       CFLAGS="$CFLAGS -fstack-protector"
91       AC_DEFINE([ENABLE_SSP_CC], 1, [Define if SSP C support is enabled.])
92   fi
93 ])
94
95 AC_DEFUN([WORKING_GETADDRINFO],[
96         AC_CHECK_FUNCS([getaddrinfo],[
97                 AC_MSG_CHECKING([whether getaddrinfo() works])
98                 AC_TRY_RUN([
99 #include <stdio.h>
100 #include <sys/types.h>
101 #include <sys/socket.h>
102 #include <netdb.h>
103 int
104 main(int argc, char **argv)
105 {
106         struct addrinfo hints, *ai;
107         memset(&hints, 0, sizeof(hints));
108         hints.ai_flags = AI_PASSIVE;
109         hints.ai_socktype = SOCK_STREAM;
110         hints.ai_family = PF_UNSPEC;
111         if(getaddrinfo(NULL, "0", &hints, &ai) != 0)
112                 return 1;
113         return 0;
114 }
115                 ],[
116                 AC_DEFINE([HAVE_WORKING_GETADDRINFO], 1, [getaddrinfo(0)])
117                 AC_MSG_RESULT(yes)
118                 ],[
119                 AC_MSG_RESULT(no)
120                 ])
121         ])
122 ])
123
124 if test "$GCC" = "yes"; then
125         # We are using the GNU C compiler. Good!
126         CFLAGS="$CFLAGS -pipe -W -Wall -Wpointer-arith -Wstrict-prototypes"
127
128         GCC_STACK_PROTECT_CC
129 fi
130
131 case "$host_os" in
132         hpux*)
133                 # This is HP/UX, we need to define _XOPEN_SOURCE_EXTENDED
134                 # (tested with HP/UX 11.11)
135                 CFLAGS="$CFLAGS -D_XOPEN_SOURCE_EXTENDED"
136                 ;;
137 esac
138
139 # Add additional CFLAGS, eventually specified on the command line:
140 test -n "$CFLAGS_ADD" && CFLAGS="$CFLAGS $CFLAGS_ADD"
141
142 CFLAGS="$CFLAGS -DSYSCONFDIR='\"\$(sysconfdir)\"' -DDOCDIR='\"\$(docdir)\"'"
143
144 # -- Headers --
145
146 AC_HEADER_STDC
147 AC_HEADER_SYS_WAIT
148 AC_HEADER_TIME
149
150 # Required header files
151 AC_CHECK_HEADERS([ \
152         fcntl.h netdb.h netinet/in.h stdlib.h string.h \
153         strings.h sys/socket.h sys/time.h unistd.h \
154         ],,AC_MSG_ERROR([required C header missing!]))
155
156 # Optional header files
157 AC_CHECK_HEADERS_ONCE([ \
158         arpa/inet.h inttypes.h malloc.h netinet/in_systm.h netinet/ip.h \
159         stdbool.h stddef.h stdint.h varargs.h \
160         ])
161
162 # -- Datatypes --
163
164 AC_MSG_CHECKING(whether socklen_t exists)
165 AC_TRY_COMPILE([
166 #include <sys/types.h>
167 #include <sys/socket.h>
168         ],[
169         socklen_t a, b;
170         a = 2; b = 4; a += b;
171         ],[
172         AC_DEFINE(HAVE_socklen_t) AC_MSG_RESULT(yes)
173         ],[
174         AC_MSG_RESULT(no)
175 ])
176
177 AC_TYPE_PID_T
178 AC_TYPE_SIGNAL
179 AC_TYPE_SIZE_T
180 AC_TYPE_SSIZE_T
181 AC_TYPE_UID_T
182 AC_TYPE_UINT16_T
183 AC_TYPE_UINT32_T
184 AC_TYPE_UINT8_T
185
186 AC_CHECK_MEMBER([struct sockaddr_in.sin_len], AC_DEFINE(HAVE_sockaddr_in_len),,
187  [#include <arpa/inet.h>])
188
189 # -- Libraries --
190
191 # memmove: A/UX libUTIL
192 AC_SEARCH_LIBS([memmove], [UTIL], [], [
193         AC_MSG_ERROR([unable to find the memmove() function])
194 ])
195 # gethostbyname: Solaris libnsl
196 AC_SEARCH_LIBS([gethostbyname], [bind nsl network], [], [
197         AC_MSG_ERROR([unable to find the gethostbyname() function])
198 ])
199 # bind: SVR4 libsocket
200 AC_SEARCH_LIBS([bind], [socket network], [], [
201         AC_MSG_ERROR([unable to find the bind() function])
202 ])
203
204 # -- Functions --
205
206 AC_FUNC_FORK
207 AC_FUNC_STRFTIME
208
209 # Required functions
210 AC_CHECK_FUNCS([ \
211         alarm dup2 endpwent gethostbyaddr gethostbyname gethostname \
212         gettimeofday inet_ntoa memmove memset setsid socket strcasecmp \
213         strchr strcspn strerror strncasecmp strrchr strspn strstr \
214         ],,
215         AC_MSG_ERROR([required function missing!]))
216
217 # Optional functions
218 AC_CHECK_FUNCS_ONCE([
219         arc4random arc4random_stir gai_strerror getnameinfo inet_aton \
220         sigaction sigprocmask snprintf vsnprintf strdup strndup strlcpy strlcat \
221         strtok_r unsetenv waitpid])
222
223 WORKING_GETADDRINFO
224
225 # -- Configuration options --
226
227 # use syslog?
228
229 x_syslog_on=no
230 AC_ARG_WITH(syslog,
231         AS_HELP_STRING([--without-syslog],
232                        [disable syslog (autodetected by default)]),
233         [       if test "$withval" != "no"; then
234                         if test "$withval" != "yes"; then
235                                 CFLAGS="-I$withval/include $CFLAGS"
236                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
237                                 LDFLAGS="-L$withval/lib $LDFLAGS"
238                         fi
239                         AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes], [
240                                 AC_MSG_ERROR([Can't enable syslog!])
241                         ])
242                 fi
243         ],
244         [       AC_SEARCH_LIBS([syslog], [be], [x_syslog_on=yes])
245         ]
246 )
247 if test "$x_syslog_on" = "yes"; then
248         AC_DEFINE(SYSLOG, 1)
249         AC_CHECK_HEADERS(syslog.h,,AC_MSG_ERROR([required C header missing!]))
250 fi
251
252 # use zlib compression?
253
254 x_zlib_on=no
255 AC_ARG_WITH(zlib,
256         AS_HELP_STRING([--without-zlib],
257                        [disable zlib compression (autodetected by default)]),
258         [       if test "$withval" != "no"; then
259                         if test "$withval" != "yes"; then
260                                 CFLAGS="-I$withval/include $CFLAGS"
261                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
262                                 LDFLAGS="-L$withval/lib $LDFLAGS"
263                         fi
264                         AC_CHECK_LIB(z, deflate)
265                         AC_CHECK_FUNCS(deflate, x_zlib_on=yes,
266                                 AC_MSG_ERROR([Can't enable zlib!])
267                         )
268                 fi
269         ],
270         [       AC_CHECK_LIB(z, deflate)
271                 AC_CHECK_FUNCS(deflate, x_zlib_on=yes)
272         ]
273 )
274 if test "$x_zlib_on" = "yes"; then
275         AC_DEFINE(ZLIB, 1)
276         AC_CHECK_HEADERS(zlib.h,,AC_MSG_ERROR([required C header missing!]))
277 fi
278
279 # detect which IO API to use:
280
281 x_io_backend=none
282
283 AC_ARG_WITH(select,
284         AS_HELP_STRING([--without-select],
285                        [disable select IO support (autodetected by default)]),
286         [       if test "$withval" != "no"; then
287                         if test "$withval" != "yes"; then
288                                 CFLAGS="-I$withval/include $CFLAGS"
289                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
290                                 LDFLAGS="-L$withval/lib $LDFLAGS"
291                         fi
292                         AC_CHECK_FUNCS(select, x_io_select=yes,
293                                 AC_MSG_ERROR([Can't enable select IO support!])
294                         )
295                 fi
296         ],
297         [
298                 AC_CHECK_FUNCS(select, x_io_select=yes)
299         ]
300 )
301
302 AC_ARG_WITH(poll,
303         AS_HELP_STRING([--without-poll],
304                        [disable poll support (autodetected by default)]),
305         [       if test "$withval" != "no"; then
306                         if test "$withval" != "yes"; then
307                                 CFLAGS="-I$withval/include $CFLAGS"
308                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
309                                 LDFLAGS="-L$withval/lib $LDFLAGS"
310                         fi
311                         AC_CHECK_FUNCS(poll, [
312                                 AC_CHECK_HEADERS(poll.h,
313                                         x_io_backend=poll\(\),
314                                         AC_MSG_ERROR(
315                                              [Can't enable poll IO support!])
316                                 )
317                         ], [
318                                 AC_MSG_ERROR([Can't enable poll IO support!])
319                         ])
320                 fi
321         ],
322         [
323                 AC_CHECK_FUNCS(poll, [
324                         AC_CHECK_HEADERS(poll.h, x_io_backend=poll\(\))
325                 ])
326         ]
327 )
328
329 AC_ARG_WITH(devpoll,
330         AS_HELP_STRING([--without-devpoll],
331                        [disable /dev/poll IO support (autodetected by default)]),
332         [       if test "$withval" != "no"; then
333                         if test "$withval" != "yes"; then
334                                 CFLAGS="-I$withval/include $CFLAGS"
335                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
336                                 LDFLAGS="-L$withval/lib $LDFLAGS"
337                         fi
338
339                                 AC_CHECK_HEADERS(sys/devpoll.h,,AC_MSG_ERROR([required C header missing!]))
340                 fi
341         ],
342         [
343                 AC_CHECK_HEADERS(sys/devpoll.h, x_io_backend=/dev/poll)
344         ]
345 )
346
347 AC_ARG_WITH(epoll,
348         AS_HELP_STRING([--without-epoll],
349                        [disable epoll IO support (autodetected by default)]),
350         [       if test "$withval" != "no"; then
351                         if test "$withval" != "yes"; then
352                                 CFLAGS="-I$withval/include $CFLAGS"
353                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
354                                 LDFLAGS="-L$withval/lib $LDFLAGS"
355                         fi
356                         AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes,
357                                 AC_MSG_ERROR([Can't enable epoll IO support!])
358                         )
359                 fi
360         ],
361         [
362                 AC_CHECK_FUNCS(epoll_create, x_io_epoll=yes)
363         ]
364 )
365
366 AC_ARG_WITH(kqueue,
367         AS_HELP_STRING([--without-kqueue],
368                        [disable kqueue IO support (autodetected by default)]),
369         [       if test "$withval" != "no"; then
370                         if test "$withval" != "yes"; then
371                                 CFLAGS="-I$withval/include $CFLAGS"
372                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
373                                 LDFLAGS="-L$withval/lib $LDFLAGS"
374                         fi
375                         AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\),
376                                 AC_MSG_ERROR([Can't enable kqueue IO support!])
377                         )
378                 fi
379         ],
380         [
381                 AC_CHECK_FUNCS(kqueue, x_io_backend=kqueue\(\))
382         ]
383 )
384
385 if test "$x_io_epoll" = "yes" -a "$x_io_select" = "yes"; then
386         # when epoll() and select() are available, we'll use both!
387         x_io_backend="epoll(), select()"
388 else
389         if test "$x_io_epoll" = "yes"; then
390                 # we prefere epoll() if it is available
391                 x_io_backend="epoll()"
392         else
393                 if test "$x_io_select" = "yes" -a "$x_io_backend" = "none"; then
394                         # we'll use select, when available and no "better"
395                         # interface has been detected ...
396                         x_io_backend="select()"
397                 fi
398         fi
399 fi
400
401 if test "$x_io_backend" = "none"; then
402         AC_MSG_ERROR([No useable IO API activated/found!?])
403 fi
404
405 # use SSL?
406
407 AC_ARG_WITH(openssl,
408         AS_HELP_STRING([--with-openssl],
409                        [enable SSL support using OpenSSL]),
410         [       if test "$withval" != "no"; then
411                         if test "$withval" != "yes"; then
412                                 CFLAGS="-I$withval/include $CFLAGS"
413                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
414                                 LDFLAGS="-L$withval/lib $LDFLAGS"
415                         fi
416                         AC_CHECK_LIB(crypto, BIO_s_mem)
417                         AC_CHECK_LIB(ssl, SSL_library_init)
418                         AC_CHECK_FUNCS(SSL_library_init, x_ssl_openssl=yes,
419                                 AC_MSG_ERROR([Can't enable openssl])
420                         )
421                 fi
422         ]
423 )
424
425 AC_ARG_WITH(gnutls,
426         AS_HELP_STRING([--with-gnutls],
427                        [enable SSL support using gnutls]),
428         [       if test "$withval" != "no"; then
429                         if test "$withval" != "yes"; then
430                                 CFLAGS="-I$withval/include $CFLAGS"
431                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
432                                 LDFLAGS="-L$withval/lib $LDFLAGS"
433                         fi
434                         AC_CHECK_LIB(gnutls, gnutls_global_init)
435                         AC_CHECK_FUNCS(gnutls_global_init, x_ssl_gnutls=yes,
436                                 AC_MSG_ERROR([Can't enable gnutls])
437                         )
438                 fi
439         ]
440 )
441
442 x_ssl_lib="no"
443 if test "$x_ssl_gnutls" = "yes"; then
444         if test "$x_ssl_openssl" = "yes";then
445                 AC_MSG_ERROR([Cannot enable both gnutls and openssl])
446         fi
447         x_ssl_lib=gnutls
448 fi
449 if test "$x_ssl_openssl" = "yes"; then
450         x_ssl_lib=openssl
451 fi
452
453 # use TCP wrappers?
454
455 x_tcpwrap_on=no
456 AC_ARG_WITH(tcp-wrappers,
457         AS_HELP_STRING([--with-tcp-wrappers],
458                        [enable TCP wrappers support]),
459         [       if test "$withval" != "no"; then
460                         if test "$withval" != "yes"; then
461                                 CFLAGS="-I$withval/include $CFLAGS"
462                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
463                                 LDFLAGS="-L$withval/lib $LDFLAGS"
464                         fi
465                         AC_MSG_CHECKING(for hosts_access)
466                         saved_LIBS="$LIBS"
467                         LIBS="-lwrap $LIBS"
468                         LIBS_END="-lwrap $LIBS_END"
469                         AC_TRY_LINK([
470 #include <sys/types.h>
471 #include <sys/socket.h>
472 #include <tcpd.h>
473 int allow_severity = 0;
474 int deny_severity = 0;
475                                 ],[
476                                 tcpd_warn("link test");
477                                 ],[
478                                 AC_MSG_RESULT(yes)
479                                 AC_DEFINE(TCPWRAP, 1)
480                                 x_tcpwrap_on=yes
481                                 ],[
482                                 AC_MSG_RESULT(no)
483                                 AC_MSG_ERROR([Can't enable TCP wrappers!])
484                         ])
485                         LIBS="$saved_LIBS"
486                 fi
487         ]
488 )
489
490 # do IDENT requests using libident?
491
492 x_identauth_on=no
493 AC_ARG_WITH(ident,
494         AS_HELP_STRING([--with-ident],
495                        [enable "IDENT" ("AUTH") protocol support]),
496         [       if test "$withval" != "no"; then
497                         if test "$withval" != "yes"; then
498                                 CFLAGS="-I$withval/include $CFLAGS"
499                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
500                                 LDFLAGS="-L$withval/lib $LDFLAGS"
501                         fi
502                         AC_CHECK_LIB(ident, ident_id)
503                         AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
504                                 AC_MSG_ERROR([Can't enable IDENT support!])
505                         )
506                 fi
507         ]
508 )
509 if test "$x_identauth_on" = "yes"; then
510         AC_DEFINE(IDENTAUTH, 1)
511         AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
512 fi
513
514 # compile in PAM support?
515
516 x_pam_on=no
517 AC_ARG_WITH(pam,
518         AS_HELP_STRING([--with-pam],
519                        [enable user authentication using PAM]),
520         [       if test "$withval" != "no"; then
521                         if test "$withval" != "yes"; then
522                                 CFLAGS="-I$withval/include $CFLAGS"
523                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
524                                 LDFLAGS="-L$withval/lib $LDFLAGS"
525                         fi
526                         AC_CHECK_LIB(pam, pam_authenticate)
527                         AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes,
528                                 AC_MSG_ERROR([Can't enable PAM support!])
529                         )
530                 fi
531         ]
532 )
533 if test "$x_pam_on" = "yes"; then
534         AC_DEFINE(PAM, 1)
535         AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes)
536         if test "$pam_ok" != "yes"; then
537                 AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes,
538                         AC_MSG_ERROR([required C header missing!]))
539         fi
540 fi
541
542 # compile in IRC+ protocol support?
543
544 x_ircplus_on=yes
545 AC_ARG_ENABLE(ircplus,
546         AS_HELP_STRING([--disable-ircplus],
547                        [disable IRC+ protocol]),
548         if test "$enableval" = "no"; then x_ircplus_on=no; fi
549 )
550 if test "$x_ircplus_on" = "yes"; then
551         AC_DEFINE(IRCPLUS, 1)
552
553         # Compile in iconv support?
554         # We only check for it when IRC+ is enabled, because the IRC+ command
555         # CHARCONV is the only function depending on it.
556         x_iconv_on=no
557         AC_ARG_WITH(iconv,
558                 AS_HELP_STRING([--with-iconv],
559                                [enable character conversion using libiconv]),
560                 [ if test "$withval" != "no"; then
561                         if test "$withval" != "yes"; then
562                                 CFLAGS="-I$withval/include $CFLAGS"
563                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
564                                 LDFLAGS="-L$withval/lib $LDFLAGS"
565                         fi
566                         AC_CHECK_LIB(iconv, iconv_open)
567                         AC_CHECK_FUNCS(iconv_open, x_iconv_on=yes)
568                         if test "$x_iconv_on" != "yes"; then
569                                 AC_CHECK_LIB(iconv, libiconv_open)
570                                 AC_CHECK_FUNCS(libiconv_open, x_iconv_on=yes)
571                         fi
572                         if test "$x_iconv_on" != "yes"; then
573                                 AC_MSG_ERROR([Can't enable libiconv support!])
574                         fi
575                 fi ]
576         )
577         if test "$x_iconv_on" = "yes"; then
578                 AC_DEFINE(ICONV, 1)
579         fi
580 fi
581
582 # enable support for IPv6?
583 x_ipv6_on=no
584 AC_ARG_ENABLE(ipv6,
585         AS_HELP_STRING([--enable-ipv6],
586                        [enable IPv6 protocol support]),
587         if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
588 )
589 if test "$x_ipv6_on" = "yes"; then
590         # getaddrinfo() and getnameinfo() are optional when not compiling
591         # with IPv6 support, but are required for IPv6 to work!
592         AC_CHECK_FUNCS([ \
593                 getaddrinfo getnameinfo \
594                 ],,AC_MSG_ERROR([required function missing for IPv6 support!]))
595         AC_DEFINE(WANT_IPV6, 1)
596 fi
597
598 # compile in IRC "sniffer"?
599
600 x_sniffer_on=no; x_debug_on=no
601 AC_ARG_ENABLE(sniffer,
602         AS_HELP_STRING([--enable-sniffer],
603                        [enable IRC traffic sniffer (enables debug mode)]),
604         if test "$enableval" = "yes"; then
605                 AC_DEFINE(SNIFFER, 1)
606                 x_sniffer_on=yes; x_debug_on=yes
607         fi
608 )
609
610 # enable additional debugging code?
611
612 AC_ARG_ENABLE(debug,
613         AS_HELP_STRING([--enable-debug],
614                        [show additional debug output]),
615         if test "$enableval" = "yes"; then x_debug_on=yes; fi
616 )
617 if test "$x_debug_on" = "yes"; then
618         AC_DEFINE(DEBUG, 1)
619         test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
620         AC_CHECK_FUNCS(mtrace)
621 fi
622
623 # enable "strict RFC rules"?
624
625 x_strict_rfc_on=no
626 AC_ARG_ENABLE(strict-rfc,
627         AS_HELP_STRING([--enable-strict-rfc],
628                        [strict RFC conformance -- may break clients!]),
629         if test "$enableval" = "yes"; then
630                 AC_DEFINE(STRICT_RFC, 1)
631                 x_strict_rfc_on=yes
632         fi
633 )
634
635 # -- Definitions --
636
637 AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
638 AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
639 AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
640
641 # Add additional CFLAGS, LDFLAGS and LIBS which were specified on the command
642 # line or by some tests from above, but after running this script. Useful for
643 # adding "-Werror", for example:
644 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
645 test -n "$LDFLAGS_END" && LDFLAGS="$LDFLAGS $LDFLAGS_END"
646 test -n "$LIBS_END" && LIBS="$LIBS $LIBS_END"
647
648 # -- Generate files --
649
650 AC_CONFIG_FILES([ \
651         Makefile \
652         contrib/Debian/Makefile \
653         contrib/MacOSX/Makefile \
654         contrib/MacOSX/ngIRCd.pmdoc/Makefile \
655         contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
656         contrib/Makefile \
657         doc/Makefile \
658         doc/src/Makefile \
659         man/Makefile \
660         src/ipaddr/Makefile \
661         src/Makefile \
662         src/ngircd/Makefile \
663         src/portab/Makefile \
664         src/testsuite/Makefile \
665         src/tool/Makefile \
666 ])
667
668 AC_OUTPUT
669
670 type dpkg >/dev/null 2>&1
671 if test $? -eq 0; then
672         # Generate debian/ link if the dpkg command exists
673         # (read: if we are running on a debian compatible system)
674         echo "creating Debian-specific links ..."
675         test -f debian/rules || ln -s contrib/Debian debian
676 fi
677
678 # -- Result --
679
680 echo
681 echo "ngIRCd $PACKAGE_VERSION has been configured with the following options:"
682 echo
683
684 # Someone please show me a better way :)  [borrowed by OpenSSH]
685 B=`eval echo ${bindir}` ; B=`eval echo ${B}`
686 S=`eval echo ${sbindir}` ; S=`eval echo ${S}`
687 C=`eval echo ${sysconfdir}` ; C=`eval echo ${C}`
688 M=`eval echo ${mandir}` ; M=`eval echo ${M}`
689 D=`eval echo ${docdir}` ; D=`eval echo ${D}`
690
691 echo "               Host: ${host}"
692 echo "           Compiler: ${CC}"
693 test -n "$CFLAGS"       && echo "     Compiler flags: ${CFLAGS}"
694 test -n "$CPPFLAGS"     && echo " Preprocessor flags: ${CPPFLAGS}"
695 test -n "$LDFLAGS"      && echo "       Linker flags: ${LDFLAGS}"
696 test -n "$LIBS"         && echo "          Libraries: ${LIBS}"
697 echo
698 echo "    'ngircd' binary: $S"
699 echo " Configuration file: $C"
700 echo "       Manual pages: $M"
701 echo "      Documentation: $D"
702 echo
703
704 echo $ECHO_N "     Syslog support: $ECHO_C"
705 test "$x_syslog_on" = "yes" \
706         && echo $ECHO_N "yes   $ECHO_C" \
707         || echo $ECHO_N "no    $ECHO_C"
708 echo $ECHO_N "  Enable debug code: $ECHO_C"
709 test "$x_debug_on" = "yes" \
710         && echo "yes" \
711         || echo "no"
712
713 echo $ECHO_N "   zlib compression: $ECHO_C"
714 test "$x_zlib_on" = "yes" \
715         && echo $ECHO_N "yes   $ECHO_C" \
716         || echo $ECHO_N "no    $ECHO_C"
717 echo $ECHO_N "        IRC sniffer: $ECHO_C"
718 test "$x_sniffer_on" = "yes" \
719         && echo "yes" \
720         || echo "no"
721
722 echo $ECHO_N "   Use TCP Wrappers: $ECHO_C"
723 test "$x_tcpwrap_on" = "yes" \
724         && echo $ECHO_N "yes   $ECHO_C" \
725         || echo $ECHO_N "no    $ECHO_C"
726 echo $ECHO_N "    Strict RFC mode: $ECHO_C"
727 test "$x_strict_rfc_on" = "yes" \
728         && echo "yes" \
729         || echo "no"
730
731 echo $ECHO_N "      IDENT support: $ECHO_C"
732 test "$x_identauth_on" = "yes" \
733         && echo $ECHO_N "yes   $ECHO_C" \
734         || echo $ECHO_N "no    $ECHO_C"
735 echo $ECHO_N "      IRC+ protocol: $ECHO_C"
736 test "$x_ircplus_on" = "yes" \
737         && echo "yes" \
738         || echo "no"
739
740 echo $ECHO_N "      IPv6 protocol: $ECHO_C"
741 test "$x_ipv6_on" = "yes" \
742         && echo $ECHO_N "yes   $ECHO_C" \
743         || echo $ECHO_N "no    $ECHO_C"
744 echo $ECHO_N "        I/O backend: $ECHO_C"
745         echo "$x_io_backend"
746
747 echo $ECHO_N "        PAM support: $ECHO_C"
748 test "$x_pam_on" = "yes" \
749         && echo $ECHO_N "yes   $ECHO_C" \
750         || echo $ECHO_N "no    $ECHO_C"
751 echo $ECHO_N "        SSL support: $ECHO_C"
752 echo "$x_ssl_lib"
753
754 echo $ECHO_N "   libiconv support: $ECHO_C"
755         echo "$x_iconv_on"
756
757 echo
758
759 define(_automake_regex_,[[^AUTOMAKE_OPTIONS = [a-z .\-]*/portab/ansi2knr]])
760 if ! grep "_automake_regex_" src/ngircd/Makefile.am >/dev/null 2>&1; then
761         echo "WARNING:"
762         echo "This GNU automake generated build system does not support \"de-ANSI-fication\","
763         echo "therefore don't use it to generate \"official\" distribution archives!"
764         echo "(Most probably you want to use GNU automake 1.11.x for this purpose ...)"
765         echo
766 fi
767
768 # -eof-