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