]> arthur.barton.de Git - ngircd-alex.git/blob - configure.ng
aec1eb144f37898d367ef3f985013cdc2eda4265
[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.61])
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                         saved_LIBS="$LIBS"
470                         LIBS="-lwrap $LIBS"
471                         LIBS_END="-lwrap $LIBS_END"
472                         AC_LINK_IFELSE([AC_LANG_PROGRAM([[
473 #include <sys/types.h>
474 #include <sys/socket.h>
475 #include <tcpd.h>
476 int allow_severity = 0;
477 int deny_severity = 0;
478                                 ]],[[
479                                 tcpd_warn("link test");
480                                 ]])],[
481                                 AC_MSG_RESULT(yes)
482                                 AC_DEFINE(TCPWRAP, 1)
483                                 x_tcpwrap_on=yes
484                                 ],[
485                                 AC_MSG_RESULT(no)
486                                 AC_MSG_ERROR([Can't enable TCP wrappers!])
487                         ])
488                         LIBS="$saved_LIBS"
489                 fi
490         ]
491 )
492
493 # do IDENT requests using libident?
494
495 x_identauth_on=no
496 AC_ARG_WITH(ident,
497         AS_HELP_STRING([--with-ident],
498                        [enable "IDENT" ("AUTH") protocol support]),
499         [       if test "$withval" != "no"; then
500                         if test "$withval" != "yes"; then
501                                 CFLAGS="-I$withval/include $CFLAGS"
502                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
503                                 LDFLAGS="-L$withval/lib $LDFLAGS"
504                         fi
505                         AC_CHECK_LIB(ident, ident_id)
506                         AC_CHECK_FUNCS(ident_id, x_identauth_on=yes,
507                                 AC_MSG_ERROR([Can't enable IDENT support!])
508                         )
509                 fi
510         ]
511 )
512 if test "$x_identauth_on" = "yes"; then
513         AC_DEFINE(IDENTAUTH, 1)
514         AC_CHECK_HEADERS(ident.h,,AC_MSG_ERROR([required C header missing!]))
515 fi
516
517 # compile in PAM support?
518
519 x_pam_on=no
520 AC_ARG_WITH(pam,
521         AS_HELP_STRING([--with-pam],
522                        [enable user authentication using PAM]),
523         [       if test "$withval" != "no"; then
524                         if test "$withval" != "yes"; then
525                                 CFLAGS="-I$withval/include $CFLAGS"
526                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
527                                 LDFLAGS="-L$withval/lib $LDFLAGS"
528                         fi
529                         AC_CHECK_LIB(pam, pam_authenticate)
530                         AC_CHECK_FUNCS(pam_authenticate, x_pam_on=yes,
531                                 AC_MSG_ERROR([Can't enable PAM support!])
532                         )
533                 fi
534         ]
535 )
536 if test "$x_pam_on" = "yes"; then
537         AC_DEFINE(PAM, 1)
538         AC_CHECK_HEADERS(security/pam_appl.h,pam_ok=yes)
539         if test "$pam_ok" != "yes"; then
540                 AC_CHECK_HEADERS(pam/pam_appl.h,pam_ok=yes,
541                         AC_MSG_ERROR([required C header missing!]))
542         fi
543 fi
544
545 # compile in IRC+ protocol support?
546
547 x_ircplus_on=yes
548 AC_ARG_ENABLE(ircplus,
549         AS_HELP_STRING([--disable-ircplus],
550                        [disable IRC+ protocol]),
551         if test "$enableval" = "no"; then x_ircplus_on=no; fi
552 )
553 if test "$x_ircplus_on" = "yes"; then
554         AC_DEFINE(IRCPLUS, 1)
555
556         # Compile in iconv support?
557         # We only check for it when IRC+ is enabled, because the IRC+ command
558         # CHARCONV is the only function depending on it.
559         x_iconv_on=no
560         AC_ARG_WITH(iconv,
561                 AS_HELP_STRING([--with-iconv],
562                                [enable character conversion using libiconv]),
563                 [ if test "$withval" != "no"; then
564                         if test "$withval" != "yes"; then
565                                 CFLAGS="-I$withval/include $CFLAGS"
566                                 CPPFLAGS="-I$withval/include $CPPFLAGS"
567                                 LDFLAGS="-L$withval/lib $LDFLAGS"
568                         fi
569                         AC_CHECK_LIB(iconv, iconv_open)
570                         AC_CHECK_FUNCS(iconv_open, x_iconv_on=yes)
571                         if test "$x_iconv_on" != "yes"; then
572                                 AC_CHECK_LIB(iconv, libiconv_open)
573                                 AC_CHECK_FUNCS(libiconv_open, x_iconv_on=yes)
574                         fi
575                         if test "$x_iconv_on" != "yes"; then
576                                 AC_MSG_ERROR([Can't enable libiconv support!])
577                         fi
578                 fi ]
579         )
580         if test "$x_iconv_on" = "yes"; then
581                 AC_DEFINE(ICONV, 1)
582         fi
583 fi
584
585 # enable support for IPv6?
586 x_ipv6_on=no
587 AC_ARG_ENABLE(ipv6,
588         AS_HELP_STRING([--enable-ipv6],
589                        [enable IPv6 protocol support]),
590         if test "$enableval" = "yes"; then x_ipv6_on=yes; fi
591 )
592 if test "$x_ipv6_on" = "yes"; then
593         # getaddrinfo() and getnameinfo() are optional when not compiling
594         # with IPv6 support, but are required for IPv6 to work!
595         AC_CHECK_FUNCS([ \
596                 getaddrinfo getnameinfo \
597                 ],,AC_MSG_ERROR([required function missing for IPv6 support!]))
598         AC_DEFINE(WANT_IPV6, 1)
599 fi
600
601 # compile in IRC "sniffer"?
602
603 x_sniffer_on=no; x_debug_on=no
604 AC_ARG_ENABLE(sniffer,
605         AS_HELP_STRING([--enable-sniffer],
606                        [enable IRC traffic sniffer (enables debug mode)]),
607         if test "$enableval" = "yes"; then
608                 AC_DEFINE(SNIFFER, 1)
609                 x_sniffer_on=yes; x_debug_on=yes
610         fi
611 )
612
613 # enable additional debugging code?
614
615 AC_ARG_ENABLE(debug,
616         AS_HELP_STRING([--enable-debug],
617                        [show additional debug output]),
618         if test "$enableval" = "yes"; then x_debug_on=yes; fi
619 )
620 if test "$x_debug_on" = "yes"; then
621         AC_DEFINE(DEBUG, 1)
622         test "$GCC" = "yes" && CFLAGS="-pedantic $CFLAGS"
623         AC_CHECK_FUNCS(mtrace)
624 fi
625
626 # enable "strict RFC rules"?
627
628 x_strict_rfc_on=no
629 AC_ARG_ENABLE(strict-rfc,
630         AS_HELP_STRING([--enable-strict-rfc],
631                        [strict RFC conformance -- may break clients!]),
632         if test "$enableval" = "yes"; then
633                 AC_DEFINE(STRICT_RFC, 1)
634                 x_strict_rfc_on=yes
635         fi
636 )
637
638 # -- Definitions --
639
640 AC_DEFINE_UNQUOTED(HOST_CPU, "$host_cpu" )
641 AC_DEFINE_UNQUOTED(HOST_VENDOR, "$host_vendor" )
642 AC_DEFINE_UNQUOTED(HOST_OS, "$host_os" )
643
644 # Add additional CFLAGS, LDFLAGS and LIBS which were specified on the command
645 # line or by some tests from above, but after running this script. Useful for
646 # adding "-Werror", for example:
647 test -n "$CFLAGS_END" && CFLAGS="$CFLAGS $CFLAGS_END"
648 test -n "$LDFLAGS_END" && LDFLAGS="$LDFLAGS $LDFLAGS_END"
649 test -n "$LIBS_END" && LIBS="$LIBS $LIBS_END"
650
651 # -- Generate files --
652
653 AC_CONFIG_FILES([ \
654         Makefile \
655         contrib/Debian/Makefile \
656         contrib/MacOSX/Makefile \
657         contrib/MacOSX/ngIRCd.pmdoc/Makefile \
658         contrib/MacOSX/ngIRCd.xcodeproj/Makefile \
659         contrib/Makefile \
660         doc/Makefile \
661         doc/src/Makefile \
662         man/Makefile \
663         src/ipaddr/Makefile \
664         src/Makefile \
665         src/ngircd/Makefile \
666         src/portab/Makefile \
667         src/testsuite/Makefile \
668         src/tool/Makefile \
669 ])
670
671 AC_OUTPUT
672
673 type dpkg >/dev/null 2>&1
674 if test $? -eq 0; then
675         # Generate debian/ link if the dpkg command exists
676         # (read: if we are running on a debian compatible system)
677         echo "creating Debian-specific links ..."
678         test -f debian/rules || ln -s contrib/Debian debian
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-