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