1dnl
2dnl  @configure_input@
3dnl
4dnl  Configuration input file for Web Polygraph
5dnl
6
7AC_INIT([Web Polygraph],[4.13.0],[],[polygraph])
8AC_CONFIG_SRCDIR([src/base/polygraph.h])
9AC_CONFIG_AUX_DIR(cfgaux)
10
11AM_INIT_AUTOMAKE([1.5 nostdinc])
12AM_MAINTAINER_MODE
13AC_CONFIG_HEADERS([src/config.h])
14AC_PREFIX_DEFAULT(/usr/local)
15
16AH_TOP(
17[#ifndef POLYGRAPH__CONFIG_H
18#define POLYGRAPH__CONFIG_H
19
20
21/* here are some typedefs that configure script might be missing */
22#undef rlim_t])
23
24AH_BOTTOM(
25[#include "post-config.h"
26
27#endif /* POLYGRAPH__CONFIG_H */])
28
29dnl general stuff used by other checks
30AH_VERBATIM(CONFIG_HOST_TYPE,
31[/* host type from configure */
32#define CONFIG_HOST_TYPE "-unknown-"])
33AC_CANONICAL_HOST
34AC_DEFINE_UNQUOTED(CONFIG_HOST_TYPE, "$host")
35
36dnl add polygraph- prefix and strip .pl extension during installation
37program_transform_name="s/^/polygraph-/; s/\\.pl\$$//; $program_transform_name"
38
39AC_LANG([C++])
40
41dnl save pre-set values (if any) for variables that are
42dnl created by autoconf
43PRESET_CXXFLAGS="$CXXFLAGS"
44PRESET_LDFLAGS="$LDFLAGS"
45
46dnl AC_CONFIG_SUBDIRS(src/Hapy)
47
48
49dnl check for programs
50AC_PROG_CXX
51AC_PROG_CXXCPP
52AC_PROG_INSTALL
53PKG_PROG_PKG_CONFIG
54
55dnl A temporary workaround to silence ar warning:
56dnl `u' modifier ignored since `D' is the default
57AC_SUBST(ARFLAGS, [cr])
58AC_SUBST(AR_FLAGS, [cr])
59AM_PROG_AR
60
61
62dnl user can overwrite this default with --enable-shared
63AC_DISABLE_SHARED
64LT_INIT
65
66AC_C_BIGENDIAN
67
68AC_PATH_PROG(HELP2MAN, help2man)
69AM_CONDITIONAL(ENABLE_MANPAGES_GEN, [test -n "$HELP2MAN"])
70
71# change default extention for source files
72ac_ext=cc
73
74dnl check if alleged C++ compiler understands C++
75AC_MSG_CHECKING(whether the C++ compiler ($CXX) is a C++ compiler)
76AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
77	#define Concat(a,b) a ## b
78	struct T {
79		virtual ~T();
80		virtual int m() const = 0;
81		mutable bool a;
82	};
83
84	template <class P>
85	struct C: public P {
86		C(int): c(0) {}
87		int m() const;
88		int c;
89	};
90
91	template <class P>
92	int C<P>::m() const { Concat(re,turn) c; }
93
94	inline int test_inline() { return 0; }
95]], [[
96	// this is main()'s body
97	static C<T> ct(1);
98	return 0;
99]])],[
100	AC_MSG_RESULT(yes)
101],[
102	AC_MSG_RESULT(no)
103	AC_MSG_ERROR(the compiler ($CXX) failed to pass a simple C++ test; check config.log for details)
104])
105
106
107dnl check for optional features
108AC_SUBST(std_include)
109AC_ARG_WITH(std-include,
110AS_HELP_STRING([--with-std-include=DIR],[where to find standard C++ headers]),
111	[
112		std_include=`echo -I$withval | sed 's/:/ -I/g'`
113		CPPFLAGS="$CPPFLAGS $std_include"
114	],
115	[
116		std_include=''
117	]
118)
119
120
121dnl adjust program options
122
123OLD_CXXFLAGS="$CXXFLAGS"
124if test -z "$PRESET_CXXFLAGS"
125then
126	if test "x$GXX" = xyes
127	then [
128
129		# reset to preferred options
130		# replace -O? with -O3
131		CXXFLAGS=`echo $CXXFLAGS | sed 's/-O[0-9]*/-O3/'`;
132		# enable useful warnings
133		CXXFLAGS="$CXXFLAGS -Wall -Wwrite-strings -Woverloaded-virtual"
134
135		# custom host-dependent tuning
136		case "$host" in
137		alpha-*)
138			# we get random coredumps with g++ -O on alpha-dec-osf4
139			# g++ -O3 warns about being buggy on alpha-*-freebsd4.*
140			echo deleting -On on $host
141			CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]* *//'`
142			;;
143		*-linux-*)
144			# -O2,3 seems to produce coredumps on RH and MDK linux
145			echo enforcing -O1 on $host
146			CXXFLAGS=`echo $CXXFLAGS | sed -e 's/-O[0-9]* */-O1 /'`
147			;;
148		esac
149	] fi
150fi
151
152if test "x$PRESET_CXXFLAGS" != "x$CXXFLAGS"
153then
154	AC_MSG_CHECKING(whether custom $CXX flags work)
155	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
156		]], [[
157			return 0;
158		]])],[
159			AC_MSG_RESULT(probably)
160			echo "changing $CXX flags to $CXXFLAGS"
161		],[
162			AC_MSG_RESULT(no)
163			CXXFLAGS="$OLD_CXXFLAGS"
164			echo "leaving  $CXX flags at $CXXFLAGS"
165
166	])
167fi
168
169dnl check whether compiler is ok with passing -rdynamic to linker
170dnl that flag is required with GCC for linking executables that call dlopen
171if test "x$GXX" = "xyes"
172then
173	AC_MSG_CHECKING(whether -rdynamic $CXX flag works)
174	AC_LINK_IFELSE([AC_LANG_PROGRAM([[
175		]], [[
176			return 0;
177		]])],[
178			AC_MSG_RESULT(probably)
179			LDFLAG_RDYNAMIC=-rdynamic
180		],[
181			AC_MSG_RESULT(no)
182			LDFLAG_RDYNAMIC=""
183
184	])
185fi
186
187
188dnl check for libraries
189AC_SEARCH_LIBS(gethostbyname, nsl)
190AC_CHECK_LIB(socket, main)
191AC_CHECK_LIB(m, main)
192
193AC_MSG_CHECKING(whether to link statically)
194AC_ARG_WITH(static-linking,
195[  --with-static-linking   link binaries statically],
196[
197	case "$withval" in
198	no)
199		AC_MSG_RESULT(no)
200		;;
201	*)
202		AC_MSG_RESULT(yes)
203		LDFLAGS="-static $LDFLAGS"
204	esac
205],[
206	AC_MSG_RESULT(no)
207]
208)
209
210dnl check if compiler can find C++ headers
211AC_CHECK_HEADER(iostream, [],
212	AC_MSG_WARN([
213		Failure to find 'iostream' header file indicates
214		a compiler installation problem; You may want to
215		use --enable-std-include option to help your
216		compiler to find directories with standard C++
217		include files.])
218)
219
220AC_CACHE_CHECK(whether C++ std:: namespace works,
221	ac_cv_std_namespace_works, [
222		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
223			#include <iostream>
224			#include <iomanip>
225		]], [[
226			std::cout << std::endl;
227			return 0;
228		]])],[
229			ac_cv_std_namespace_works=yes
230		],[
231			ac_cv_std_namespace_worls=no
232		])
233	]
234)
235
236
237dnl Check for the presence of SSL libraries and headers
238
239dnl Default to compiler/linker defaults for SSL files and libraries.
240OPT_SSL=default
241AC_ARG_WITH(ssl,dnl
242AS_HELP_STRING([--with-ssl=PATH],[where to look for OpenSSL libs and headers])
243AS_HELP_STRING([--without-ssl],[disable SSL support]),
244	[OPT_SSL="$withval"])
245
246if test "x$OPT_SSL" = xno
247then
248	AC_MSG_WARN([SSL support explicitly disabled])
249else
250	openssl_found=no
251
252	dnl save the pre-ssl check flags for a while
253	CLEANLDFLAGS="$LDFLAGS"
254	CLEANCPPFLAGS="$CPPFLAGS"
255	CLEANLIBS="$LIBS"
256
257	dnl Check for and handle argument to --with-ssl.
258	if test "x$OPT_SSL" != xyes && test "x$OPT_SSL" != xdefault
259	then
260		dnl user-specified PATH
261		EXTRA_SSL="$OPT_SSL"
262	fi
263
264	if test "x$PKG_CONFIG" != x
265	then
266		AC_MSG_CHECKING([for openssl.pc])
267		OLD_PKG_CONFIG_PATH="$PKG_CONFIG_PATH"
268		use_pkg_config=no
269		if test "x$EXTRA_SSL" = x
270		then
271			use_pkg_config=yes
272		elif test -f "$EXTRA_SSL/lib/pkgconfig/openssl.pc"
273		then
274			export PKG_CONFIG_PATH="$EXTRA_SSL/lib/pkgconfig:$OLD_PKG_CONFIG_PATH"
275			use_pkg_config=yes
276		elif test -f "$EXTRA_SSL/libdata/pkgconfig/openssl.pc"
277		then
278			export PKG_CONFIG_PATH="$EXTRA_SSL/libdata/pkgconfig:$OLD_PKG_CONFIG_PATH"
279			use_pkg_config=yes
280		fi
281
282		if test $use_pkg_config = yes
283		then
284			if $PKG_CONFIG openssl
285			then
286				CPPFLAGS="`$PKG_CONFIG --cflags-only-I openssl` $CLEANCPPFLAGS"
287				LDFLAGS="`$PKG_CONFIG --libs-only-L --libs-only-other openssl` $CLEANLDFLAGS"
288				LIBS="`$PKG_CONFIG --libs-only-l openssl` $CLEANLIBS"
289				openssl_found=yes
290				if test "x$EXTRA_SSL" != x
291				then
292					AC_MSG_RESULT([$PKG_CONFIG_PATH])
293				else
294					AC_MSG_RESULT([yes])
295				fi
296			else
297				dnl package not found, its configuration is malformed, etc.
298				AC_MSG_RESULT([no])
299			fi
300			PACKAGED_OPENSSL_PREFIX="`$PKG_CONFIG --variable=prefix openssl`"
301			if test "x$PACKAGED_OPENSSL_PREFIX" != x
302			then
303				AC_MSG_NOTICE([OpenSSL installation prefix according to pkg-config: $PACKAGED_OPENSSL_PREFIX])
304			fi
305		else
306			AC_MSG_RESULT([not found in $EXTRA_SSL/{lib,libdata}/pkgconfig/])
307		fi
308		PKG_CONFIG_PATH="$OLD_PKG_CONFIG_PATH"
309	fi
310
311	if test "x$openssl_found" != xyes
312	then
313		if test "x$EXTRA_SSL" != x
314		then
315			AC_MSG_CHECKING([for openssl/ssl.h in $EXTRA_SSL])
316			if test -f "$EXTRA_SSL/include/openssl/ssl.h"
317			then
318				CPPFLAGS="-I$EXTRA_SSL/include $CLEANCPPFLAGS"
319				LDFLAGS="-L$EXTRA_SSL/lib $CLEANLDFLAGS"
320				LIBS="-lssl -lcrypto $CLEANLIBS"
321				openssl_found=yes
322				AC_MSG_RESULT([yes])
323			else
324				AC_MSG_RESULT([no])
325			fi
326		else
327			CPPFLAGS="$CLEANCPPFLAGS"
328			AC_CHECK_HEADER([openssl/ssl.h],[
329				LDFLAGS="$CLEANLDFLAGS"
330				LIBS="-lssl -lcrypto $CLEANLIBS"
331				openssl_found=yes
332			],[
333				ssldir=/usr/local/ssl
334				CPPFLAGS="-I$ssldir/include $CLEANCPPFLAGS"
335				AC_CHECK_HEADER([openssl/ssl.h],[
336					LDFLAGS="-L$ssldir/lib $CLEANLDFLAGS"
337					LIBS="-lssl -lcrypto $CLEANLIBS"
338					openssl_found=yes
339				],[
340					CPPFLAGS="$CLEANCPPFLAGS"
341				])
342			])
343		fi
344	fi
345
346	OPENSSL_ENABLED=0
347	if test "x$openssl_found" = "xyes"
348	then
349		AC_MSG_CHECKING([whether compiling and linking against OpenSSL works])
350		AC_LINK_IFELSE(
351			[AC_LANG_PROGRAM([#include <openssl/ssl.h>], [SSL_new(NULL)])],[
352				OPENSSL_ENABLED=1
353				AC_MSG_RESULT([yes])
354			], [
355				AC_MSG_RESULT([no])
356				CPPFLAGS="$CLEANCPPFLAGS"
357				LDFLAGS="$CLEANLDFLAGS"
358				LIBS="$CLEANLIBS"
359			])
360	fi
361
362	if test "x$OPT_SSL" != xdefault -a "$OPENSSL_ENABLED" != "1"
363	then
364		AC_MSG_ERROR([OpenSSL libraries and/or directories were not found in $EXTRA_SSL])
365	fi
366
367	AC_DEFINE_UNQUOTED(OPENSSL_ENABLED, $OPENSSL_ENABLED,
368		[Define if OpenSSL support is enabled.])
369
370	if test "$OPENSSL_ENABLED" = "1"
371	then
372		AC_CHECK_FUNCS( SSLv2_method \
373			SSLv3_method \
374			TLS_method \
375			RAND_status \
376			RAND_screen \
377			RAND_egd)
378
379		AH_TEMPLATE(HAVE_SSL_VERSION_MEMBER)
380		AC_CACHE_CHECK(for SSL version member, ac_cv_have_SSL_version_member, [
381			AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
382				#include <openssl/ssl.h>
383			]], [[
384				SSL *S;
385				return sizeof(S->version) == 0;
386			]])],[
387				ac_cv_have_SSL_version_member="yes"
388			],[
389				ac_cv_have_SSL_version_member="no"
390			])
391		])
392		if test "x$ac_cv_have_SSL_version_member" = xyes ; then
393			AC_DEFINE(HAVE_SSL_VERSION_MEMBER)
394		fi
395	fi
396fi
397
398dnl Set zlib_places to fix AX_CHECK_ZLIB serial number 8
399if test "x${with_zlib}" = "x"
400then
401	zlib_places="/usr/local /usr /opt/local /sw"
402fi
403AX_CHECK_ZLIB
404if test "$zlib_cv_libz" = "yes"
405then
406	AC_CACHE_CHECK(whether zlib supports HTTP gzip encoding natively,
407		ac_cv_zlib_gzip, [
408			AC_RUN_IFELSE([AC_LANG_SOURCE([[
409				#include <zlib.h>
410
411				int main() {
412					z_stream z;
413					z.zalloc = Z_NULL;
414					z.zfree = Z_NULL;
415					z.opaque = 0;
416					// the magic constants below are taken from zlib.h to force
417					// gzip header and footer for the deflated stream
418					int res = deflateInit2(&z, Z_DEFAULT_COMPRESSION,
419						Z_DEFLATED, 15 + 16, 8, Z_DEFAULT_STRATEGY);
420					return (res == Z_OK) ? 0 : -1;
421				}
422			]])],[
423				ac_cv_zlib_gzip="yes";
424			],[
425				AC_MSG_ERROR([
426		Your zlib library does not seem to support
427		HTTP gzip encoding natively.
428		Upgrade to zlib version 1.2.0.4 (or later) OR
429		disable zlib usage with --without-zlib])
430			],[
431				dnl TODO: this warning disrupts output and
432				dnl should not be conditional;
433				dnl move it after the AC_CACHE_CHECK call.
434				AC_MSG_WARN([
435		Skipping checks for native HTTP gzip encoding support in
436		zlib due to cross compiling.])
437			])
438		]
439	)
440else
441	AC_MSG_WARN([
442		Polygraph HTTP compression features are
443		explicitly disabled by the user.])
444	sleep 1;
445fi
446
447AC_MSG_NOTICE([checking for Kerberos support])
448AX_SAVE_FLAGS
449AC_ARG_WITH([kerberos],
450AS_HELP_STRING([--with-kerberos=PATH],[path to krb5-config (default=detect)])
451AS_HELP_STRING([--without-kerberos],[disable Kerberos support]),
452	[test "x$with_kerberos" != "xno" && KERBEROS_WANTED=1],
453	[with_kerberos=yes])
454if test "x$with_kerberos" != "xno"; then
455	if test "x$with_kerberos" = "xyes"; then
456		AC_PATH_PROG([KRB5CONFIG], [krb5-config])
457	else
458		AC_MSG_CHECKING([for krb5-config])
459		AC_MSG_RESULT([$with_kerberos])
460		KRB5CONFIG="$with_kerberos"
461	fi
462	AC_MSG_CHECKING([if krb5-config is executable])
463	if test -x "$KRB5CONFIG"; then
464		AC_MSG_RESULT([yes])
465		AC_MSG_CHECKING([for gssapi support in krb5-config])
466		if "$KRB5CONFIG" | grep -q gssapi; then
467			AC_MSG_RESULT([yes])
468			KRB5CFLAGS=`"$KRB5CONFIG" --cflags gssapi`
469			CPPFLAGS="$CPPFLAGS $KRB5CFLAGS"
470			KRB5LIBS=`"$KRB5CONFIG" --libs gssapi`
471			LIBS="$LIBS $KRB5LIBS"
472		else
473			AC_MSG_RESULT([no])
474		fi
475	else
476		AC_MSG_RESULT([no])
477	fi
478fi
479if test "x$KRB5LIBS" != "x"; then
480	KERBEROS_ENABLED=1 # may be overridden below
481
482	AC_CHECK_HEADERS([krb5.h],
483		[AC_MSG_CHECKING([if krb5.h is broken for C++])
484		AC_LINK_IFELSE(
485			[AC_LANG_PROGRAM([[#include <krb5.h>]],
486				[[krb5_init_context(0)]])],
487			[AC_MSG_RESULT([not broken])],
488			[AC_MSG_RESULT([broken])
489			AC_MSG_CHECKING([if we can work around broken krb5.h])
490			AC_LINK_IFELSE(
491				[AC_LANG_PROGRAM(
492					[[extern "C" {
493					#include <krb5.h>
494					}]],
495					[[krb5_init_context(0)]])],
496				[AC_MSG_RESULT([yes])
497				AC_DEFINE(HAVE_BROKEN_KRB5_H, 1,
498					[Define to 1 if krb5.h is broken for C++.])],
499				[AC_MSG_RESULT([no])
500				KERBEROS_ENABLED=0])])],
501		[KERBEROS_ENABLED=0])
502
503	AC_CHECK_TYPES([krb5_init_creds_context, krb5_tkt_creds_context], [],
504		[KERBEROS_ENABLED=0],
505		[[#if HAVE_KRB5_H
506		#if HAVE_BROKEN_KRB5_H
507		extern "C" {
508		#include <krb5.h>
509		}
510		#else
511		#include <krb5.h>
512		#endif
513		#endif]])
514
515	AC_CHECK_HEADERS([gssapi/gssapi.h], [],
516		[AC_CHECK_HEADERS([gssapi.h], [], [KERBEROS_ENABLED=0])])
517fi
518if test "x$KERBEROS_ENABLED" = "x1"; then
519	AC_DEFINE(KERBEROS_ENABLED, 1, [Define if Kerberos support is enabled.])
520	AC_MSG_NOTICE([Kerberos support enabled])
521else
522	if test "x$KERBEROS_WANTED" = "x1"; then
523		AC_MSG_ERROR([Kerberos support requested but could not be enabled])
524	else
525		AC_MSG_WARN([Kerberos support disabled.])
526	fi
527	AX_RESTORE_FLAGS
528fi
529
530AC_MSG_NOTICE([checking for libldns support])
531AX_SAVE_FLAGS
532AC_ARG_WITH([ldns],
533AS_HELP_STRING([--with-ldns=PATH],[path to ldns-config (default=detect)])
534AS_HELP_STRING([--without-ldns],[disable ldns support]),
535	[test "x$with_ldns" != "xno" && LDNS_WANTED=1],
536	[with_ldns=yes])
537if test "x$with_ldns" != "xno"; then
538	dnl If needed, check both the native ldns-config and std pkg-config.
539	if test "x$with_ldns" = "xyes"; then
540		AC_PATH_PROG([LIBLDNS_CONFIG], [ldns-config])
541	else
542		AC_MSG_CHECKING([for ldns-config])
543		AC_MSG_RESULT([$with_ldns])
544		LIBLDNS_CONFIG="$with_ldns"
545	fi
546	if test "x$LIBLDNS_CONFIG" != "xno" -a "x$LIBLDNS_CONFIG" != "x"; then
547		AC_MSG_CHECKING([if ldns-config is executable])
548		if test -x "$LIBLDNS_CONFIG"; then
549			AC_MSG_RESULT([yes])
550			LIBLDNS_CFLAGS=`"$LIBLDNS_CONFIG" --cflags`
551			LIBLDNS_LIBS=`"$LIBLDNS_CONFIG" --libs`
552			CPPFLAGS="$CPPFLAGS $LIBLDNS_CFLAGS"
553			LIBS="$LIBS $LIBLDNS_LIBS"
554		else
555			AC_MSG_RESULT([no])
556		fi
557	fi
558	if test "x$LIBLDNS_LIBS" = "x" -a "x$PKG_CONFIG" != "x"; then
559		PKG_CHECK_MODULES([LIBLDNS], [libldns >= 1.6],[
560			CPPFLAGS="$CPPFLAGS $LIBLDNS_CFLAGS"
561			LIBS="$LIBS $LIBLDNS_LIBS"
562		])
563	fi
564fi
565if test "x$LIBLDNS_LIBS" != "x"; then
566	LDNS_ENABLED=1 # may be overridden below
567	AC_MSG_CHECKING([whether ldns/ldns.h compiles])
568	AC_COMPILE_IFELSE(
569		[AC_LANG_PROGRAM([[#include <ldns/ldns.h>]])],
570		[AC_MSG_RESULT([yes])],
571		[AC_MSG_RESULT([no])
572		AC_MSG_CHECKING([whether we can fix ldns/ldns.h compilation])
573		AC_COMPILE_IFELSE(
574			[AC_LANG_PROGRAM(
575				[[#define class classC
576				#include <ldns/ldns.h>]])],
577			[AC_MSG_RESULT([yes])
578			AC_DEFINE(HAVE_CLASS_IN_LDNS, 1,
579				[Define to 1 if C ldns/ldns.h uses a "class" keyword])],
580			[AC_MSG_RESULT([no])
581			LDNS_ENABLED=0]
582		)]
583	)
584fi
585if test "x$LDNS_ENABLED" = "x1"; then
586	AC_MSG_CHECKING([whether ldns/ldns.h links])
587	AC_LINK_IFELSE(
588		[AC_LANG_PROGRAM([[
589			#if HAVE_CLASS_IN_LDNS
590			#define class classC
591			#endif
592			#include <ldns/ldns.h>]],
593			[[ldns_buffer_new(0)]])],
594		[AC_MSG_RESULT([yes])],
595		[AC_MSG_RESULT([no])
596		AC_MSG_CHECKING([whether we can fix ldns/ldns.h linking])
597		AC_LINK_IFELSE(
598			[AC_LANG_PROGRAM(
599				[[
600				#if HAVE_CLASS_IN_LDNS
601				#define class classC
602				#endif
603				extern "C" {
604				#include <ldns/ldns.h>
605				}]],
606				[[ldns_buffer_new(0)]])],
607			[AC_MSG_RESULT([yes])
608			AC_DEFINE(HAVE_BROKEN_LDNS_H, 1,
609				[Define to 1 if ldns/ldns.h needs extern "C" wrapppers.])],
610			[AC_MSG_RESULT([no])
611			LDNS_ENABLED=0])])
612fi
613if test "x$LDNS_ENABLED" = "x1"; then
614	AC_DEFINE(LDNS_ENABLED, 1, [Define if libldns support is enabled.])
615	AC_MSG_NOTICE([libldns support enabled])
616else
617	if test "x$LDNS_WANTED" = "x1"; then
618		AC_MSG_ERROR([libldns support requested but could not be enabled])
619	else
620		AC_MSG_NOTICE([libldns support disabled])
621	fi
622	if test "x$with_ldns" == "xno"; then
623		AC_MSG_WARN([libldns support is explicitly disabled by the user. PGL zoneDomains() and dnsZone() functions will not work.])
624	else
625		AC_MSG_WARN([libldns is not found. PGL zoneDomains() and dnsZone() functions will not work.])
626	fi
627	AX_RESTORE_FLAGS
628fi
629
630
631dnl check whether loganalizers/comparator should be built
632AC_MSG_CHECKING(whether to build comparator)
633AC_ARG_ENABLE(comparator,
634	AS_HELP_STRING([--enable-comparator],[build comparator [[default=no]]]),
635	[case "${enableval}" in
636		yes) result=yes ;;
637		no)  result=no ;;
638		*) AC_MSG_ERROR([bad value ${enableval} for --enable-comparator <yes|no>]) ;;
639	esac],
640	[result="no (by default)"]
641)
642AC_MSG_RESULT($result)
643AM_CONDITIONAL(ENABLE_COMPARATOR, test "x$result" = xyes)
644
645
646dnl library checks below do not use default actions to
647dnl avoid adding found libraries to all executables via LIBS
648
649
650dnl dlopen may be in libc or in libdl
651HAVE_DLOPEN_SOMEWHERE=no
652AC_CHECK_LIB(c, dlopen,
653	[
654		HAVE_DLOPEN_SOMEWHERE=yes
655		LIB_DL=""
656	],[
657		AC_CHECK_LIB(dl, dlopen, [
658			HAVE_DLOPEN_SOMEWHERE=yes
659			LIB_DL="-ldl"
660		],[
661			LIB_DL=""
662		])
663	]
664)
665
666if test $HAVE_DLOPEN_SOMEWHERE = yes
667then
668	AC_DEFINE(HAVE_DLOPEN, 1,
669		[Define if you have the dlopen/sum/error/close.])
670fi
671
672AC_CHECK_LIB(ncurses, main,
673	[
674		AC_DEFINE(HAVE_LIBNCURSES, 1,
675			[Define if you have the ncurses library (-lncurses).])
676		AC_DEFINE(NCURSES_OPAQUE, 0,
677			[Mac OS X 10.6 (at least) defines NCURSES_OPAQUE to 1 by
678			default. Some structs we use (e.g. WINDOW) are defined
679			only if NCURSES_OPAQUE is 0.])
680		LIB_CURSES="-lncurses"
681	],[
682		LIB_CURSES=""
683	]
684)
685
686dnl checks for header files
687AC_CHECK_HEADERS(\
688	arpa/inet.h \
689	dirent.h \
690	dlfcn.h \
691	endian.h \
692	fcntl.h \
693	ifaddrs.h \
694	iomanip \
695	iomanip.h \
696	iosfwd \
697	iosfwd.h \
698	iostream \
699	iostream.h \
700	math.h \
701	ncurses.h \
702	netdb.h \
703	netinet/in.h \
704	netinet/in_var.h \
705	netinet/ip_dummynet.h \
706	netinet/ip_fw.h \
707	netinet/tcp.h \
708	net/if.h \
709	net/if_var.h \
710	process.h \
711	signal.h \
712	sched.h \
713	string.h \
714	strings.h \
715	sstream \
716	strstrea.h \
717	strstream \
718	strstream.h \
719	sys/endian.h \
720	sys/ioctl.h \
721	sys/param.h \
722	sys/resource.h \
723	sys/select.h \
724	sys/socket.h \
725	sys/sockio.h \
726	sys/stat.h \
727	sys/sysinfo.h \
728	sys/time.h \
729	sys/types.h \
730	time.h \
731	unistd.h \
732	regex.h \
733	winbase.h \
734	winsock2.h,,,-)
735
736
737dnl check for function parameters
738
739AC_CACHE_CHECK(for signal handler type,
740	ac_cv_signal_handler_type, [
741		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
742			#include <signal.h>
743			extern void my_sig_handler(int signo);
744		]], [[
745			signal(SIGINT, my_sig_handler);
746			return 0;
747		]])],[
748			ac_cv_signal_handler_type="void SignalHandler(int)";
749		],[
750			# best we can do without checking further
751			ac_cv_signal_handler_type="void SignalHandler(...)";
752		])
753	]
754)
755AC_DEFINE_UNQUOTED(SIGNAL_HANDLER_TYPE, $ac_cv_signal_handler_type,
756	[sighandler prototype (e.g. "void SignalHandler(...)" on IRIX])
757
758
759dnl check for types
760
761dnl check for rlim_t type in sys/socket.h
762AH_TEMPLATE(HAVE_TYPE_RLIM_T)
763AC_CACHE_CHECK(for rlim_t, ac_cv_type_rlim_t, [
764	AC_EGREP_CPP(
765		[rlim_t[^a-zA-Z_0-9]],
766		[
767			#include <sys/types.h>
768			#include <sys/resource.h>
769			#if STDC_HEADERS
770			#include <stdlib.h>
771			#include <stddef.h>
772			#endif
773		],
774		ac_cv_type_rlim_t=yes,
775		ac_cv_type_rlim_t=no
776	)
777])
778if test "x$ac_cv_type_rlim_t" = xyes; then
779  AC_DEFINE(HAVE_TYPE_RLIM_T, 1)
780fi
781
782AC_CACHE_CHECK(for socklen_t, ac_cv_type_socklen_t, [
783	AC_EGREP_CPP(
784		[socklen_t[^a-zA-Z_0-9]],
785		[
786			#include <sys/types.h>
787			#include <sys/socket.h>
788			#if STDC_HEADERS
789			#include <stdlib.h>
790			#include <stddef.h>
791			#endif
792		],
793		ac_cv_type_socklen_t=yes,
794		ac_cv_type_socklen_t=no
795	)
796])
797if test "x$ac_cv_type_socklen_t" = xyes; then
798  AC_DEFINE(HAVE_TYPE_SOCKLEN_T, 1, [Some systems use socklen_t typedef for
799                                     some socket operations. Socklen_t may
800                                     conflict with "int" that is also used.])
801fi
802
803AH_TEMPLATE(HAVE_TYPE_RUSAGE)
804AC_CACHE_CHECK(for rusage, ac_cv_have_type_rusage, [
805	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
806		#include <sys/time.h>
807		#include <sys/resource.h>
808	]], [[
809		struct rusage R;
810		return sizeof(R) == 0;
811	]])],[
812		ac_cv_have_type_rusage="yes"
813	],[
814		ac_cv_have_type_rusage="no"
815	])
816])
817if test "x$ac_cv_have_type_rusage" = xyes ; then
818  AC_DEFINE(HAVE_TYPE_RUSAGE)
819fi
820
821
822dnl tm.tm_gmtoff
823AH_TEMPLATE(HAVE_TYPE_TIMEVAL)
824AC_CACHE_CHECK(for timeval, ac_cv_have_type_timeval, [
825	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
826		#include <time.h>
827		#include <sys/time.h>
828	]], [[
829		struct timeval t;
830		t.tv_sec = 0;
831		t.tv_usec = 0;
832		return 0;
833	]])],[
834		ac_cv_have_type_timeval="yes";
835	],[
836		ac_cv_have_type_timeval="no";
837	])
838])
839if test "x$ac_cv_have_type_timeval" = xyes; then
840	AC_DEFINE(HAVE_TYPE_TIMEVAL, 1)
841fi
842
843AH_TEMPLATE(HAVE_TYPE_IFREQ)
844AC_CACHE_CHECK(for ifreq, ac_cv_have_type_ifreq, [
845	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
846		#include <sys/types.h>
847		#include <sys/socket.h>
848		#ifdef HAVE_NET_IF_H
849		#include <net/if.h>
850		#endif
851	]], [[
852		struct ifreq r;
853		return sizeof(r) == 0;
854	]])],[
855		ac_cv_have_type_ifreq="yes"
856	],[
857		ac_cv_have_type_ifreq="no"
858	])
859])
860if test "x$ac_cv_have_type_ifreq" = xyes ; then
861  AC_DEFINE(HAVE_TYPE_IFREQ)
862fi
863
864AH_TEMPLATE(HAVE_TYPE_IFALIASREQ)
865AC_CACHE_CHECK(for ifaliasreq, ac_cv_have_type_ifaliasreq, [
866	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
867		#include <sys/types.h>
868		#include <sys/socket.h>
869		#ifdef HAVE_NET_IF_H
870		#include <net/if.h>
871		#endif
872	]], [[
873		struct ifaliasreq r;
874		return sizeof(r) == 0;
875	]])],[
876		ac_cv_have_type_ifaliasreq="yes"
877	],[
878		ac_cv_have_type_ifaliasreq="no"
879	])
880])
881if test "x$ac_cv_have_type_ifaliasreq" = xyes ; then
882  AC_DEFINE(HAVE_TYPE_IFALIASREQ)
883fi
884
885AH_TEMPLATE(HAVE_TYPE_IN6_ALIASREQ)
886AC_CACHE_CHECK(for in6_aliasreq, ac_cv_have_type_in6_aliasreq, [
887	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
888		#include <sys/types.h>
889		#include <sys/socket.h>
890		#ifdef HAVE_NET_IF_H
891		#include <net/if.h>
892		#endif
893		#ifdef HAVE_NET_IF_VAR_H
894		#include <net/if_var.h>
895		#endif
896		#ifdef HAVE_NETINET_IN_H
897		#include <netinet/in.h>
898		#endif
899		#ifdef HAVE_NETINET_IN_VAR_H
900		#include <netinet/in_var.h>
901		#endif
902	]], [[
903		struct in6_aliasreq r;
904		return sizeof(r) == 0;
905	]])],[
906		ac_cv_have_type_in6_aliasreq="yes"
907	],[
908		ac_cv_have_type_in6_aliasreq="no"
909	])
910])
911if test "x$ac_cv_have_type_in6_aliasreq" = xyes ; then
912  AC_DEFINE(HAVE_TYPE_IN6_ALIASREQ)
913fi
914
915AH_TEMPLATE(HAVE_TYPE_IN6_IFREQ)
916AC_CACHE_CHECK(for in6_ifreq, ac_cv_have_type_in6_ifreq, [
917	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
918		#include <sys/types.h>
919		#include <sys/socket.h>
920		#ifdef HAVE_NET_IF_H
921		#include <net/if.h>
922		#endif
923		#ifdef HAVE_NET_IF_VAR_H
924		#include <net/if_var.h>
925		#endif
926		#ifdef HAVE_NETINET_IN_H
927		#include <netinet/in.h>
928		#endif
929		#ifdef HAVE_NETINET_IN_VAR_H
930		#include <netinet/in_var.h>
931		#endif
932	]], [[
933		struct in6_ifreq r;
934		return sizeof(r) == 0;
935	]])],[
936		ac_cv_have_type_in6_ifreq="yes"
937	],[
938		ac_cv_have_type_in6_ifreq="no"
939	])
940])
941if test "x$ac_cv_have_type_in6_ifreq" = xyes ; then
942  AC_DEFINE(HAVE_TYPE_IN6_IFREQ)
943fi
944
945AH_TEMPLATE(HAVE_TYPE_STREAMPOS)
946AC_CACHE_CHECK(for streampos, ac_cv_have_streampos, [
947	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
948		#include <iostream.h>
949	]], [[
950		const streampos pos = 0;
951		return sizeof(pos) == 0;
952	]])],[
953		ac_cv_have_type_streampos="yes"
954	],[
955		ac_cv_have_type_streampos="no"
956	])
957])
958if test "x$ac_cv_have_type_streampos" = xyes ; then
959  AC_DEFINE(HAVE_TYPE_STREAMPOS)
960fi
961
962AH_TEMPLATE(HAVE_TYPE_IOS_BASE_FMTFLAGS)
963AC_CACHE_CHECK(for ios_base::fmtflags, ac_cv_have_type_ios_base_fmtflags, [
964	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
965		#include <ios>
966	]], [[
967		std::ios_base::fmtflags flags;
968		return sizeof(flags) == 0;
969	]])],[
970		ac_cv_have_type_ios_base_fmtflags="yes"
971	],[
972		ac_cv_have_type_ios_base_fmtflags="no"
973	])
974])
975if test "x$ac_cv_have_type_ios_base_fmtflags" = xyes ; then
976  AC_DEFINE(HAVE_TYPE_IOS_BASE_FMTFLAGS)
977fi
978
979AH_TEMPLATE(HAVE_TYPE_IOS_FMTFLAGS)
980AC_CACHE_CHECK(for ios::fmtflags, ac_cv_have_type_ios_fmtflags, [
981	AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
982		#include <iostream.h>
983	]], [[
984		ios::fmtflags flags;
985		return sizeof(flags) == 0;
986	]])],[
987		ac_cv_have_type_ios_fmtflags="yes"
988	],[
989		ac_cv_have_type_ios_fmtflags="no"
990	])
991])
992if test "x$ac_cv_have_type_ios_fmtflags" = xyes ; then
993  AC_DEFINE(HAVE_TYPE_IOS_FMTFLAGS)
994fi
995
996
997dnl sockaddr.sa_len
998AC_CACHE_CHECK(whether sockaddr has sa_len,
999	ac_cv_sockaddr_has_sa_len, [
1000		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1001			#include <sys/types.h>
1002			#include <sys/socket.h>
1003		]], [[
1004			// this is main()'s body
1005			struct sockaddr addr;
1006			addr.sa_len = 0;
1007			return 0;
1008		]])],[
1009			ac_cv_sockaddr_has_sa_len="yes";
1010		],[
1011			ac_cv_sockaddr_has_sa_len="no";
1012		])
1013	]
1014)
1015if test "x$ac_cv_sockaddr_has_sa_len" = xyes; then
1016	AC_DEFINE(HAVE_SA_LEN, 1, [sockaddr structure has sa_len member])
1017fi
1018
1019
1020dnl tm.tm_gmtoff
1021AC_CACHE_CHECK(whether tm has tm_gmtoff,
1022	ac_cv_tm_has_tm_gmtoff, [
1023		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1024			#include <time.h>
1025			#include <sys/time.h>
1026		]], [[
1027			struct tm t;
1028			t.tm_gmtoff = 0;
1029			return 0;
1030		]])],[
1031			ac_cv_tm_has_tm_gmtoff="yes";
1032		],[
1033			ac_cv_tm_has_tm_gmtoff="no";
1034		])
1035	]
1036)
1037if test "x$ac_cv_tm_has_tm_gmtoff" = xyes; then
1038	AC_DEFINE(HAVE_TM_GMTOFF, 1, [tm structure has tm_gmtoff member])
1039fi
1040
1041
1042dnl check for global variables
1043
1044dnl timezone(s)
1045AC_DEFUN([AC_TMP], [AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1046	#include <time.h>
1047	#include <sys/time.h>
1048]], [[
1049	return (int)_timezone;
1050]])],[
1051	ac_cv_var_timezone="_timezone";
1052],[
1053	AC_TRY_COMPILE([
1054		#include <time.h>
1055		#include <sys/time.h>
1056		extern time_t timezone;
1057	],[
1058		return (int)timezone;
1059	],[
1060		ac_cv_var_timezone="extern";
1061	],[
1062		ac_cv_var_timezone="none";
1063	])
1064])])
1065
1066
1067AC_CACHE_CHECK(for global timezone variable,
1068	ac_cv_var_timezone, [
1069		AC_RUN_IFELSE([AC_LANG_SOURCE([[
1070			#include <time.h>
1071			#include <sys/time.h>
1072
1073			int main() {
1074				/* function name or a variable name? */
1075				return (((void*)&timezone) == ((void*)timezone)) ? -1 : 0;
1076			}
1077		]])],[
1078			ac_cv_var_timezone="timezone";
1079		],[
1080			AC_TMP
1081		],[
1082			AC_TMP
1083		])
1084	]
1085)
1086
1087AH_TEMPLATE(HAVE_TIMEZONE, [how time zone global variable looks like (timezone, _timezone, etc.)])
1088if test "x$ac_cv_var_timezone" = xnone; then
1089	:;
1090else
1091	if test "x$ac_cv_var_timezone" = xextern; then
1092		AC_DEFINE(HAVE_EXTERN_TIMEZONE, 1, [must explicitly declare timezone global as extern])
1093		AC_DEFINE(HAVE_TIMEZONE, timezone)
1094	else
1095		AC_DEFINE_UNQUOTED(HAVE_TIMEZONE, $ac_cv_var_timezone)
1096	fi
1097fi
1098
1099AH_TEMPLATE(HAVE_ALTZONE, [altzone global is supported (Solaris only?)])
1100AC_CACHE_CHECK(for altzone,
1101	ac_cv_have_altzone, [
1102		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1103			#include <time.h>
1104			#include <sys/time.h>
1105		]], [[
1106			return (int)altzone;
1107		]])],[
1108			ac_cv_have_altzone="yes";
1109		],[
1110			ac_cv_have_altzone="no";
1111		])
1112	]
1113)
1114if test "x$ac_cv_have_altzone" = xyes; then
1115	AC_DEFINE(HAVE_ALTZONE, 1)
1116fi
1117
1118AC_CACHE_CHECK([for htobe64 and be64toh],
1119	ac_cv_have_64bit_byte_order_conversion, [
1120		AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
1121			#if HAVE_ENDIAN_H
1122			#include <endian.h>
1123			#elif HAVE_SYS_ENDIAN_H
1124			#include <sys/endian.h>
1125			#endif
1126		]], [[
1127			htobe64(0);
1128			be64toh(0);
1129		]])],[
1130			ac_cv_have_64bit_byte_order_conversion="yes";
1131		],[
1132			ac_cv_have_64bit_byte_order_conversion="no";
1133		])
1134	]
1135)
1136if test "x$ac_cv_have_64bit_byte_order_conversion" = xyes; then
1137	AC_DEFINE(HAVE_64BIT_BYTE_ORDER_CONVERSION, 1, [htobe64 and be64toh])
1138fi
1139
1140dnl check for compiler characteristics
1141
1142dnl check for functions and methods
1143AC_CHECK_FUNCS(\
1144	rint \
1145	ceilf \
1146	getifaddrs \
1147	gettimeofday \
1148	getpagesize \
1149	getrlimit \
1150	getrusage \
1151	ioctl \
1152	poll \
1153	epoll_create \
1154	signal \
1155	unlink \
1156	sleep \
1157	fork \
1158	strcasecmp \
1159	strncasecmp \
1160	timegm \
1161	pclose \
1162	popen \
1163	inet_makeaddr \
1164	inet_lnaof \
1165	inet_netof \
1166	sched_getaffinity \
1167	sched_setaffinity \
1168	\
1169	_ftime \
1170	_pclose \
1171	_popen \
1172	ioctlsocket \
1173	stat \
1174	stricmp \
1175	strnicmp \
1176	GetLastError \
1177	SetLastError \
1178	WSAStartup \
1179	WSACleanup \
1180	WSAIoctl \
1181	closesocket
1182)
1183
1184AH_TEMPLATE(HAVE_SET_NEW_HANDLER)
1185AC_CACHE_CHECK(for set_new_handler, ac_cv_have_set_new_handler, [
1186	AC_RUN_IFELSE([AC_LANG_SOURCE([[
1187			#include <new>
1188			using namespace std;
1189			static void myHandler() {}
1190			int main() {
1191				set_new_handler(&myHandler);
1192				return 0;
1193			}
1194		]])],[ac_cv_have_set_new_handler="yes"],[ac_cv_have_set_new_handler="no"],[ac_cv_have_set_new_handler="no"])
1195])
1196if test "x$ac_cv_have_set_new_handler" = xyes ; then
1197  AC_DEFINE(HAVE_SET_NEW_HANDLER, 1, [have set_new_handler or std::set_new_handler])
1198fi
1199
1200
1201if test "x$ac_cv_func_sched_getaffinity" = "xyes" -a "x$ac_cv_func_sched_setaffinity" = "xyes" ; then
1202	AC_DEFINE(HAVE_CPU_AFFINITY,1,[Support setting CPU affinity for workers])
1203fi
1204
1205
1206dnl check for system services
1207
1208AH_VERBATIM(DEFAULT_FD_SETSIZE,
1209[/* negative or zero if we failed to detect it */
1210#define DEFAULT_FD_SETSIZE -1])
1211AC_MSG_CHECKING(Default FD_SETSIZE value)
1212AC_RUN_IFELSE([AC_LANG_SOURCE([[
1213	#include <stdio.h>
1214	#include <unistd.h>
1215	#include <sys/time.h>
1216	#include <sys/types.h>
1217	int main() {
1218		fprintf(fopen("conftestval", "w"), "%d\n", FD_SETSIZE);
1219		return 0;
1220	}
1221	]])],[DEFAULT_FD_SETSIZE=`cat conftestval`],[DEFAULT_FD_SETSIZE=-1],[DEFAULT_FD_SETSIZE=-1])
1222AC_MSG_RESULT($DEFAULT_FD_SETSIZE)
1223AC_DEFINE_UNQUOTED(DEFAULT_FD_SETSIZE, $DEFAULT_FD_SETSIZE)
1224
1225AH_VERBATIM(PROBED_MAXFD,
1226[/* negative or zero if no probing has been done or probing failed */
1227#define PROBED_MAXFD -1])
1228AC_MSG_CHECKING(Maximum number of filedescriptors we can open)
1229AC_RUN_IFELSE([AC_LANG_SOURCE([[
1230		/* this ingenuous check is derived from uncopyrighted Squid/configure.in */
1231		#include <stdio.h>
1232		#include <unistd.h>
1233
1234		#include <sys/time.h>	/* needed on FreeBSD */
1235		#include <sys/param.h>
1236		#include <sys/resource.h>
1237
1238		// see SSI_FD_NEWMAX below
1239		#ifdef HAVE_SYS_SYSINFO_H
1240		#include <sys/sysinfo.h>
1241		#endif
1242
1243		int main() {
1244		#ifdef SSI_FD_NEWMAX
1245			if (setsysinfo(SSI_FD_NEWMAX, 0, 0, 0, 1) != 0)
1246				perror("setsysinfo(SSI_FD_NEWMAX)");
1247		#endif
1248
1249		#if defined(RLIMIT_NOFILE) || defined(RLIMIT_OFILE)
1250		#if !defined(RLIMIT_NOFILE)
1251		#define RLIMIT_NOFILE RLIMIT_OFILE
1252		#endif
1253			struct rlimit rl;
1254			if (getrlimit(RLIMIT_NOFILE, &rl) < 0) {
1255				perror("getrlimit: RLIMIT_NOFILE");
1256			} else {
1257			rl.rlim_cur = rl.rlim_max; /* set it to the max */
1258			if (setrlimit(RLIMIT_NOFILE, &rl) < 0)
1259				perror("setrlimit: RLIMIT_NOFILE");
1260			}
1261		#endif /* RLIMIT_NOFILE || RLIMIT_OFILE */
1262
1263			/* by starting at 2^15, we will never exceed 2^16 */
1264			int i,j;
1265			i = j = 1<<15;
1266			while (j) {
1267				j >>= 1;
1268				if (dup2(0, i) < 0) {
1269					i -= j;
1270				} else {
1271					close(i);
1272					i += j;
1273				}
1274			}
1275			i++;
1276			FILE *fp = fopen("conftestval", "w");
1277			fprintf (fp, "%d\n", i);
1278			return 0;
1279		}
1280	]])],[PROBED_MAXFD=`cat conftestval`],[PROBED_MAXFD=-1],[PROBED_MAXFD=-2
1281])
1282AC_MSG_RESULT($PROBED_MAXFD)
1283AC_DEFINE_UNQUOTED(PROBED_MAXFD, $PROBED_MAXFD)
1284
1285dnl various aftershock warnings
1286
1287if test "x$ac_cv_header_regex_h" = xno
1288then
1289	AC_MSG_WARN([
1290		No Regular Expression library header file found (regex.h);
1291		RE-dependent features such as ACL checking will not work.])
1292fi
1293
1294if test "x$ac_cv_header_netinet_ip_dummynet_h" = xyes
1295then
1296	AC_CHECK_TYPES(dn_pipe,
1297		[AC_DEFINE(USE_DUMMYNET, 1, [Defined if supported DummyNet version was found])],
1298		[AC_MSG_WARN([unsupported DummyNet version])], [
1299			#include <sys/types.h>
1300			#include <sys/socket.h>
1301			#include <net/if.h>
1302			#include <netinet/in.h>
1303			#include <netinet/ip_fw.h>
1304			#include <netinet/ip_dummynet.h>
1305		])
1306else
1307	AC_MSG_WARN([
1308		No DummyNet header files found;
1309		piper tool will not be available.])
1310fi
1311
1312if test "x$ac_cv_header_dlfcn_h" = xno -o $HAVE_DLOPEN_SOMEWHERE != yes
1313then
1314	AC_MSG_WARN([
1315		No dl library or dlfcn.h header file found;
1316		dynamically loadable modules will not be supported.])
1317fi
1318
1319if test "x$ac_cv_header_ncurses_h" = xno -o "x$ac_cv_lib_ncurses_main" = xno
1320then
1321	AC_MSG_WARN([
1322		No ncurses library or header files found;
1323		polymon tool will not be available.])
1324fi
1325
1326AX_CREATE_STDINT_H(src/xstd/h/stdint.h)
1327
1328dnl these variables will be substituted in Makefiles
1329AC_SUBST(LIB_DL)
1330AC_SUBST(LIB_CURSES)
1331AC_SUBST(LDFLAG_RDYNAMIC)
1332
1333AC_PROG_MAKE_SET
1334
1335AC_CONFIG_FILES([\
1336	Makefile
1337	src/Makefile \
1338	src/xstd/Makefile \
1339	src/base/Makefile \
1340	src/xml/Makefile \
1341	src/runtime/Makefile \
1342	src/xparser/Makefile \
1343	src/pgl/Makefile \
1344	src/csm/Makefile \
1345	src/dns/Makefile \
1346	src/icp/Makefile \
1347	src/kerberos/Makefile \
1348	src/beep/Makefile \
1349	src/cache/Makefile \
1350	src/app/Makefile \
1351	src/client/Makefile \
1352	src/server/Makefile \
1353	src/logextractors/Makefile \
1354	src/loganalyzers/Makefile \
1355	src/tools/Makefile \
1356	src/probe/Makefile \
1357	src/monitor/Makefile \
1358	tools/Makefile \
1359	workloads/Makefile \
1360	workloads/include/Makefile \
1361	import/Makefile \
1362	import/jqplot/Makefile \
1363	import/jquery-ui/Makefile \
1364	polygraph.man
1365])
1366AC_OUTPUT
1367