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