• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1dnl Copyright (c) 1995, 1996, 1997, 1998
2dnl	The Regents of the University of California.  All rights reserved.
3dnl
4dnl Redistribution and use in source and binary forms, with or without
5dnl modification, are permitted provided that: (1) source code distributions
6dnl retain the above copyright notice and this paragraph in its entirety, (2)
7dnl distributions including binary code include the above copyright notice and
8dnl this paragraph in its entirety in the documentation or other materials
9dnl provided with the distribution, and (3) all advertising materials mentioning
10dnl features or use of this software display the following acknowledgement:
11dnl ``This product includes software developed by the University of California,
12dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13dnl the University nor the names of its contributors may be used to endorse
14dnl or promote products derived from this software without specific prior
15dnl written permission.
16dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19dnl
20dnl LBL autoconf macros
21dnl
22
23dnl
24dnl Do whatever AC_LBL_C_INIT work is necessary before using AC_PROG_CC.
25dnl
26dnl It appears that newer versions of autoconf (2.64 and later) will,
27dnl if you use AC_TRY_COMPILE in a macro, stick AC_PROG_CC at the
28dnl beginning of the macro, even if the macro itself calls AC_PROG_CC.
29dnl See the "Prerequisite Macros" and "Expanded Before Required" sections
30dnl in the Autoconf documentation.
31dnl
32dnl This causes a steaming heap of fail in our case, as we were, in
33dnl AC_LBL_C_INIT, doing the tests we now do in AC_LBL_C_INIT_BEFORE_CC,
34dnl calling AC_PROG_CC, and then doing the tests we now do in
35dnl AC_LBL_C_INIT.  Now, we run AC_LBL_C_INIT_BEFORE_CC, AC_PROG_CC,
36dnl and AC_LBL_C_INIT at the top level.
37dnl
38AC_DEFUN(AC_LBL_C_INIT_BEFORE_CC,
39[
40    AC_BEFORE([$0], [AC_LBL_C_INIT])
41    AC_BEFORE([$0], [AC_PROG_CC])
42    AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
43    AC_BEFORE([$0], [AC_LBL_DEVEL])
44    AC_ARG_WITH(gcc, [  --without-gcc           don't use gcc])
45    $1=""
46    if test "${srcdir}" != "." ; then
47	    $1="-I\$(srcdir)"
48    fi
49    if test "${CFLAGS+set}" = set; then
50	    LBL_CFLAGS="$CFLAGS"
51    fi
52    if test -z "$CC" ; then
53	    case "$host_os" in
54
55	    bsdi*)
56		    AC_CHECK_PROG(SHLICC2, shlicc2, yes, no)
57		    if test $SHLICC2 = yes ; then
58			    CC=shlicc2
59			    export CC
60		    fi
61		    ;;
62	    esac
63    fi
64    if test -z "$CC" -a "$with_gcc" = no ; then
65	    CC=cc
66	    export CC
67    fi
68])
69
70dnl
71dnl Determine which compiler we're using (cc or gcc)
72dnl If using gcc, determine the version number
73dnl If using cc:
74dnl     require that it support ansi prototypes
75dnl     use -O (AC_PROG_CC will use -g -O2 on gcc, so we don't need to
76dnl     do that ourselves for gcc)
77dnl     add -g flags, as appropriate
78dnl     explicitly specify /usr/local/include
79dnl
80dnl NOTE WELL: with newer versions of autoconf, "gcc" means any compiler
81dnl that defines __GNUC__, which means clang, for example, counts as "gcc".
82dnl
83dnl usage:
84dnl
85dnl	AC_LBL_C_INIT(copt, incls)
86dnl
87dnl results:
88dnl
89dnl	$1 (copt set)
90dnl	$2 (incls set)
91dnl	CC
92dnl	LDFLAGS
93dnl	LBL_CFLAGS
94dnl
95AC_DEFUN(AC_LBL_C_INIT,
96[
97    AC_BEFORE([$0], [AC_LBL_FIXINCLUDES])
98    AC_BEFORE([$0], [AC_LBL_DEVEL])
99    AC_BEFORE([$0], [AC_LBL_SHLIBS_INIT])
100    if test "$GCC" = yes ; then
101	    #
102	    # -Werror forces warnings to be errors.
103	    #
104	    ac_lbl_cc_force_warning_errors=-Werror
105
106	    #
107	    # Try to have the compiler default to hiding symbols,
108	    # so that only symbols explicitly exported with
109	    # PCAP_API will be visible outside (shared) libraries.
110	    #
111	    AC_LBL_CHECK_COMPILER_OPT($1, -fvisibility=hidden)
112    else
113	    $2="$$2 -I/usr/local/include"
114	    LDFLAGS="$LDFLAGS -L/usr/local/lib"
115
116	    case "$host_os" in
117
118	    darwin*)
119		    #
120		    # This is assumed either to be GCC or clang, both
121		    # of which use -Werror to force warnings to be errors.
122		    #
123		    ac_lbl_cc_force_warning_errors=-Werror
124
125		    #
126		    # Try to have the compiler default to hiding symbols,
127		    # so that only symbols explicitly exported with
128		    # PCAP_API will be visible outside (shared) libraries.
129		    #
130		    AC_LBL_CHECK_COMPILER_OPT($1, -fvisibility=hidden)
131		    ;;
132
133	    hpux*)
134		    #
135		    # HP C, which is what we presume we're using, doesn't
136		    # exit with a non-zero exit status if we hand it an
137		    # invalid -W flag, can't be forced to do so even with
138		    # +We, and doesn't handle GCC-style -W flags, so we
139		    # don't want to try using GCC-style -W flags.
140		    #
141		    ac_lbl_cc_dont_try_gcc_dashW=yes
142		    ;;
143
144	    irix*)
145		    #
146		    # MIPS C, which is what we presume we're using, doesn't
147		    # necessarily exit with a non-zero exit status if we
148		    # hand it an invalid -W flag, can't be forced to do
149		    # so, and doesn't handle GCC-style -W flags, so we
150		    # don't want to try using GCC-style -W flags.
151		    #
152		    ac_lbl_cc_dont_try_gcc_dashW=yes
153		    #
154		    # It also, apparently, defaults to "char" being
155		    # unsigned, unlike most other C implementations;
156		    # I suppose we could say "signed char" whenever
157		    # we want to guarantee a signed "char", but let's
158		    # just force signed chars.
159		    #
160		    # -xansi is normally the default, but the
161		    # configure script was setting it; perhaps -cckr
162		    # was the default in the Old Days.  (Then again,
163		    # that would probably be for backwards compatibility
164		    # in the days when ANSI C was Shiny and New, i.e.
165		    # 1989 and the early '90's, so maybe we can just
166		    # drop support for those compilers.)
167		    #
168		    # -g is equivalent to -g2, which turns off
169		    # optimization; we choose -g3, which generates
170		    # debugging information but doesn't turn off
171		    # optimization (even if the optimization would
172		    # cause inaccuracies in debugging).
173		    #
174		    $1="$$1 -xansi -signed -g3"
175		    ;;
176
177	    osf*)
178		    #
179		    # Presumed to be DEC OSF/1, Digital UNIX, or
180		    # Tru64 UNIX.
181		    #
182		    # The DEC C compiler, which is what we presume we're
183		    # using, doesn't exit with a non-zero exit status if we
184		    # hand it an invalid -W flag, can't be forced to do
185		    # so, and doesn't handle GCC-style -W flags, so we
186		    # don't want to try using GCC-style -W flags.
187		    #
188		    ac_lbl_cc_dont_try_gcc_dashW=yes
189		    #
190		    # -g is equivalent to -g2, which turns off
191		    # optimization; we choose -g3, which generates
192		    # debugging information but doesn't turn off
193		    # optimization (even if the optimization would
194		    # cause inaccuracies in debugging).
195		    #
196		    $1="$$1 -g3"
197		    ;;
198
199	    solaris*)
200		    #
201		    # Assumed to be Sun C, which requires -errwarn to force
202		    # warnings to be treated as errors.
203		    #
204		    ac_lbl_cc_force_warning_errors=-errwarn
205
206		    #
207		    # Try to have the compiler default to hiding symbols,
208		    # so that only symbols explicitly exported with
209		    # PCAP_API will be visible outside (shared) libraries.
210		    #
211		    AC_LBL_CHECK_COMPILER_OPT($1, -xldscope=hidden)
212		    ;;
213
214	    ultrix*)
215		    AC_MSG_CHECKING(that Ultrix $CC hacks const in prototypes)
216		    AC_CACHE_VAL(ac_cv_lbl_cc_const_proto,
217			AC_TRY_COMPILE(
218			    [#include <sys/types.h>],
219			    [struct a { int b; };
220			    void c(const struct a *)],
221			    ac_cv_lbl_cc_const_proto=yes,
222			    ac_cv_lbl_cc_const_proto=no))
223		    AC_MSG_RESULT($ac_cv_lbl_cc_const_proto)
224		    if test $ac_cv_lbl_cc_const_proto = no ; then
225			    AC_DEFINE(const,[],
226			        [to handle Ultrix compilers that don't support const in prototypes])
227		    fi
228		    ;;
229	    esac
230	    $1="$$1 -O"
231    fi
232])
233
234dnl
235dnl Check whether, if you pass an unknown warning option to the
236dnl compiler, it fails or just prints a warning message and succeeds.
237dnl Set ac_lbl_unknown_warning_option_error to the appropriate flag
238dnl to force an error if it would otherwise just print a warning message
239dnl and succeed.
240dnl
241AC_DEFUN(AC_LBL_CHECK_UNKNOWN_WARNING_OPTION_ERROR,
242    [
243	AC_MSG_CHECKING([whether the compiler fails when given an unknown warning option])
244	save_CFLAGS="$CFLAGS"
245	CFLAGS="$CFLAGS -Wxyzzy-this-will-never-succeed-xyzzy"
246	AC_TRY_COMPILE(
247	    [],
248	    [return 0],
249	    [
250		AC_MSG_RESULT([no])
251		#
252		# We're assuming this is clang, where
253		# -Werror=unknown-warning-option is the appropriate
254		# option to force the compiler to fail.
255		#
256		ac_lbl_unknown_warning_option_error="-Werror=unknown-warning-option"
257	    ],
258	    [
259		AC_MSG_RESULT([yes])
260	    ])
261	CFLAGS="$save_CFLAGS"
262    ])
263
264dnl
265dnl Check whether the compiler option specified as the second argument
266dnl is supported by the compiler and, if so, add it to the macro
267dnl specified as the first argument
268dnl
269AC_DEFUN(AC_LBL_CHECK_COMPILER_OPT,
270    [
271	AC_MSG_CHECKING([whether the compiler supports the $2 option])
272	save_CFLAGS="$CFLAGS"
273	if expr "x$2" : "x-W.*" >/dev/null
274	then
275	    CFLAGS="$CFLAGS $ac_lbl_unknown_warning_option_error $2"
276	elif expr "x$2" : "x-f.*" >/dev/null
277	then
278	    CFLAGS="$CFLAGS -Werror $2"
279	elif expr "x$2" : "x-m.*" >/dev/null
280	then
281	    CFLAGS="$CFLAGS -Werror $2"
282	else
283	    CFLAGS="$CFLAGS $2"
284	fi
285	AC_TRY_COMPILE(
286	    [],
287	    [return 0],
288	    [
289		AC_MSG_RESULT([yes])
290		CFLAGS="$save_CFLAGS"
291		$1="$$1 $2"
292	    ],
293	    [
294		AC_MSG_RESULT([no])
295		CFLAGS="$save_CFLAGS"
296	    ])
297    ])
298
299dnl
300dnl Check whether the compiler supports an option to generate
301dnl Makefile-style dependency lines
302dnl
303dnl GCC uses -M for this.  Non-GCC compilers that support this
304dnl use a variety of flags, including but not limited to -M.
305dnl
306dnl We test whether the flag in question is supported, as older
307dnl versions of compilers might not support it.
308dnl
309dnl We don't try all the possible flags, just in case some flag means
310dnl "generate dependencies" on one compiler but means something else
311dnl on another compiler.
312dnl
313dnl Most compilers that support this send the output to the standard
314dnl output by default.  IBM's XLC, however, supports -M but sends
315dnl the output to {sourcefile-basename}.u, and AIX has no /dev/stdout
316dnl to work around that, so we don't bother with XLC.
317dnl
318AC_DEFUN(AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT,
319    [
320	AC_MSG_CHECKING([whether the compiler supports generating dependencies])
321	if test "$GCC" = yes ; then
322		#
323		# GCC, or a compiler deemed to be GCC by AC_PROG_CC (even
324		# though it's not); we assume that, in this case, the flag
325		# would be -M.
326		#
327		ac_lbl_dependency_flag="-M"
328	else
329		#
330		# Not GCC or a compiler deemed to be GCC; what platform is
331		# this?  (We're assuming that if the compiler isn't GCC
332		# it's the compiler from the vendor of the OS; that won't
333		# necessarily be true for x86 platforms, where it might be
334		# the Intel C compiler.)
335		#
336		case "$host_os" in
337
338		irix*|osf*|darwin*)
339			#
340			# MIPS C for IRIX, DEC C, and clang all use -M.
341			#
342			ac_lbl_dependency_flag="-M"
343			;;
344
345		solaris*)
346			#
347			# Sun C uses -xM.
348			#
349			ac_lbl_dependency_flag="-xM"
350			;;
351
352		hpux*)
353			#
354			# HP's older C compilers don't support this.
355			# HP's newer C compilers support this with
356			# either +M or +Make; the older compilers
357			# interpret +M as something completely
358			# different, so we use +Make so we don't
359			# think it works with the older compilers.
360			#
361			ac_lbl_dependency_flag="+Make"
362			;;
363
364		*)
365			#
366			# Not one of the above; assume no support for
367			# generating dependencies.
368			#
369			ac_lbl_dependency_flag=""
370			;;
371		esac
372	fi
373
374	#
375	# Is ac_lbl_dependency_flag defined and, if so, does the compiler
376	# complain about it?
377	#
378	# Note: clang doesn't seem to exit with an error status when handed
379	# an unknown non-warning error, even if you pass it
380	# -Werror=unknown-warning-option.  However, it always supports
381	# -M, so the fact that this test always succeeds with clang
382	# isn't an issue.
383	#
384	if test ! -z "$ac_lbl_dependency_flag"; then
385		AC_LANG_CONFTEST(
386		    [AC_LANG_SOURCE([[int main(void) { return 0; }]])])
387		echo "$CC" $ac_lbl_dependency_flag conftest.c >&5
388		if "$CC" $ac_lbl_dependency_flag conftest.c >/dev/null 2>&1; then
389			AC_MSG_RESULT([yes, with $ac_lbl_dependency_flag])
390			DEPENDENCY_CFLAG="$ac_lbl_dependency_flag"
391			MKDEP='${srcdir}/mkdep'
392		else
393			AC_MSG_RESULT([no])
394			#
395			# We can't run mkdep, so have "make depend" do
396			# nothing.
397			#
398			MKDEP=:
399		fi
400		rm -rf conftest*
401	else
402		AC_MSG_RESULT([no])
403		#
404		# We can't run mkdep, so have "make depend" do
405		# nothing.
406		#
407		MKDEP=:
408	fi
409	AC_SUBST(DEPENDENCY_CFLAG)
410	AC_SUBST(MKDEP)
411    ])
412
413dnl
414dnl Determine what options are needed to build a shared library
415dnl
416dnl usage:
417dnl
418dnl	AC_LBL_SHLIBS_INIT
419dnl
420dnl results:
421dnl
422dnl	V_CCOPT (modified to build position-independent code)
423dnl	V_SHLIB_CMD
424dnl	V_SHLIB_OPT
425dnl	V_SONAME_OPT
426dnl	V_RPATH_OPT
427dnl
428AC_DEFUN(AC_LBL_SHLIBS_INIT,
429    [AC_PREREQ(2.50)
430    if test "$GCC" = yes ; then
431	    #
432	    # On platforms where we build a shared library:
433	    #
434	    #	add options to generate position-independent code,
435	    #	if necessary (it's the default in AIX and Darwin/OS X);
436	    #
437	    #	define option to set the soname of the shared library,
438	    #	if the OS supports that;
439	    #
440	    #	add options to specify, at link time, a directory to
441	    #	add to the run-time search path, if that's necessary.
442	    #
443	    V_SHLIB_CMD="\$(CC)"
444	    V_SHLIB_OPT="-shared"
445	    case "$host_os" in
446
447	    aix*)
448		    ;;
449
450	    freebsd*|netbsd*|openbsd*|dragonfly*|linux*|osf*)
451	    	    #
452		    # Platforms where the linker is the GNU linker
453		    # or accepts command-line arguments like
454		    # those the GNU linker accepts.
455		    #
456		    # Some instruction sets require -fPIC on some
457		    # operating systems.  Check for them.  If you
458		    # have a combination that requires it, add it
459		    # here.
460		    #
461		    PIC_OPT=-fpic
462		    case "$host_cpu" in
463
464		    sparc64*)
465			case "$host_os" in
466
467			freebsd*|openbsd*)
468			    PIC_OPT=-fPIC
469			    ;;
470			esac
471			;;
472		    esac
473		    V_CCOPT="$V_CCOPT $PIC_OPT"
474		    V_SONAME_OPT="-Wl,-soname,"
475		    V_RPATH_OPT="-Wl,-rpath,"
476		    ;;
477
478	    hpux*)
479		    V_CCOPT="$V_CCOPT -fpic"
480	    	    #
481		    # XXX - this assumes GCC is using the HP linker,
482		    # rather than the GNU linker, and that the "+h"
483		    # option is used on all HP-UX platforms, both .sl
484		    # and .so.
485		    #
486		    V_SONAME_OPT="-Wl,+h,"
487		    #
488		    # By default, directories specifed with -L
489		    # are added to the run-time search path, so
490		    # we don't add them in pcap-config.
491		    #
492		    ;;
493
494	    solaris*)
495		    V_CCOPT="$V_CCOPT -fpic"
496		    #
497		    # XXX - this assumes GCC is using the Sun linker,
498		    # rather than the GNU linker.
499		    #
500		    V_SONAME_OPT="-Wl,-h,"
501		    V_RPATH_OPT="-Wl,-R,"
502		    ;;
503	    esac
504    else
505	    #
506	    # Set the appropriate compiler flags and, on platforms
507	    # where we build a shared library:
508	    #
509	    #	add options to generate position-independent code,
510	    #	if necessary (it's the default in Darwin/OS X);
511	    #
512	    #	if we generate ".so" shared libraries, define the
513	    #	appropriate options for building the shared library;
514	    #
515	    #	add options to specify, at link time, a directory to
516	    #	add to the run-time search path, if that's necessary.
517	    #
518	    # Note: spaces after V_SONAME_OPT are significant; on
519	    # some platforms the soname is passed with a GCC-like
520	    # "-Wl,-soname,{soname}" option, with the soname part
521	    # of the option, while on other platforms the C compiler
522	    # driver takes it as a regular option with the soname
523	    # following the option.  The same applies to V_RPATH_OPT.
524	    #
525	    case "$host_os" in
526
527	    aix*)
528		    V_SHLIB_CMD="\$(CC)"
529		    V_SHLIB_OPT="-G -bnoentry -bexpall"
530		    ;;
531
532	    freebsd*|netbsd*|openbsd*|dragonfly*|linux*)
533		    #
534		    # "cc" is GCC.
535		    #
536		    V_CCOPT="$V_CCOPT -fpic"
537		    V_SHLIB_CMD="\$(CC)"
538		    V_SHLIB_OPT="-shared"
539		    V_SONAME_OPT="-Wl,-soname,"
540		    V_RPATH_OPT="-Wl,-rpath,"
541		    ;;
542
543	    hpux*)
544		    V_CCOPT="$V_CCOPT +z"
545		    V_SHLIB_CMD="\$(LD)"
546		    V_SHLIB_OPT="-b"
547		    V_SONAME_OPT="+h "
548		    #
549		    # By default, directories specifed with -L
550		    # are added to the run-time search path, so
551		    # we don't add them in pcap-config.
552		    #
553		    ;;
554
555	    osf*)
556	    	    #
557		    # Presumed to be DEC OSF/1, Digital UNIX, or
558		    # Tru64 UNIX.
559		    #
560		    V_SHLIB_CMD="\$(CC)"
561		    V_SHLIB_OPT="-shared"
562		    V_SONAME_OPT="-soname "
563		    V_RPATH_OPT="-rpath "
564		    ;;
565
566	    solaris*)
567		    V_CCOPT="$V_CCOPT -Kpic"
568		    V_SHLIB_CMD="\$(CC)"
569		    V_SHLIB_OPT="-G"
570		    V_SONAME_OPT="-h "
571		    V_RPATH_OPT="-R"
572		    ;;
573	    esac
574    fi
575])
576
577#
578# Try compiling a sample of the type of code that appears in
579# gencode.c with "inline", "__inline__", and "__inline".
580#
581# Autoconf's AC_C_INLINE, at least in autoconf 2.13, isn't good enough,
582# as it just tests whether a function returning "int" can be inlined;
583# at least some versions of HP's C compiler can inline that, but can't
584# inline a function that returns a struct pointer.
585#
586# Make sure we use the V_CCOPT flags, because some of those might
587# disable inlining.
588#
589AC_DEFUN(AC_LBL_C_INLINE,
590    [AC_MSG_CHECKING(for inline)
591    save_CFLAGS="$CFLAGS"
592    CFLAGS="$V_CCOPT"
593    AC_CACHE_VAL(ac_cv_lbl_inline, [
594	ac_cv_lbl_inline=""
595	ac_lbl_cc_inline=no
596	for ac_lbl_inline in inline __inline__ __inline
597	do
598	    AC_TRY_COMPILE(
599		[#define inline $ac_lbl_inline
600		static inline struct iltest *foo(void);
601		struct iltest {
602		    int iltest1;
603		    int iltest2;
604		};
605
606		static inline struct iltest *
607		foo()
608		{
609		    static struct iltest xxx;
610
611		    return &xxx;
612		}],,ac_lbl_cc_inline=yes,)
613	    if test "$ac_lbl_cc_inline" = yes ; then
614		break;
615	    fi
616	done
617	if test "$ac_lbl_cc_inline" = yes ; then
618	    ac_cv_lbl_inline=$ac_lbl_inline
619	fi])
620    CFLAGS="$save_CFLAGS"
621    if test ! -z "$ac_cv_lbl_inline" ; then
622	AC_MSG_RESULT($ac_cv_lbl_inline)
623    else
624	AC_MSG_RESULT(no)
625    fi
626    AC_DEFINE_UNQUOTED(inline, $ac_cv_lbl_inline, [Define as token for inline if inlining supported])])
627
628dnl
629dnl If using gcc, make sure we have ANSI ioctl definitions
630dnl
631dnl usage:
632dnl
633dnl	AC_LBL_FIXINCLUDES
634dnl
635AC_DEFUN(AC_LBL_FIXINCLUDES,
636    [if test "$GCC" = yes ; then
637	    AC_MSG_CHECKING(for ANSI ioctl definitions)
638	    AC_CACHE_VAL(ac_cv_lbl_gcc_fixincludes,
639		AC_TRY_COMPILE(
640		    [/*
641		     * This generates a "duplicate case value" when fixincludes
642		     * has not be run.
643		     */
644#		include <sys/types.h>
645#		include <sys/time.h>
646#		include <sys/ioctl.h>
647#		ifdef HAVE_SYS_IOCCOM_H
648#		include <sys/ioccom.h>
649#		endif],
650		    [switch (0) {
651		    case _IO('A', 1):;
652		    case _IO('B', 1):;
653		    }],
654		    ac_cv_lbl_gcc_fixincludes=yes,
655		    ac_cv_lbl_gcc_fixincludes=no))
656	    AC_MSG_RESULT($ac_cv_lbl_gcc_fixincludes)
657	    if test $ac_cv_lbl_gcc_fixincludes = no ; then
658		    # Don't cache failure
659		    unset ac_cv_lbl_gcc_fixincludes
660		    AC_MSG_ERROR(see the INSTALL for more info)
661	    fi
662    fi])
663
664dnl
665dnl Checks to see if union wait is used with WEXITSTATUS()
666dnl
667dnl usage:
668dnl
669dnl	AC_LBL_UNION_WAIT
670dnl
671dnl results:
672dnl
673dnl	DECLWAITSTATUS (defined)
674dnl
675AC_DEFUN(AC_LBL_UNION_WAIT,
676    [AC_MSG_CHECKING(if union wait is used)
677    AC_CACHE_VAL(ac_cv_lbl_union_wait,
678	AC_TRY_COMPILE([
679#	include <sys/types.h>
680#	include <sys/wait.h>],
681	    [int status;
682	    u_int i = WEXITSTATUS(status);
683	    u_int j = waitpid(0, &status, 0);],
684	    ac_cv_lbl_union_wait=no,
685	    ac_cv_lbl_union_wait=yes))
686    AC_MSG_RESULT($ac_cv_lbl_union_wait)
687    if test $ac_cv_lbl_union_wait = yes ; then
688	    AC_DEFINE(DECLWAITSTATUS,union wait,[type for wait])
689    else
690	    AC_DEFINE(DECLWAITSTATUS,int,[type for wait])
691    fi])
692
693dnl
694dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
695dnl
696dnl usage:
697dnl
698dnl	AC_LBL_SOCKADDR_SA_LEN
699dnl
700dnl results:
701dnl
702dnl	HAVE_SOCKADDR_SA_LEN (defined)
703dnl
704AC_DEFUN(AC_LBL_SOCKADDR_SA_LEN,
705    [AC_MSG_CHECKING(if sockaddr struct has the sa_len member)
706    AC_CACHE_VAL(ac_cv_lbl_sockaddr_has_sa_len,
707	AC_TRY_COMPILE([
708#	include <sys/types.h>
709#	include <sys/socket.h>],
710	[u_int i = sizeof(((struct sockaddr *)0)->sa_len)],
711	ac_cv_lbl_sockaddr_has_sa_len=yes,
712	ac_cv_lbl_sockaddr_has_sa_len=no))
713    AC_MSG_RESULT($ac_cv_lbl_sockaddr_has_sa_len)
714    if test $ac_cv_lbl_sockaddr_has_sa_len = yes ; then
715	    AC_DEFINE(HAVE_SOCKADDR_SA_LEN,1,[if struct sockaddr has the sa_len member])
716    fi])
717
718dnl
719dnl Checks to see if there's a sockaddr_storage structure
720dnl
721dnl usage:
722dnl
723dnl	AC_LBL_SOCKADDR_STORAGE
724dnl
725dnl results:
726dnl
727dnl	HAVE_SOCKADDR_STORAGE (defined)
728dnl
729AC_DEFUN(AC_LBL_SOCKADDR_STORAGE,
730    [AC_MSG_CHECKING(if sockaddr_storage struct exists)
731    AC_CACHE_VAL(ac_cv_lbl_has_sockaddr_storage,
732	AC_TRY_COMPILE([
733#	include <sys/types.h>
734#	include <sys/socket.h>],
735	[u_int i = sizeof (struct sockaddr_storage)],
736	ac_cv_lbl_has_sockaddr_storage=yes,
737	ac_cv_lbl_has_sockaddr_storage=no))
738    AC_MSG_RESULT($ac_cv_lbl_has_sockaddr_storage)
739    if test $ac_cv_lbl_has_sockaddr_storage = yes ; then
740	    AC_DEFINE(HAVE_SOCKADDR_STORAGE,1,[if struct sockaddr_storage exists])
741    fi])
742
743dnl
744dnl Checks to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
745dnl dl_module_id_1 member
746dnl
747dnl usage:
748dnl
749dnl	AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
750dnl
751dnl results:
752dnl
753dnl	HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1 (defined)
754dnl
755dnl NOTE: any compile failure means we conclude that it doesn't have
756dnl that member, so if we don't have DLPI, don't have a <sys/dlpi_ext.h>
757dnl header, or have one that doesn't declare a dl_hp_ppa_info_t type,
758dnl we conclude it doesn't have that member (which is OK, as either we
759dnl won't be using code that would use that member, or we wouldn't
760dnl compile in any case).
761dnl
762AC_DEFUN(AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1,
763    [AC_MSG_CHECKING(if dl_hp_ppa_info_t struct has dl_module_id_1 member)
764    AC_CACHE_VAL(ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1,
765	AC_TRY_COMPILE([
766#	include <sys/types.h>
767#	include <sys/dlpi.h>
768#	include <sys/dlpi_ext.h>],
769	[u_int i = sizeof(((dl_hp_ppa_info_t *)0)->dl_module_id_1)],
770	ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1=yes,
771	ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1=no))
772    AC_MSG_RESULT($ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1)
773    if test $ac_cv_lbl_dl_hp_ppa_info_t_has_dl_module_id_1 = yes ; then
774	    AC_DEFINE(HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1,1,[if ppa_info_t_dl_module_id exists])
775    fi])
776
777dnl
778dnl Checks to see if -R is used
779dnl
780dnl usage:
781dnl
782dnl	AC_LBL_HAVE_RUN_PATH
783dnl
784dnl results:
785dnl
786dnl	ac_cv_lbl_have_run_path (yes or no)
787dnl
788AC_DEFUN(AC_LBL_HAVE_RUN_PATH,
789    [AC_MSG_CHECKING(for ${CC-cc} -R)
790    AC_CACHE_VAL(ac_cv_lbl_have_run_path,
791	[echo 'main(){}' > conftest.c
792	${CC-cc} -o conftest conftest.c -R/a1/b2/c3 >conftest.out 2>&1
793	if test ! -s conftest.out ; then
794		ac_cv_lbl_have_run_path=yes
795	else
796		ac_cv_lbl_have_run_path=no
797	fi
798	rm -f -r conftest*])
799    AC_MSG_RESULT($ac_cv_lbl_have_run_path)
800    ])
801
802dnl
803dnl Checks to see if unaligned memory accesses fail
804dnl
805dnl usage:
806dnl
807dnl	AC_LBL_UNALIGNED_ACCESS
808dnl
809dnl results:
810dnl
811dnl	LBL_ALIGN (DEFINED)
812dnl
813AC_DEFUN(AC_LBL_UNALIGNED_ACCESS,
814    [AC_MSG_CHECKING(if unaligned accesses fail)
815    AC_CACHE_VAL(ac_cv_lbl_unaligned_fail,
816	[case "$host_cpu" in
817
818	#
819	# These are CPU types where:
820	#
821	#	the CPU faults on an unaligned access, but at least some
822	#	OSes that support that CPU catch the fault and simulate
823	#	the unaligned access (e.g., Alpha/{Digital,Tru64} UNIX) -
824	#	the simulation is slow, so we don't want to use it;
825	#
826	#	the CPU, I infer (from the old
827	#
828	# XXX: should also check that they don't do weird things (like on arm)
829	#
830	#	comment) doesn't fault on unaligned accesses, but doesn't
831	#	do a normal unaligned fetch, either (e.g., presumably, ARM);
832	#
833	#	for whatever reason, the test program doesn't work
834	#	(this has been claimed to be the case for several of those
835	#	CPUs - I don't know what the problem is; the problem
836	#	was reported as "the test program dumps core" for SuperH,
837	#	but that's what the test program is *supposed* to do -
838	#	it dumps core before it writes anything, so the test
839	#	for an empty output file should find an empty output
840	#	file and conclude that unaligned accesses don't work).
841	#
842	# This run-time test won't work if you're cross-compiling, so
843	# in order to support cross-compiling for a particular CPU,
844	# we have to wire in the list of CPU types anyway, as far as
845	# I know, so perhaps we should just have a set of CPUs on
846	# which we know it doesn't work, a set of CPUs on which we
847	# know it does work, and have the script just fail on other
848	# cpu types and update it when such a failure occurs.
849	#
850	alpha*|arm*|bfin*|hp*|mips*|sh*|sparc*|ia64|nv1)
851		ac_cv_lbl_unaligned_fail=yes
852		;;
853
854	*)
855		cat >conftest.c <<EOF
856#		include <sys/types.h>
857#		include <sys/wait.h>
858#		include <stdio.h>
859		unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
860		main() {
861		unsigned int i;
862		pid_t pid;
863		int status;
864		/* avoid "core dumped" message */
865		pid = fork();
866		if (pid <  0)
867			exit(2);
868		if (pid > 0) {
869			/* parent */
870			pid = waitpid(pid, &status, 0);
871			if (pid < 0)
872				exit(3);
873			exit(!WIFEXITED(status));
874		}
875		/* child */
876		i = *(unsigned int *)&a[[1]];
877		printf("%d\n", i);
878		exit(0);
879		}
880EOF
881		${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
882		    conftest.c $LIBS >/dev/null 2>&1
883		if test ! -x conftest ; then
884			dnl failed to compile for some reason
885			ac_cv_lbl_unaligned_fail=yes
886		else
887			./conftest >conftest.out
888			if test ! -s conftest.out ; then
889				ac_cv_lbl_unaligned_fail=yes
890			else
891				ac_cv_lbl_unaligned_fail=no
892			fi
893		fi
894		rm -f -r conftest* core core.conftest
895		;;
896	esac])
897    AC_MSG_RESULT($ac_cv_lbl_unaligned_fail)
898    if test $ac_cv_lbl_unaligned_fail = yes ; then
899	    AC_DEFINE(LBL_ALIGN,1,[if unaligned access fails])
900    fi])
901
902dnl
903dnl If the file .devel exists:
904dnl	Add some warning flags if the compiler supports them
905dnl	If an os prototype include exists, symlink os-proto.h to it
906dnl
907dnl usage:
908dnl
909dnl	AC_LBL_DEVEL(copt)
910dnl
911dnl results:
912dnl
913dnl	$1 (copt appended)
914dnl	HAVE_OS_PROTO_H (defined)
915dnl	os-proto.h (symlinked)
916dnl
917AC_DEFUN(AC_LBL_DEVEL,
918    [rm -f os-proto.h
919    if test "${LBL_CFLAGS+set}" = set; then
920	    $1="$$1 ${LBL_CFLAGS}"
921    fi
922    if test -f .devel ; then
923	    #
924	    # Skip all the warning option stuff on some compilers.
925	    #
926	    if test "$ac_lbl_cc_dont_try_gcc_dashW" != yes; then
927		    AC_LBL_CHECK_UNKNOWN_WARNING_OPTION_ERROR()
928		    AC_LBL_CHECK_COMPILER_OPT($1, -Wall)
929		    AC_LBL_CHECK_COMPILER_OPT($1, -Wsign-compare)
930		    AC_LBL_CHECK_COMPILER_OPT($1, -Wmissing-prototypes)
931		    AC_LBL_CHECK_COMPILER_OPT($1, -Wstrict-prototypes)
932		    AC_LBL_CHECK_COMPILER_OPT($1, -Wshadow)
933		    AC_LBL_CHECK_COMPILER_OPT($1, -Wdeclaration-after-statement)
934		    AC_LBL_CHECK_COMPILER_OPT($1, -Wused-but-marked-unused)
935	    fi
936	    AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT()
937	    #
938	    # We used to set -n32 for IRIX 6 when not using GCC (presumed
939	    # to mean that we're using MIPS C or MIPSpro C); it specified
940	    # the "new" faster 32-bit ABI, introduced in IRIX 6.2.  I'm
941	    # not sure why that would be something to do *only* with a
942	    # .devel file; why should the ABI for which we produce code
943	    # depend on .devel?
944	    #
945	    os=`echo $host_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'`
946	    name="lbl/os-$os.h"
947	    if test -f $name ; then
948		    ln -s $name os-proto.h
949		    AC_DEFINE(HAVE_OS_PROTO_H, 1,
950			[if there's an os_proto.h for this platform, to use additional prototypes])
951	    else
952		    AC_MSG_WARN(can't find $name)
953	    fi
954    fi])
955
956dnl
957dnl Improved version of AC_CHECK_LIB
958dnl
959dnl Thanks to John Hawkinson (jhawk@mit.edu)
960dnl
961dnl usage:
962dnl
963dnl	AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
964dnl	    ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
965dnl
966dnl results:
967dnl
968dnl	LIBS
969dnl
970dnl XXX - "AC_LBL_LIBRARY_NET" was redone to use "AC_SEARCH_LIBS"
971dnl rather than "AC_LBL_CHECK_LIB", so this isn't used any more.
972dnl We keep it around for reference purposes in case it's ever
973dnl useful in the future.
974dnl
975
976define(AC_LBL_CHECK_LIB,
977[AC_MSG_CHECKING([for $2 in -l$1])
978dnl Use a cache variable name containing the library, function
979dnl name, and extra libraries to link with, because the test really is
980dnl for library $1 defining function $2, when linked with potinal
981dnl library $5, not just for library $1.  Separate tests with the same
982dnl $1 and different $2's or $5's may have different results.
983ac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'`
984AC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var,
985[ac_save_LIBS="$LIBS"
986LIBS="-l$1 $5 $LIBS"
987AC_TRY_LINK(dnl
988ifelse([$2], [main], , dnl Avoid conflicting decl of main.
989[/* Override any gcc2 internal prototype to avoid an error.  */
990]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
991extern "C"
992#endif
993])dnl
994[/* We use char because int might match the return type of a gcc2
995    builtin and then its argument prototype would still apply.  */
996char $2();
997]),
998	    [$2()],
999	    eval "ac_cv_lbl_lib_$ac_lib_var=yes",
1000	    eval "ac_cv_lbl_lib_$ac_lib_var=no")
1001LIBS="$ac_save_LIBS"
1002])dnl
1003if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then
1004  AC_MSG_RESULT(yes)
1005  ifelse([$3], ,
1006[changequote(, )dnl
1007  ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
1008    -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
1009changequote([, ])dnl
1010  AC_DEFINE_UNQUOTED($ac_tr_lib)
1011  LIBS="-l$1 $LIBS"
1012], [$3])
1013else
1014  AC_MSG_RESULT(no)
1015ifelse([$4], , , [$4
1016])dnl
1017fi
1018])
1019
1020dnl
1021dnl AC_LBL_LIBRARY_NET
1022dnl
1023dnl This test is for network applications that need socket() and
1024dnl gethostbyname() -ish functions.  Under Solaris, those applications
1025dnl need to link with "-lsocket -lnsl".  Under IRIX, they need to link
1026dnl with "-lnsl" but should *not* link with "-lsocket" because
1027dnl libsocket.a breaks a number of things (for instance:
1028dnl gethostbyname() under IRIX 5.2, and snoop sockets under most
1029dnl versions of IRIX).
1030dnl
1031dnl Unfortunately, many application developers are not aware of this,
1032dnl and mistakenly write tests that cause -lsocket to be used under
1033dnl IRIX.  It is also easy to write tests that cause -lnsl to be used
1034dnl under operating systems where neither are necessary (or useful),
1035dnl such as SunOS 4.1.4, which uses -lnsl for TLI.
1036dnl
1037dnl This test exists so that every application developer does not test
1038dnl this in a different, and subtly broken fashion.
1039
1040dnl It has been argued that this test should be broken up into two
1041dnl seperate tests, one for the resolver libraries, and one for the
1042dnl libraries necessary for using Sockets API. Unfortunately, the two
1043dnl are carefully intertwined and allowing the autoconf user to use
1044dnl them independantly potentially results in unfortunate ordering
1045dnl dependancies -- as such, such component macros would have to
1046dnl carefully use indirection and be aware if the other components were
1047dnl executed. Since other autoconf macros do not go to this trouble,
1048dnl and almost no applications use sockets without the resolver, this
1049dnl complexity has not been implemented.
1050dnl
1051dnl The check for libresolv is in case you are attempting to link
1052dnl statically and happen to have a libresolv.a lying around (and no
1053dnl libnsl.a).
1054dnl
1055AC_DEFUN(AC_LBL_LIBRARY_NET, [
1056    # Most operating systems have gethostbyname() in the default searched
1057    # libraries (i.e. libc):
1058    # Some OSes (eg. Solaris) place it in libnsl
1059    # Some strange OSes (SINIX) have it in libsocket:
1060    AC_SEARCH_LIBS(gethostbyname, nsl socket resolv)
1061    # Unfortunately libsocket sometimes depends on libnsl and
1062    # AC_SEARCH_LIBS isn't up to the task of handling dependencies like this.
1063    if test "$ac_cv_search_gethostbyname" = "no"
1064    then
1065	AC_CHECK_LIB(socket, gethostbyname,
1066                     LIBS="-lsocket -lnsl $LIBS", , -lnsl)
1067    fi
1068    AC_SEARCH_LIBS(socket, socket, ,
1069	AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl))
1070    # DLPI needs putmsg under HPUX so test for -lstr while we're at it
1071    AC_SEARCH_LIBS(putmsg, str)
1072    ])
1073
1074dnl
1075dnl Test for __attribute__
1076dnl
1077
1078AC_DEFUN(AC_C___ATTRIBUTE__, [
1079AC_MSG_CHECKING(for __attribute__)
1080AC_CACHE_VAL(ac_cv___attribute__, [
1081AC_COMPILE_IFELSE([
1082  AC_LANG_SOURCE([[
1083#include <stdlib.h>
1084
1085static void foo(void) __attribute__ ((noreturn));
1086
1087static void
1088foo(void)
1089{
1090  exit(1);
1091}
1092
1093int
1094main(int argc, char **argv)
1095{
1096  foo();
1097}
1098  ]])],
1099ac_cv___attribute__=yes,
1100ac_cv___attribute__=no)])
1101if test "$ac_cv___attribute__" = "yes"; then
1102  AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
1103else
1104  #
1105  # We can't use __attribute__, so we can't use __attribute__((unused)),
1106  # so we define _U_ to an empty string.
1107  #
1108  V_DEFS="$V_DEFS -D_U_=\"\""
1109fi
1110AC_MSG_RESULT($ac_cv___attribute__)
1111])
1112
1113dnl
1114dnl Test whether __attribute__((unused)) can be used without warnings
1115dnl
1116
1117AC_DEFUN(AC_C___ATTRIBUTE___UNUSED, [
1118AC_MSG_CHECKING([whether __attribute__((unused)) can be used without warnings])
1119AC_CACHE_VAL(ac_cv___attribute___unused, [
1120save_CFLAGS="$CFLAGS"
1121CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
1122AC_COMPILE_IFELSE([
1123  AC_LANG_SOURCE([[
1124#include <stdlib.h>
1125#include <stdio.h>
1126
1127int
1128main(int argc  __attribute((unused)), char **argv __attribute((unused)))
1129{
1130  printf("Hello, world!\n");
1131  return 0;
1132}
1133  ]])],
1134ac_cv___attribute___unused=yes,
1135ac_cv___attribute___unused=no)])
1136CFLAGS="$save_CFLAGS"
1137if test "$ac_cv___attribute___unused" = "yes"; then
1138  V_DEFS="$V_DEFS -D_U_=\"__attribute__((unused))\""
1139else
1140  V_DEFS="$V_DEFS -D_U_=\"\""
1141fi
1142AC_MSG_RESULT($ac_cv___attribute___unused)
1143])
1144
1145dnl
1146dnl Test whether __attribute__((format)) can be used without warnings
1147dnl
1148
1149AC_DEFUN(AC_C___ATTRIBUTE___FORMAT, [
1150AC_MSG_CHECKING([whether __attribute__((format)) can be used without warnings])
1151AC_CACHE_VAL(ac_cv___attribute___format, [
1152save_CFLAGS="$CFLAGS"
1153CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
1154AC_COMPILE_IFELSE([
1155  AC_LANG_SOURCE([[
1156#include <stdlib.h>
1157
1158extern int foo(const char *fmt, ...)
1159		  __attribute__ ((format (printf, 1, 2)));
1160
1161int
1162main(int argc, char **argv)
1163{
1164  foo("%s", "test");
1165}
1166  ]])],
1167ac_cv___attribute___format=yes,
1168ac_cv___attribute___format=no)])
1169CFLAGS="$save_CFLAGS"
1170if test "$ac_cv___attribute___format" = "yes"; then
1171  AC_DEFINE(__ATTRIBUTE___FORMAT_OK, 1,
1172    [define if your compiler allows __attribute__((format)) without a warning])
1173fi
1174AC_MSG_RESULT($ac_cv___attribute___format)
1175])
1176
1177dnl
1178dnl Checks to see if tpacket_stats is defined in linux/if_packet.h
1179dnl If so then pcap-linux.c can use this to report proper statistics.
1180dnl
1181dnl -Scott Barron
1182dnl
1183AC_DEFUN(AC_LBL_TPACKET_STATS,
1184   [AC_MSG_CHECKING(if if_packet.h has tpacket_stats defined)
1185   AC_CACHE_VAL(ac_cv_lbl_tpacket_stats,
1186   AC_TRY_COMPILE([
1187#  include <linux/if_packet.h>],
1188   [struct tpacket_stats stats],
1189   ac_cv_lbl_tpacket_stats=yes,
1190   ac_cv_lbl_tpacket_stats=no))
1191   AC_MSG_RESULT($ac_cv_lbl_tpacket_stats)
1192   if test $ac_cv_lbl_tpacket_stats = yes; then
1193       AC_DEFINE(HAVE_TPACKET_STATS,1,[if if_packet.h has tpacket_stats defined])
1194   fi])
1195
1196dnl
1197dnl Checks to see if the tpacket_auxdata struct has a tp_vlan_tci member.
1198dnl
1199dnl usage:
1200dnl
1201dnl	AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
1202dnl
1203dnl results:
1204dnl
1205dnl	HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI (defined)
1206dnl
1207dnl NOTE: any compile failure means we conclude that it doesn't have
1208dnl that member, so if we don't have tpacket_auxdata, we conclude it
1209dnl doesn't have that member (which is OK, as either we won't be using
1210dnl code that would use that member, or we wouldn't compile in any case).
1211dnl
1212AC_DEFUN(AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI,
1213    [AC_MSG_CHECKING(if tpacket_auxdata struct has tp_vlan_tci member)
1214    AC_CACHE_VAL(ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci,
1215	AC_TRY_COMPILE([
1216#	include <sys/types.h>
1217#	include <linux/if_packet.h>],
1218	[u_int i = sizeof(((struct tpacket_auxdata *)0)->tp_vlan_tci)],
1219	ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci=yes,
1220	ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci=no))
1221    AC_MSG_RESULT($ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci)
1222    if test $ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci = yes ; then
1223	    HAVE_LINUX_TPACKET_AUXDATA=tp_vlan_tci
1224	    AC_SUBST(HAVE_LINUX_TPACKET_AUXDATA)
1225	    AC_DEFINE(HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI,1,[if tp_vlan_tci exists])
1226    fi])
1227
1228dnl
1229dnl Checks to see if Solaris has the dl_passive_req_t struct defined
1230dnl in <sys/dlpi.h>.
1231dnl
1232dnl usage:
1233dnl
1234dnl	AC_LBL_DL_PASSIVE_REQ_T
1235dnl
1236dnl results:
1237dnl
1238dnl 	HAVE_DLPI_PASSIVE (defined)
1239dnl
1240AC_DEFUN(AC_LBL_DL_PASSIVE_REQ_T,
1241        [AC_MSG_CHECKING(if dl_passive_req_t struct exists)
1242       AC_CACHE_VAL(ac_cv_lbl_has_dl_passive_req_t,
1243                AC_TRY_COMPILE([
1244#       include <sys/types.h>
1245#       include <sys/dlpi.h>],
1246        [u_int i = sizeof(dl_passive_req_t)],
1247        ac_cv_lbl_has_dl_passive_req_t=yes,
1248        ac_cv_lbl_has_dl_passive_req_t=no))
1249    AC_MSG_RESULT($ac_cv_lbl_has_dl_passive_req_t)
1250    if test $ac_cv_lbl_has_dl_passive_req_t = yes ; then
1251            AC_DEFINE(HAVE_DLPI_PASSIVE,1,[if passive_req_t primitive
1252		exists])
1253    fi])
1254