• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl @(#) $Header: /tcpdump/master/libpcap/configure.in,v 1.120.2.13 2007/09/12 19:17:24 guy 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.120.2.13 $)
10AC_PREREQ(2.50)
11AC_INIT(pcap.c)
12
13AC_CANONICAL_SYSTEM
14
15AC_LBL_C_INIT(V_CCOPT, V_INCLS, V_LIBS)
16AC_LBL_C_INLINE
17AC_C___ATTRIBUTE__
18
19AC_LBL_CHECK_TYPE(u_int8_t, u_char)
20AC_LBL_CHECK_TYPE(u_int16_t, u_short)
21AC_LBL_CHECK_TYPE(u_int32_t, u_int)
22
23dnl
24dnl libpcap doesn't itself use <sys/ioccom.h>; however, the test program
25dnl in "AC_LBL_FIXINCLUDES" in "aclocal.m4" uses it, so we have to
26dnl test for it and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise
27dnl "AC_LBL_FIXINCLUDES" won't work on some platforms such as Solaris.
28dnl
29AC_CHECK_HEADERS(sys/ioccom.h sys/sockio.h limits.h paths.h)
30AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
31#include <sys/socket.h>
32#include <net/if.h>])
33AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
34#include <sys/socket.h>])
35if test "$ac_cv_header_netinet_if_ether_h" != yes; then
36	#
37	# The simple test didn't work.
38	# Do we need to include <net/if.h> first?
39	# Unset ac_cv_header_netinet_if_ether_h so we don't
40	# treat the previous failure as a cached value and
41	# suppress the next test.
42	#
43	AC_MSG_NOTICE([Rechecking with some additional includes])
44	unset ac_cv_header_netinet_if_ether_h
45	AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
46#include <sys/socket.h>
47#include <netinet/in.h>
48struct mbuf;
49struct rtentry;
50#include <net/if.h>])
51fi
52
53AC_LBL_FIXINCLUDES
54
55AC_CHECK_FUNCS(strerror strlcpy)
56
57needsnprintf=no
58AC_CHECK_FUNCS(vsnprintf snprintf,,
59	[needsnprintf=yes])
60if test $needsnprintf = yes; then
61	AC_LIBOBJ(snprintf)
62fi
63
64#
65# Do this before checking for ether_hostton(), as it's a
66# "gethostbyname() -ish function".
67#
68AC_LBL_LIBRARY_NET
69
70#
71# You are in a twisty little maze of UN*Xes, all different.
72# Some might not have ether_hostton().
73# Some might have it, but not declare it in any header file.
74# Some might have it, but declare it in <netinet/if_ether.h>.
75# Some might have it, but declare it in <netinet/ether.h>
76# (And some might have it but document it as something declared in
77# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
78#
79# Before you is a C compiler.
80#
81AC_CHECK_FUNCS(ether_hostton)
82if test "$ac_cv_func_ether_hostton" = yes; then
83	#
84	# OK, we have ether_hostton().  Do we have <netinet/if_ether.h>?
85	#
86	if test "$ac_cv_header_netinet_if_ether_h" = yes; then
87		#
88		# Yes.  Does it declare ether_hostton()?
89		#
90		AC_CHECK_DECL(ether_hostton,
91		    [
92			AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,,
93			    [Define to 1 if netinet/if_ether.h declares `ether_hostton'])
94		    ],,
95		    [
96#include <sys/types.h>
97#include <sys/socket.h>
98#include <netinet/in.h>
99#include <arpa/inet.h>
100struct mbuf;
101struct rtentry;
102#include <net/if.h>
103#include <netinet/if_ether.h>
104		    ])
105	fi
106	#
107	# Did that succeed?
108	#
109	if test "$ac_cv_have_decl_ether_hostton" != yes; then
110		#
111		# No, how about <netinet/ether.h>, as on Linux?
112		#
113		AC_CHECK_HEADERS(netinet/ether.h)
114		if test "$ac_cv_header_netinet_ether_h" = yes; then
115			#
116			# We have it - does it declare ether_hostton()?
117			# Unset ac_cv_have_decl_ether_hostton so we don't
118			# treat the previous failure as a cached value and
119			# suppress the next test.
120			#
121			unset ac_cv_have_decl_ether_hostton
122			AC_CHECK_DECL(ether_hostton,
123			    [
124				AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,,
125				    [Define to 1 if netinet/ether.h declares `ether_hostton'])
126			    ],,
127			    [
128#include <netinet/ether.h>
129			    ])
130		fi
131	fi
132	#
133	# Is ether_hostton() declared?
134	#
135	if test "$ac_cv_have_decl_ether_hostton" != yes; then
136		#
137		# No, we'll have to declare it ourselves.
138		# Do we have "struct ether_addr"?
139		#
140		AC_CHECK_TYPES(struct ether_addr,,,
141		    [
142#include <sys/types.h>
143#include <sys/socket.h>
144#include <netinet/in.h>
145#include <arpa/inet.h>
146struct mbuf;
147struct rtentry;
148#include <net/if.h>
149#include <netinet/if_ether.h>
150		    ])
151		AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0,
152		    [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
153don't.])
154	else
155		AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1,
156		    [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you
157don't.])
158	fi
159fi
160
161dnl to pacify those who hate protochain insn
162AC_MSG_CHECKING(if --disable-protochain option is specified)
163AC_ARG_ENABLE(protochain, [  --disable-protochain    disable \"protochain\" insn])
164case "x$enable_protochain" in
165xyes)	enable_protochain=enabled	;;
166xno)	enable_protochain=disabled	;;
167x)	enable_protochain=enabled	;;
168esac
169
170if test "$enable_protochain" = "disabled"; then
171	AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain])
172fi
173AC_MSG_RESULT(${enable_protochain})
174
175dnl
176dnl Not all versions of test support -c (character special) but it's a
177dnl better way of testing since the device might be protected. So we
178dnl check in our normal order using -r and then check the for the /dev
179dnl guys again using -c.
180dnl
181dnl XXX This could be done for cross-compiling, but for now it's not.
182dnl
183if test -z "$with_pcap" && test "$cross_compiling" = yes; then
184	AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...)
185fi
186AC_ARG_WITH(pcap, [  --with-pcap=TYPE        use packet capture TYPE])
187AC_MSG_CHECKING(packet capture type)
188if test ! -z "$with_pcap" ; then
189	V_PCAP="$withval"
190elif test -r /dev/bpf ; then
191	#
192	# Cloning BPF device.
193	#
194	V_PCAP=bpf
195	AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device])
196elif test -r /dev/bpf0 ; then
197	V_PCAP=bpf
198elif test -r /usr/include/net/pfilt.h ; then
199	V_PCAP=pf
200elif test -r /dev/enet ; then
201	V_PCAP=enet
202elif test -r /dev/nit ; then
203	V_PCAP=snit
204elif test -r /usr/include/sys/net/nit.h ; then
205	V_PCAP=nit
206elif test -r /usr/include/linux/socket.h ; then
207	V_PCAP=linux
208elif test -r /usr/include/net/raw.h ; then
209	V_PCAP=snoop
210elif test -r /usr/include/odmi.h ; then
211	#
212	# On AIX, the BPF devices might not yet be present - they're
213	# created the first time libpcap runs after booting.
214	# We check for odmi.h instead.
215	#
216	V_PCAP=bpf
217elif test -r /usr/include/sys/dlpi.h ; then
218	V_PCAP=dlpi
219elif test -c /dev/bpf0 ; then		# check again in case not readable
220	V_PCAP=bpf
221elif test -c /dev/enet ; then		# check again in case not readable
222	V_PCAP=enet
223elif test -c /dev/nit ; then		# check again in case not readable
224	V_PCAP=snit
225else
226	V_PCAP=null
227fi
228AC_MSG_RESULT($V_PCAP)
229
230dnl
231dnl Now figure out how we get a list of interfaces and addresses,
232dnl if we support capturing.  Don't bother if we don't support
233dnl capturing.
234dnl
235if test "$V_PCAP" = null
236then
237	#
238	# We can't capture, so we can't open any capture
239	# devices, so we won't return any interfaces.
240	#
241	V_FINDALLDEVS=null
242else
243	AC_CHECK_FUNC(getifaddrs,[
244		#
245		# We have "getifaddrs()"; make sure we have <ifaddrs.h>
246		# as well, just in case some platform is really weird.
247		#
248		AC_CHECK_HEADER(ifaddrs.h,[
249		    #
250		    # We have the header, so we use "getifaddrs()" to
251		    # get the list of interfaces.
252		    #
253		    V_FINDALLDEVS=getad
254		],[
255		    #
256		    # We don't have the header - give up.
257		    # XXX - we could also fall back on some other
258		    # mechanism, but, for now, this'll catch this
259		    # problem so that we can at least try to figure
260		    # out something to do on systems with "getifaddrs()"
261		    # but without "ifaddrs.h", if there is something
262		    # we can do on those systems.
263		    #
264		    AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.])
265		])
266	],[
267		#
268		# Well, we don't have "getifaddrs()", so we have to use
269		# some other mechanism; determine what that mechanism is.
270		#
271		# The first thing we use is the type of capture mechanism,
272		# which is somewhat of a proxy for the OS we're using.
273		#
274		case "$V_PCAP" in
275
276		dlpi)
277			#
278			# This might be Solaris 8 or later, with
279			# SIOCGLIFCONF, or it might be some other OS
280			# or some older version of Solaris, with
281			# just SIOCGIFCONF.
282			#
283			AC_MSG_CHECKING(whether we have SIOCGLIFCONF)
284			AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf,
285			    AC_TRY_COMPILE(
286				[#include <sys/param.h>
287				#include <sys/file.h>
288				#include <sys/ioctl.h>
289				#include <sys/socket.h>
290				#include <sys/sockio.h>],
291				[ioctl(0, SIOCGLIFCONF, (char *)0);],
292				ac_cv_lbl_have_siocglifconf=yes,
293				ac_cv_lbl_have_siocglifconf=no))
294			AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf)
295			if test $ac_cv_lbl_have_siocglifconf = yes ; then
296				V_FINDALLDEVS=glifc
297			else
298				V_FINDALLDEVS=gifc
299			fi
300			;;
301
302		*)
303			#
304			# Assume we just have SIOCGIFCONF.
305			# (XXX - on at least later Linux kernels, there's
306			# another mechanism, and we should be using that
307			# instead.)
308			#
309			V_FINDALLDEVS=gifc
310			;;
311		esac])
312fi
313
314AC_MSG_CHECKING(if --enable-ipv6 option is specified)
315AC_ARG_ENABLE(ipv6, [  --enable-ipv6           build IPv6-capable version])
316if test "$enable_ipv6" = "yes"; then
317	AC_DEFINE(INET6,1,[IPv6])
318fi
319AC_MSG_RESULT(${enable_ipv6-no})
320
321AC_MSG_CHECKING(whether to build optimizer debugging code)
322AC_ARG_ENABLE(optimizer-dbg, [  --enable-optimizer-dbg  build optimizer debugging code])
323if test "$enable_optimizer_dbg" = "yes"; then
324	AC_DEFINE(BDEBUG,1,[Enable optimizer debugging])
325fi
326AC_MSG_RESULT(${enable_optimizer_dbg-no})
327
328AC_MSG_CHECKING(whether to build parser debugging code)
329AC_ARG_ENABLE(yydebug, [  --enable-yydebug        build parser debugging code])
330if test "$enable_yydebug" = "yes"; then
331	AC_DEFINE(YYDEBUG,1,[Enable parser debugging])
332fi
333AC_MSG_RESULT(${enable_yydebug-no})
334
335case "$V_PCAP" in
336
337dlpi)
338	AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h)
339	AC_MSG_CHECKING(for /dev/dlpi device)
340	if test -c /dev/dlpi ; then
341		AC_MSG_RESULT(yes)
342		AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi])
343	else
344		AC_MSG_RESULT(no)
345		dir="/dev/dlpi"
346		AC_MSG_CHECKING(for $dir directory)
347		if test -d $dir ; then
348			AC_MSG_RESULT(yes)
349			AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory])
350		else
351			AC_MSG_RESULT(no)
352		fi
353	fi
354	;;
355
356linux)
357	AC_MSG_CHECKING(Linux kernel version)
358 	if test "$cross_compiling" = yes; then
359 		AC_CACHE_VAL(ac_cv_linux_vers,
360 		    ac_cv_linux_vers=unknown)
361 	else
362 		AC_CACHE_VAL(ac_cv_linux_vers,
363 		    ac_cv_linux_vers=`uname -r 2>&1 | \
364 			sed -n -e '$s/.* //' -e '$s/\..*//p'`)
365 	fi
366	AC_MSG_RESULT($ac_cv_linux_vers)
367 	if test $ac_cv_linux_vers = unknown ; then
368 		AC_MSG_ERROR(cannot determine linux version when cross-compiling)
369 	fi
370	if test $ac_cv_linux_vers -lt 2 ; then
371		AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
372	fi
373	AC_LBL_TPACKET_STATS
374	;;
375
376dag)
377	V_DEFS="$V_DEFS -DDAG_ONLY"
378	;;
379
380septel)
381	V_DEFS="$V_DEFS -DSEPTEL_ONLY"
382	;;
383
384null)
385	AC_MSG_WARN(cannot determine packet capture interface)
386	AC_MSG_WARN((see the INSTALL doc for more info))
387	;;
388
389esac
390
391AC_MSG_CHECKING(whether we have /proc/net/dev)
392if test -r /proc/net/dev ; then
393	ac_cv_lbl_proc_net_dev=yes
394else
395	ac_cv_lbl_proc_net_dev=no
396fi
397if test $ac_cv_lbl_proc_net_dev = yes; then
398	AC_DEFINE(HAVE_PROC_NET_DEV, 1, [define if you have a /proc/net/dev])
399fi
400AC_MSG_RESULT($ac_cv_lbl_proc_net_dev)
401
402# Check for Endace DAG card support.
403AC_ARG_WITH([dag], [  --with-dag[[=DIR]]        include Endace DAG support ("yes", "no" or DIR; default="yes" on BSD and Linux if present)],
404[
405	if test "$withval" = no
406	then
407		# User doesn't want DAG support.
408		want_dag=no
409	elif test "$withval" = yes
410	then
411		# User wants DAG support but hasn't specified a directory.
412		want_dag=yes
413	else
414		# User wants DAG support and has specified a directory, so use the provided value.
415		want_dag=yes
416		dag_root=$withval
417	fi
418],[
419	#
420	# Use DAG API if present, otherwise don't
421	#
422	want_dag=ifpresent
423])
424
425AC_ARG_WITH([dag-includes], [  --with-dag-includes=DIR   Endace DAG include directory],
426[
427	# User wants DAG support and has specified a header directory, so use the provided value.
428	want_dag=yes
429	dag_include_dir=$withval
430],[])
431
432AC_ARG_WITH([dag-libraries], [  --with-dag-libraries=DIR  Endace DAG library directory],
433[
434	# User wants DAG support and has specified a library directory, so use the provided value.
435	want_dag=yes
436	dag_lib_dir=$withval
437],[])
438
439case "$V_PCAP" in
440linux|bpf|dag)
441	#
442	# We support the DAG API if we're on Linux or BSD, or if we're
443	# building a DAG-only libpcap.
444	#
445	;;
446*)
447	#
448	# If the user explicitly requested DAG, tell them it's not
449	# supported.
450	#
451	# If they expressed no preference, don't include it.
452	#
453	if test $want_dag = yes; then
454		AC_MSG_ERROR([DAG support is only available with 'linux' 'bpf' and 'dag' packet capture types])
455	elif test $want_dag = yes; then
456		want_dag=no
457	fi
458	;;
459esac
460
461ac_cv_lbl_dag_api=no
462if test "$want_dag" != no; then
463
464	AC_MSG_CHECKING([whether we have DAG API headers])
465
466	# If necessary, set default paths for DAG API headers and libraries.
467	if test -z "$dag_root"; then
468	    dag_root=/usr/local
469	fi
470
471	if test -z "$dag_include_dir"; then
472		dag_include_dir="$dag_root/include"
473	fi
474
475	if test -z "$dag_lib_dir"; then
476	    dag_lib_dir="$dag_root/lib"
477	fi
478
479	if test -z "$dag_tools_dir"; then
480	    dag_tools_dir="$dag_root/tools"
481		fi
482
483	if test -r $dag_include_dir/dagapi.h; then
484		ac_cv_lbl_dag_api=yes
485	fi
486	AC_MSG_RESULT([$ac_cv_lbl_dag_api ($dag_include_dir)])
487fi
488
489if test $ac_cv_lbl_dag_api = yes; then
490
491	AC_MSG_CHECKING([dagapi.o])
492	dagapi_obj=no
493	if test -r $dag_tools_dir/dagapi.o; then
494		# 2.4.x.
495		dagapi_obj=$dag_tools_dir/dagapi.o
496	elif test -r $dag_lib_dir/dagapi.o; then
497		# 2.5.x.
498		dagapi_obj=$dag_lib_dir/dagapi.o
499	elif test -r $dag_lib_dir/libdag.a; then
500		# 2.5.x.
501		ar x $dag_lib_dir/libdag.a dagapi.o
502		if test -r ./dagapi.o; then
503		    dagapi_obj=./dagapi.o
504		else
505		    ar x $dag_lib_dir/libdag.a libdag_la-dagapi.o
506		    if test -r ./libdag_la-dagapi.o; then
507		       dagapi_obj=./libdag_la-dagapi.o
508		    fi
509		fi
510	fi
511
512	if test $dagapi_obj = no; then
513		AC_MSG_RESULT([no (checked $dag_lib_dir  $dag_tools_dir  $dag_lib_dir/libdag.a)])
514			ac_cv_lbl_dag_api=no
515	else
516		AC_MSG_RESULT([yes ($dagapi_obj)])
517	fi
518fi
519
520if test $ac_cv_lbl_dag_api = yes; then
521
522	AC_MSG_CHECKING([dagopts.o])
523	dagopts_obj=no
524	if test -r $dag_tools_dir/dagopts.o; then
525		# 2.4.x.
526		dagopts_obj=$dag_tools_dir/dagopts.o
527	elif test -r $dag_lib_dir/dagopts.o; then
528		# 2.5.x.
529		dagopts_obj=$dag_lib_dir/dagopts.o
530	elif test -r $dag_lib_dir/libdag.a; then
531		# 2.5.x.
532		ar x $dag_lib_dir/libdag.a dagopts.o
533		if test -r ./dagopts.o; then
534		    dagopts_obj=./dagopts.o
535		else
536		    ar x $dag_lib_dir/libdag.a libdag_la-dagopts.o
537		    if test -r ./libdag_la-dagopts.o; then
538		       dagopts_obj=./libdag_la-dagopts.o
539		    fi
540		fi
541	fi
542
543	if test $dagopts_obj = no; then
544		AC_MSG_RESULT([no (checked $dag_lib_dir  $dag_tools_dir  $dag_lib_dir/libdag.a)])
545		ac_cv_lbl_dag_api=no
546	else
547		AC_MSG_RESULT([yes ($dagopts_obj)])
548	fi
549fi
550
551if test $ac_cv_lbl_dag_api = yes; then
552	# Under 2.5.x only we need to add dagreg.o.
553	if test -r $dag_include_dir/dagreg.h; then
554		AC_MSG_CHECKING([dagreg.o])
555		dagreg_obj=no
556		if test -r $dag_lib_dir/dagreg.o; then
557			# Object file is ready and waiting.
558			dagreg_obj=$dag_lib_dir/dagreg.o
559		elif test -r $dag_lib_dir/libdag.a; then
560			# Extract from libdag.a.
561			ar x $dag_lib_dir/libdag.a dagreg.o
562			if test -r ./dagreg.o; then
563				dagreg_obj=./dagreg.o
564			else
565				ar x $dag_lib_dir/libdag.a libdag_la-dagreg.o
566				if test -r ./libdag_la-dagreg.o; then
567				   dagreg_obj=./libdag_la-dagreg.o
568				fi
569			fi
570		fi
571
572		if test $dagreg_obj = no; then
573			AC_MSG_RESULT([no (checked $dag_lib_dir  $dag_lib_dir/libdag.a)])
574			ac_cv_lbl_dag_api=no
575		else
576			AC_MSG_RESULT([yes ($dagreg_obj)])
577		fi
578	fi
579fi
580
581if test $ac_cv_lbl_dag_api = yes; then
582	V_INCLS="$V_INCLS -I$dag_include_dir"
583	V_LIBS="$V_LIBS $dagapi_obj $dagopts_obj $dagreg_obj"
584	if test $V_PCAP != dag ; then
585		 SSRC="pcap-dag.c"
586	fi
587
588	# See if we can find a general version string.
589	# Don't need to save and restore LIBS to prevent -ldag being
590	# included if there's a found-action (arg 3).
591	saved_ldflags=$LDFLAGS
592	LDFLAGS="-L$dag_lib_dir"
593	AC_CHECK_LIB([dag], [dag_attach_stream], [dag_version="2.5.x"], [dag_version="2.4.x"])
594	AC_CHECK_LIB([dag],[dag_get_erf_types], [
595		AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])]
596	)
597	LDFLAGS=$saved_ldflags
598
599	if test "$dag_version" = 2.5.x; then
600		AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API])
601		DAGLIBS="-ldag"
602	fi
603
604	# See if we can find a specific version string.
605	AC_MSG_CHECKING([the DAG API version])
606	if test -r "$dag_root/VERSION"; then
607		dag_version="`cat $dag_root/VERSION`"
608	fi
609	AC_MSG_RESULT([$dag_version])
610	AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
611fi
612
613if test $ac_cv_lbl_dag_api = no; then
614	if test "$want_dag" = yes; then
615        	# User wanted DAG support but we couldn't find it.
616		AC_MSG_ERROR([DAG API requested, but not found at $dag_root: use --without-dag])
617	fi
618
619	if test "$V_PCAP" = dag; then
620		# User requested "dag" capture type but the DAG API wasn't
621		# found.
622		AC_MSG_ERROR([Specifying the capture type as "dag" requires the DAG API to be present; use the --with-dag options to specify the location. (Try "./configure --help" for more information.)])
623	fi
624fi
625
626AC_ARG_WITH(septel, [  --with-septel[[=DIR]]     include Septel support (located in directory DIR, if supplied).  [default=yes, on Linux, if present]],
627[
628	if test "$withval" = no
629	then
630		want_septel=no
631	elif test "$withval" = yes
632	then
633		want_septel=yes
634		septel_root=
635	else
636		want_septel=yes
637		septel_root=$withval
638	fi
639],[
640	#
641	# Use Septel API if present, otherwise don't
642	#
643	want_septel=ifpresent
644	septel_root=./../septel
645])
646ac_cv_lbl_septel_api=no
647case "$V_PCAP" in
648linux|septel)
649	#
650	# We support the Septel API if we're on Linux, or if we're building
651	# a Septel-only libpcap.
652	#
653	;;
654*)
655	#
656	# If the user explicitly requested Septel, tell them it's not
657	# supported.
658	#
659	# If they expressed no preference, don't include it.
660	#
661	if test $want_septel = yes; then
662		AC_MSG_ERROR(Septel support only available with 'linux' and 'septel' packet capture types)
663	elif test $want_septel = yes; then
664		want_septel=no
665	fi
666	;;
667esac
668
669if test "$with_septel" != no; then
670	AC_MSG_CHECKING(whether we have Septel API)
671
672	if test -z "$septel_root"; then
673		septel_root=$srcdir/../septel
674
675	fi
676
677	septel_tools_dir="$septel_root"
678	septel_include_dir="$septel_root/INC"
679	DEF="-DHAVE_SEPTEL_API"
680
681	ac_cv_lbl_septel_api=no
682	if test -r "$septel_include_dir/msg.h"; then
683		V_INCLS="$V_INCLS -I$septel_include_dir"
684		V_DEFS="$V_DEFS $DEF"
685		V_LIBS="$V_LIBS $septel_tools_dir/asciibin.o $septel_tools_dir/bit2byte.o $septel_tools_dir/confirm.o $septel_tools_dir/fmtmsg.o $septel_tools_dir/gct_unix.o $septel_tools_dir/hqueue.o $septel_tools_dir/ident.o $septel_tools_dir/mem.o $septel_tools_dir/pack.o $septel_tools_dir/parse.o $septel_tools_dir/pool.o $septel_tools_dir/sdlsig.o $septel_tools_dir/strtonum.o $septel_tools_dir/timer.o $septel_tools_dir/trace.o "
686
687		if test "$V_PCAP" != septel ; then
688			 SSRC="pcap-septel.c"
689
690		fi
691		ac_cv_lbl_septel_api=yes
692	fi
693
694	AC_MSG_RESULT($ac_cv_lbl_septel_api)
695	if test $ac_cv_lbl_septel_api = no; then
696		if test "$want_septel" = yes; then
697			AC_MSG_ERROR(Septel API not found under directory $septel_root; use --without-septel)
698		fi
699	else
700		AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have a Septel API])
701	fi
702fi
703
704if test "$V_PCAP" = septel -a "$ac_cv_lbl_septel_api" = no; then
705	AC_MSG_ERROR(Specifying the capture type as 'septel' requires the Septel API to be present; use --with-septel=DIR)
706fi
707
708
709AC_LBL_LEX_AND_YACC(V_LEX, V_YACC, pcap_)
710if test "$V_LEX" = lex ; then
711# Some versions of lex can't handle the definitions section of scanner.l .
712# Try lexing it and complain if it can't deal.
713	AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex,
714		if lex -t scanner.l > /dev/null 2>&1; then
715			tcpdump_cv_capable_lex=yes
716		else
717			tcpdump_cv_capable_lex=insufficient
718		fi)
719	if test $tcpdump_cv_capable_lex = insufficient ; then
720		AC_MSG_ERROR([Your operating system's lex is insufficient to compile
721 libpcap.  flex is a lex replacement that has many advantages, including
722 being able to compile libpcap.  For more information, see
723 http://www.gnu.org/software/flex/flex.html .])
724	fi
725fi
726
727DYEXT="so"
728case "$host_os" in
729
730aix*)
731	dnl Workaround to enable certain features
732	AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
733	;;
734
735hpux9*)
736	AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x])
737	;;
738
739hpux10.0*)
740	;;
741
742hpux10.1*)
743	;;
744
745hpux*)
746	dnl HPUX 10.20 and above is similar to HPUX 9, but
747	dnl not the same....
748	dnl
749	dnl XXX - DYEXT should be set to "sl" if this is building
750	dnl for 32-bit PA-RISC, but should be left as "so" for
751	dnl 64-bit PA-RISC or, I suspect, IA-64.
752	AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later])
753	;;
754
755sinix*)
756	AC_MSG_CHECKING(if SINIX compiler defines sinix)
757	AC_CACHE_VAL(ac_cv_cc_sinix_defined,
758		AC_TRY_COMPILE(
759		    [],
760		    [int i = sinix;],
761		    ac_cv_cc_sinix_defined=yes,
762		    ac_cv_cc_sinix_defined=no))
763	    AC_MSG_RESULT($ac_cv_cc_sinix_defined)
764	    if test $ac_cv_cc_sinix_defined = no ; then
765		    AC_DEFINE(sinix,1,[on sinix])
766	    fi
767	;;
768
769solaris*)
770	AC_DEFINE(HAVE_SOLARIS,1,[On solaris])
771	;;
772
773darwin*)
774	DYEXT="dylib"
775	V_CCOPT="$V_CCOPT -fno-common"
776	;;
777
778linux*)
779	V_CCOPT="$V_CCOPT -fPIC"
780	;;
781
782esac
783
784AC_PROG_RANLIB
785
786AC_LBL_DEVEL(V_CCOPT)
787
788AC_LBL_SOCKADDR_SA_LEN
789
790AC_LBL_SOCKADDR_STORAGE
791
792AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
793
794AC_LBL_UNALIGNED_ACCESS
795
796#
797# Makefile.in includes rules to generate version.h, so we assume
798# that it will be generated if autoconf is used.
799#
800AC_DEFINE(HAVE_VERSION_H, 1, [define if version.h is generated in the build procedure])
801
802rm -f net
803ln -s ${srcdir}/bpf/net net
804
805AC_SUBST(V_CCOPT)
806AC_SUBST(V_DEFS)
807AC_SUBST(V_INCLS)
808AC_SUBST(V_LIBS)
809AC_SUBST(V_LEX)
810AC_SUBST(V_PCAP)
811AC_SUBST(V_FINDALLDEVS)
812AC_SUBST(V_RANLIB)
813AC_SUBST(V_YACC)
814AC_SUBST(SSRC)
815AC_SUBST(DYEXT)
816AC_SUBST(DAGLIBS)
817
818AC_PROG_INSTALL
819
820AC_CONFIG_HEADER(config.h)
821
822AC_OUTPUT(Makefile)
823
824if test -f .devel ; then
825	make depend
826fi
827exit 0
828