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