xref: /freebsd/contrib/tcpdump/configure.in (revision 6fd05b64b5b65dd4ba9b86482a0634a5f0b96c29)
1dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.169.2.3 2004/03/28 21:04:48 fenner Exp $ (LBL)
2dnl
3dnl Copyright (c) 1994, 1995, 1996, 1997
4dnl	The Regents of the University of California.  All rights reserved.
5dnl
6dnl Process this file with autoconf to produce a configure script.
7dnl
8
9AC_REVISION($Revision: 1.169.2.3 $)
10AC_PREREQ(2.50)
11AC_INIT(tcpdump.c)
12
13AC_CANONICAL_HOST
14
15AC_LBL_C_INIT(V_CCOPT, V_INCLS)
16AC_LBL_C_INLINE
17AC_C___ATTRIBUTE__
18
19AC_CHECK_HEADERS(fcntl.h rpc/rpcent.h netdnet/dnetdb.h netinet/ether.h)
20AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
21#include <sys/socket.h>])
22AC_HEADER_TIME
23
24case "$host_os" in
25
26linux*)
27	AC_MSG_CHECKING(Linux kernel version)
28 	if test "$cross_compiling" = yes; then
29 		AC_CACHE_VAL(ac_cv_linux_vers,
30 		    ac_cv_linux_vers=unknown)
31 	else
32 		AC_CACHE_VAL(ac_cv_linux_vers,
33 		    ac_cv_linux_vers=`uname -r 2>&1 | \
34 			sed -n -e '$s/.* //' -e '$s/\..*//p'`)
35 	fi
36	AC_MSG_RESULT($ac_cv_linux_vers)
37 	if test $ac_cv_linux_vers = unknown ; then
38 		AC_MSG_ERROR(cannot determine linux version when cross-compiling)
39 	fi
40	if test $ac_cv_linux_vers -lt 2 ; then
41		AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
42	fi
43	;;
44
45*)
46	;;
47esac
48
49
50AC_CHECK_HEADERS(smi.h)
51AC_CHECK_LIB(smi, smiInit)
52if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes
53then
54AC_MSG_CHECKING([whether to enable libsmi])
55        AC_TRY_RUN([ /* libsmi available check */
56#include <smi.h>
57main()
58{
59  int current, revision, age, n;
60  const int required = 2;
61  if (smiInit(""))
62    exit(1);
63  if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
64    exit(2);
65  n = sscanf(smi_library_version, "%d:%d:%d", &current, &revision, &age);
66  if (n != 3)
67    exit(3);
68  if (required < current - age || required > current)
69    exit(4);
70  exit(0);
71}
72],
73[ AC_MSG_RESULT(yes)
74  AC_DEFINE(LIBSMI)
75  libsmi=yes],
76dnl autoconf documentation says that $? contains the exit value.
77dnl reality is that it does not.  We leave this in just in case
78dnl autoconf ever comes back to match the documentation.
79[ case $? in
80  1) AC_MSG_RESULT(no - smiInit failed) ;;
81  2) AC_MSG_RESULT(no - header/library version mismatch) ;;
82  3) AC_MSG_RESULT(no - can't determine library version) ;;
83  4) AC_MSG_RESULT(no - too old) ;;
84  *) AC_MSG_RESULT(no) ;;
85  esac
86  libsmi=no],
87[ AC_MSG_RESULT(not when cross-compiling)
88  libsmi=no]
89)
90fi
91
92AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
93AC_ARG_ENABLE(smb,
94[  --enable-smb            enable possibly-buggy SMB printer [default=yes]
95  --disable-smb           disable possibly-buggy SMB printer],,
96   enableval=yes)
97case "$enableval" in
98yes)	AC_MSG_RESULT(yes)
99	AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
100	AC_DEFINE(TCPDUMP_DO_SMB)
101	LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
102	;;
103*)	AC_MSG_RESULT(no)
104	;;
105esac
106
107AC_MSG_CHECKING([whether to enable ipv6])
108AC_ARG_ENABLE(ipv6,
109[  --enable-ipv6           enable ipv6 (with ipv4) support
110  --disable-ipv6          disable ipv6 support],
111[ case "$enableval" in
112yes)   AC_MSG_RESULT(yes)
113       LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
114       AC_DEFINE(INET6)
115       ipv6=yes
116       ;;
117*)
118       AC_MSG_RESULT(no)
119       ipv6=no
120       ;;
121  esac ],
122
123  AC_TRY_RUN([ /* AF_INET6 available check */
124#include <sys/types.h>
125#include <sys/socket.h>
126main()
127{
128 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
129   exit(1);
130 else
131   exit(0);
132}
133],
134[ AC_MSG_RESULT(yes)
135  LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c $LOCALSRC"
136  AC_DEFINE(INET6)
137  ipv6=yes],
138[ AC_MSG_RESULT(no)
139  ipv6=no],
140[ AC_MSG_RESULT(no)
141  ipv6=no]
142))
143
144ipv6type=unknown
145ipv6lib=none
146ipv6trylibc=no
147
148if test "$ipv6" = "yes"; then
149	AC_MSG_CHECKING([ipv6 stack type])
150	for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
151		case $i in
152		inria)
153			dnl http://www.kame.net/
154			AC_EGREP_CPP(yes,
155[#include <netinet/in.h>
156#ifdef IPV6_INRIA_VERSION
157yes
158#endif],
159				[ipv6type=$i;
160				CFLAGS="-DINET6 $CFLAGS"])
161			;;
162		kame)
163			dnl http://www.kame.net/
164			AC_EGREP_CPP(yes,
165[#include <netinet/in.h>
166#ifdef __KAME__
167yes
168#endif],
169				[ipv6type=$i;
170				ipv6lib=inet6;
171				ipv6libdir=/usr/local/v6/lib;
172				ipv6trylibc=yes;
173				CFLAGS="-DINET6 $CFLAGS"])
174			;;
175		linux-glibc)
176			dnl http://www.v6.linux.or.jp/
177			AC_EGREP_CPP(yes,
178[#include <features.h>
179#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
180yes
181#endif],
182				[ipv6type=$i;
183				CFLAGS="-DINET6 $CFLAGS"])
184			;;
185		linux-libinet6)
186			dnl http://www.v6.linux.or.jp/
187			dnl
188			dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
189			dnl and possibly other versions of those OSes
190			dnl
191			if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
192				ipv6type=$i
193				ipv6lib=inet6
194				ipv6libdir=/usr/inet6/lib
195				ipv6trylibc=yes;
196				CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
197			fi
198			;;
199		toshiba)
200			AC_EGREP_CPP(yes,
201[#include <sys/param.h>
202#ifdef _TOSHIBA_INET6
203yes
204#endif],
205				[ipv6type=$i;
206				ipv6lib=inet6;
207				ipv6libdir=/usr/local/v6/lib;
208				CFLAGS="-DINET6 $CFLAGS"])
209			;;
210		v6d)
211			AC_EGREP_CPP(yes,
212[#include </usr/local/v6/include/sys/v6config.h>
213#ifdef __V6D__
214yes
215#endif],
216				[ipv6type=$i;
217				ipv6lib=v6;
218				ipv6libdir=/usr/local/v6/lib;
219				CFLAGS="-I/usr/local/v6/include $CFLAGS"])
220			;;
221		zeta)
222			AC_EGREP_CPP(yes,
223[#include <sys/param.h>
224#ifdef _ZETA_MINAMI_INET6
225yes
226#endif],
227				[ipv6type=$i;
228				ipv6lib=inet6;
229				ipv6libdir=/usr/local/v6/lib;
230				CFLAGS="-DINET6 $CFLAGS"])
231			;;
232		esac
233		if test "$ipv6type" != "unknown"; then
234			break
235		fi
236	done
237	AC_MSG_RESULT($ipv6type)
238fi
239
240if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
241	if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
242		LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
243		echo "You have $ipv6lib library, using it"
244	else
245		if test "$ipv6trylibc" = "yes"; then
246			echo "You do not have $ipv6lib library, using libc"
247		else
248			echo 'Fatal: no $ipv6lib library found.  cannot continue.'
249			echo "You need to fetch lib$ipv6lib.a from appropriate"
250			echo 'ipv6 kit and compile beforehand.'
251			exit 1
252		fi
253	fi
254fi
255
256
257if test "$ipv6" = "yes"; then
258	#
259	# XXX - on Tru64 UNIX 5.1, there is no "getaddrinfo()"
260	# function in libc; there are "ngetaddrinfo()" and
261	# "ogetaddrinfo()" functions, and <netdb.h> #defines
262	# "getaddrinfo" to be either "ngetaddrinfo" or
263	# "ogetaddrinfo", depending on whether _SOCKADDR_LEN
264	# or _XOPEN_SOURCE_EXTENDED are defined or not.
265	#
266	# So this test doesn't work on Tru64 5.1, and possibly
267	# on other 5.x releases.  This causes the configure
268	# script to become confused, and results in libpcap
269	# being unbuildable.
270	#
271	AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
272	AC_MSG_CHECKING(getaddrinfo bug)
273	AC_CACHE_VAL(td_cv_buggygetaddrinfo, [AC_TRY_RUN([
274#include <sys/types.h>
275#include <netdb.h>
276#include <string.h>
277#include <sys/socket.h>
278#include <netinet/in.h>
279
280main()
281{
282  int passive, gaierr, inet4 = 0, inet6 = 0;
283  struct addrinfo hints, *ai, *aitop;
284  char straddr[INET6_ADDRSTRLEN], strport[16];
285
286  for (passive = 0; passive <= 1; passive++) {
287    memset(&hints, 0, sizeof(hints));
288    hints.ai_family = AF_UNSPEC;
289    hints.ai_flags = passive ? AI_PASSIVE : 0;
290    hints.ai_socktype = SOCK_STREAM;
291    hints.ai_protocol = IPPROTO_TCP;
292    if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
293      (void)gai_strerror(gaierr);
294      goto bad;
295    }
296    for (ai = aitop; ai; ai = ai->ai_next) {
297      if (ai->ai_addr == NULL ||
298          ai->ai_addrlen == 0 ||
299          getnameinfo(ai->ai_addr, ai->ai_addrlen,
300                      straddr, sizeof(straddr), strport, sizeof(strport),
301                      NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
302        goto bad;
303      }
304      switch (ai->ai_family) {
305      case AF_INET:
306        if (strcmp(strport, "54321") != 0) {
307          goto bad;
308        }
309        if (passive) {
310          if (strcmp(straddr, "0.0.0.0") != 0) {
311            goto bad;
312          }
313        } else {
314          if (strcmp(straddr, "127.0.0.1") != 0) {
315            goto bad;
316          }
317        }
318        inet4++;
319        break;
320      case AF_INET6:
321        if (strcmp(strport, "54321") != 0) {
322          goto bad;
323        }
324        if (passive) {
325          if (strcmp(straddr, "::") != 0) {
326            goto bad;
327          }
328        } else {
329          if (strcmp(straddr, "::1") != 0) {
330            goto bad;
331          }
332        }
333        inet6++;
334        break;
335      case AF_UNSPEC:
336        goto bad;
337        break;
338#ifdef AF_UNIX
339      case AF_UNIX:
340#else
341#ifdef AF_LOCAL
342      case AF_LOCAL:
343#endif
344#endif
345      default:
346        /* another family support? */
347        break;
348      }
349    }
350  }
351
352  /* supported family should be 2, unsupported family should be 0 */
353  if (!(inet4 == 0 || inet4 == 2))
354    goto bad;
355  if (!(inet6 == 0 || inet6 == 2))
356    goto bad;
357
358  if (aitop)
359    freeaddrinfo(aitop);
360  exit(0);
361
362 bad:
363  if (aitop)
364    freeaddrinfo(aitop);
365  exit(1);
366}
367],
368	td_cv_buggygetaddrinfo=no,
369	td_cv_buggygetaddrinfo=yes,
370	td_cv_buggygetaddrinfo=yes)])
371	if test "$td_cv_buggygetaddrinfo" = no; then
372		AC_MSG_RESULT(good)
373	else
374		AC_MSG_RESULT(buggy)
375	fi
376
377	if test "$td_cv_buggygetaddrinfo" = "yes"; then
378		#
379		# XXX - it doesn't appear that "ipv6type" can ever be
380		# set to "linux".  Should this be testing for
381		# "linux-glibc", or for that *or* "linux-libinet6"?
382		# If the latter, note that "linux-libinet6" is also
383		# the type given to some non-Linux OSes.
384		#
385		if test "$ipv6type" != "linux"; then
386			echo 'Fatal: You must get working getaddrinfo() function.'
387			echo '       or you can specify "--disable-ipv6"'.
388			exit 1
389		else
390			echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
391			echo '         Better upgrade your system library to newest version'
392			echo '         of GNU C library (aka glibc).'
393		fi
394	fi
395	])
396	AC_REPLACE_FUNCS(getaddrinfo getnameinfo)
397fi
398
399AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
400[td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
401[AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
402	td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes,
403	td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)])
404if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
405	AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA)
406fi
407
408dnl
409dnl check sizeof basic types.
410dnl They're very likely to be wrong for cross-compiling.
411AC_CHECK_SIZEOF(char, 1)
412AC_CHECK_SIZEOF(short, 2)
413AC_CHECK_SIZEOF(int, 4)
414AC_CHECK_SIZEOF(long, 4)
415
416dnl
417dnl Checks for u_intXX_t
418dnl AC_CHECK_BITTYPES(ac_cv_bittypes)
419dnl if test "$ac_cv_bittypes" = no; then
420dnl 	missing_includes=yes
421dnl fi
422
423dnl
424dnl Checks for addrinfo structure
425AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
426if test "$ac_cv_addrinfo" = no; then
427	missing_includes=yes
428fi
429
430dnl
431dnl Checks for NI_MAXSERV
432AC_NI_MAXSERV(ac_cv_maxserv)
433if test "$ac_cv_maxserv" = no; then
434	missing_includes=yes
435fi
436
437dnl
438dnl Checks for NI_NAMEREQD
439AC_NI_NAMEREQD(ac_cv_namereqd)
440if test "$ac_cv_namereqd" = no; then
441	missing_includes=yes
442fi
443
444dnl
445dnl Checks for sockaddr_storage structure
446AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
447if test "$ac_cv_sa_storage" = no; then
448	missing_includes=yes
449fi
450
451dnl
452dnl Checks for IN[6]ADDRSZ
453AC_CHECK_ADDRSZ(ac_cv_addrsz)
454if test "$ac_cv_addrsz" = no; then
455	missing_includes=yes
456fi
457
458dnl
459dnl Checks for RES_USE_INET6
460AC_CHECK_RES_USE_INET6(ac_cv_res_inet6)
461if test "$ac_cv_res_inet6" = no; then
462	missing_includes=yes
463fi
464
465dnl
466dnl Checks for res_state_ext structure
467AC_STRUCT_RES_STATE_EXT(ac_cv_res_state_ext)
468if test "$ac_cv_res_state_ext" = no; then
469	missing_includes=yes
470fi
471
472dnl
473dnl Checks if res_state structure has nsort member.
474AC_STRUCT_RES_STATE(ac_cv_res_state)
475
476dnl
477dnl set additional include path if necessary
478if test "$missing_includes" = "yes"; then
479	CPPFLAGS="$CPPFLAGS -I\$(srcdir)/missing"
480	V_INCLS="$V_INCLS -I\$(srcdir)/missing"
481fi
482
483
484AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep)
485AC_CHECK_FUNCS(strftime)
486AC_CHECK_FUNCS(ether_ntohost, [
487    AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
488	AC_TRY_RUN([
489		#include <netdb.h>
490		#include <sys/types.h>
491		#include <sys/param.h>
492		#include <sys/socket.h>
493
494		int
495		main(int argc, char **argv)
496		{
497			u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
498			char name[MAXHOSTNAMELEN];
499
500			ether_ntohost(name, (struct ether_addr *)ea);
501			exit(0);
502		}
503	], [ac_cv_buggy_ether_ntohost=no],
504	   [ac_cv_buggy_ether_ntohost=yes],
505	   [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
506    if test "$ac_cv_buggy_ether_ntohost" = "no"; then
507	AC_DEFINE(USE_ETHER_NTOHOST)
508    fi
509])
510AC_CHECK_FUNCS(setlinebuf)
511
512needsnprintf=no
513AC_CHECK_FUNCS(vsnprintf snprintf,,
514	[needsnprintf=yes])
515if test $needsnprintf = yes; then
516	AC_LIBOBJ(snprintf.o)
517fi
518
519AC_LBL_TYPE_SIGNAL
520
521AC_SEARCH_LIBS(dnet_htoa, dnet, AC_DEFINE(HAVE_DNET_HTOA))
522
523AC_CHECK_LIB(rpc, main)		dnl It's unclear why we might need -lrpc
524
525dnl HP/UX may need -lnsl for getrpcbynumber.
526AC_SEARCH_LIBS(getrpcbynumber, nsl)
527
528dnl AC_CHECK_LIB(z, uncompress)
529dnl AC_CHECK_HEADERS(zlib.h)
530
531AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
532
533#
534# Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
535# libraries (e.g., "-lsocket -lnsl" on Solaris).
536#
537# We don't use AC_REPLACE_FUNCS because that uses AC_CHECK_FUNCS which
538# use AC_CHECK_FUNC which doesn't let us specify the right #includes
539# to make this work on BSD/OS 4.x.  BSD/OS 4.x ships with the BIND8
540# resolver, and the way it defines inet_{ntop,pton} is rather strange;
541# it does not ship with a libc symbol "inet_ntop()", it ships with
542# "_inet_ntop()", and has a #define macro in one of the system headers
543# to rename it.
544#
545dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
546AC_MSG_CHECKING(for inet_ntop)
547AC_TRY_LINK([#include <sys/types.h>
548#include <sys/socket.h>
549#include <netinet/in.h>
550#include <arpa/inet.h>], [char src[4], dst[128];
551inet_ntop(AF_INET, src, dst, sizeof(dst));],
552	[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
553	AC_LIBOBJ(inet_ntop.o)])
554AC_MSG_CHECKING(for inet_pton)
555AC_TRY_LINK([#include <sys/types.h>
556#include <sys/socket.h>
557#include <netinet/in.h>
558#include <arpa/inet.h>], [char src[128], dst[4];
559inet_pton(AF_INET, src, dst);],
560	[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
561	AC_LIBOBJ(inet_pton.o)])
562AC_MSG_CHECKING(for inet_aton)
563AC_TRY_LINK([#include <sys/types.h>
564#include <netinet/in.h>
565#include <arpa/inet.h>], [char src[128];
566struct in_addr dst;
567inet_aton(src, &dst);],
568	[AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
569	AC_LIBOBJ(inet_aton.o)])
570
571dnl portability macros for getaddrinfo/getnameinfo
572dnl
573dnl Check for sa_len
574AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
575if test "$ac_cv_sockaddr_has_sa_len" = no; then
576	missing_includes=yes
577fi
578
579AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version)
580if test $ac_cv_func_pcap_findalldevs = "yes" ; then
581dnl Check for MacOS X, which may ship pcap.h from 0.6 but libpcap may
582dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
583dnl have pcap_if_t.
584    AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
585fi
586if test $ac_cv_func_pcap_lib_version = "no" ; then
587    AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
588    AC_TRY_LINK([],
589       [
590char *
591return_pcap_version(void)
592{
593	extern char pcap_version[];
594
595	return pcap_version;
596}
597       ],
598       ac_lbl_cv_pcap_version_defined=yes,
599       ac_lbl_cv_pcap_version_defined=no)
600    if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
601    	AC_MSG_RESULT(yes)
602	AC_DEFINE(HAVE_PCAP_VERSION)
603    else
604	AC_MSG_RESULT(no)
605    fi
606fi
607AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
608AC_TRY_LINK([],
609   [
610int
611return_pcap_debug(void)
612{
613	extern int pcap_debug;
614
615	return pcap_debug;
616}
617   ],
618   ac_lbl_cv_pcap_debug_defined=yes,
619   ac_lbl_cv_pcap_debug_defined=no)
620if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
621	AC_MSG_RESULT(yes)
622	AC_DEFINE(HAVE_PCAP_DEBUG)
623else
624	AC_MSG_RESULT(no)
625	#
626	# OK, what about "yydebug"?
627	#
628	AC_MSG_CHECKING(whether yydebug is defined by libpcap)
629	AC_TRY_LINK([],
630	   [
631	int
632	return_yydebug(void)
633	{
634		extern int yydebug;
635
636		return yydebug;
637	}
638	   ],
639	   ac_lbl_cv_yydebug_defined=yes,
640	   ac_lbl_cv_yydebug_defined=no)
641	if test "$ac_lbl_cv_yydebug_defined" = yes ; then
642		AC_MSG_RESULT(yes)
643		AC_DEFINE(HAVE_YYDEBUG)
644	else
645		AC_MSG_RESULT(no)
646	fi
647fi
648AC_REPLACE_FUNCS(bpf_dump)	dnl moved to libpcap in 0.6
649
650V_GROUP=0
651if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
652	V_GROUP=wheel
653fi
654case "$host_os" in
655
656aix*)
657	dnl Workaround to enable certain features
658	AC_DEFINE(_SUN)
659	;;
660
661irix*)
662	V_GROUP=sys
663	;;
664
665osf*)
666	V_GROUP=system
667	;;
668
669solaris*)
670	V_GROUP=sys
671	;;
672esac
673
674if test -f /dev/bpf0 ; then
675	V_GROUP=bpf
676fi
677
678AC_LBL_CHECK_TYPE(int8_t, signed char)
679AC_LBL_CHECK_TYPE(u_int8_t, u_char)
680AC_LBL_CHECK_TYPE(int16_t, short)
681AC_LBL_CHECK_TYPE(u_int16_t, u_short)
682AC_LBL_CHECK_TYPE(int32_t, int)
683AC_LBL_CHECK_TYPE(u_int32_t, u_int)
684
685AC_LBL_DEVEL(V_CCOPT)
686
687AC_LBL_SOCKADDR_SA_LEN
688
689AC_LBL_UNALIGNED_ACCESS
690
691AC_VAR_H_ERRNO
692
693AC_ARG_WITH(crypto, [  --without-crypto        disable crypto support],
694	[], [
695AC_MSG_CHECKING(for SSLeay)
696ac_cv_ssleay_path=no
697incdir=no
698for dir in /usr/${host_alias} /usr /usr/local /usr/local/ssl /usr/pkg; do
699	#
700	# XXX - is there a better way to check if a given library is
701	# in a given directory than checking each of the possible
702	# shared library suffixes?
703	#
704	# Are there any other suffixes we need to look for?  Do we have to
705	# worry about ".so.{version}"?
706	#
707	# Or should we just look for "libcrypto.*"?
708	#
709	if test -d $dir/lib -a \( -f $dir/lib/libcrypto.a -o \
710			          -f $dir/lib/libcrypto.so -o \
711			          -f $dir/lib/libcrypto.sl -o \
712				  -f $dir/lib/libcrypto.dylib \); then
713		ac_cv_ssleay_path=$dir
714	fi
715	if test -d $dir/include/openssl -a -f $dir/include/openssl/des.h; then
716		incdir="-I$dir/include"
717	fi
718	if test "$ac_cv_ssleay_path" != "no" -a "$incdir" != "no"; then
719		break;
720	else
721		ac_cv_ssleay_path=no
722		incdir=no
723	fi
724done
725AC_MSG_RESULT($ac_cv_ssleay_path)
726if test "$ac_cv_ssleay_path" != no; then
727	V_INCLS="$V_INCLS $incdir"
728	LDFLAGS="-L$dir/lib $LDFLAGS"
729	if test -f $ac_cv_ssleay_path/lib/libRSAglue.a; then
730		LIBS="$LIBS -lRSAglue"
731	fi
732	if test -f $ac_cv_ssleay_path/lib/librsaref.a; then
733		LIBS="$LIBS -lrsaref"
734	fi
735	AC_CHECK_LIB(crypto, des_cbc_encrypt)
736
737	CPPFLAGS="$CPPFLAGS $V_INCLS"
738	AC_CHECK_HEADERS(openssl/evp.h)
739fi
740])
741
742AC_SUBST(V_CCOPT)
743AC_SUBST(V_DEFS)
744AC_SUBST(V_GROUP)
745AC_SUBST(V_INCLS)
746AC_SUBST(V_PCAPDEP)
747AC_SUBST(LOCALSRC)
748
749AC_PROG_INSTALL
750
751AC_CONFIG_HEADER(config.h)
752
753AC_OUTPUT_COMMANDS([if test -f .devel; then
754	echo timestamp > stamp-h
755	cat Makefile-devel-adds >> Makefile
756	make depend
757fi])
758AC_OUTPUT(Makefile)
759exit 0
760