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