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