]> The Tcpdump Group git mirrors - libpcap/blob - aclocal.m4
Have routines to set various internal debugging flags.
[libpcap] / aclocal.m4
1 dnl Copyright (c) 1995, 1996, 1997, 1998
2 dnl The Regents of the University of California. All rights reserved.
3 dnl
4 dnl Redistribution and use in source and binary forms, with or without
5 dnl modification, are permitted provided that: (1) source code distributions
6 dnl retain the above copyright notice and this paragraph in its entirety, (2)
7 dnl distributions including binary code include the above copyright notice and
8 dnl this paragraph in its entirety in the documentation or other materials
9 dnl provided with the distribution, and (3) all advertising materials mentioning
10 dnl features or use of this software display the following acknowledgement:
11 dnl ``This product includes software developed by the University of California,
12 dnl Lawrence Berkeley Laboratory and its contributors.'' Neither the name of
13 dnl the University nor the names of its contributors may be used to endorse
14 dnl or promote products derived from this software without specific prior
15 dnl written permission.
16 dnl THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED
17 dnl WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
18 dnl MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 dnl
20 dnl LBL autoconf macros
21 dnl
22
23 dnl
24 dnl Do whatever AC_LBL_C_INIT work is necessary before using AC_PROG_CC.
25 dnl
26 dnl It appears that newer versions of autoconf (2.64 and later) will,
27 dnl if you use AC_TRY_COMPILE in a macro, stick AC_PROG_CC at the
28 dnl beginning of the macro, even if the macro itself calls AC_PROG_CC.
29 dnl See the "Prerequisite Macros" and "Expanded Before Required" sections
30 dnl in the Autoconf documentation.
31 dnl
32 dnl This causes a steaming heap of fail in our case, as we were, in
33 dnl AC_LBL_C_INIT, doing the tests we now do in AC_LBL_C_INIT_BEFORE_CC,
34 dnl calling AC_PROG_CC, and then doing the tests we now do in
35 dnl AC_LBL_C_INIT. Now, we run AC_LBL_C_INIT_BEFORE_CC, AC_PROG_CC,
36 dnl and AC_LBL_C_INIT at the top level.
37 dnl
38 AC_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
70 dnl
71 dnl Determine which compiler we're using (cc or gcc)
72 dnl If using gcc, determine the version number
73 dnl If using cc:
74 dnl require that it support ansi prototypes
75 dnl use -O (AC_PROG_CC will use -g -O2 on gcc, so we don't need to
76 dnl do that ourselves for gcc)
77 dnl add -g flags, as appropriate
78 dnl explicitly specify /usr/local/include
79 dnl
80 dnl NOTE WELL: with newer versions of autoconf, "gcc" means any compiler
81 dnl that defines __GNUC__, which means clang, for example, counts as "gcc".
82 dnl
83 dnl usage:
84 dnl
85 dnl AC_LBL_C_INIT(copt, incls)
86 dnl
87 dnl results:
88 dnl
89 dnl $1 (copt set)
90 dnl $2 (incls set)
91 dnl CC
92 dnl LDFLAGS
93 dnl LBL_CFLAGS
94 dnl
95 AC_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
234 dnl
235 dnl Check whether, if you pass an unknown warning option to the
236 dnl compiler, it fails or just prints a warning message and succeeds.
237 dnl Set ac_lbl_unknown_warning_option_error to the appropriate flag
238 dnl to force an error if it would otherwise just print a warning message
239 dnl and succeed.
240 dnl
241 AC_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
264 dnl
265 dnl Check whether the compiler option specified as the second argument
266 dnl is supported by the compiler and, if so, add it to the macro
267 dnl specified as the first argument
268 dnl
269 AC_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
299 dnl
300 dnl Check whether the compiler supports an option to generate
301 dnl Makefile-style dependency lines
302 dnl
303 dnl GCC uses -M for this. Non-GCC compilers that support this
304 dnl use a variety of flags, including but not limited to -M.
305 dnl
306 dnl We test whether the flag in question is supported, as older
307 dnl versions of compilers might not support it.
308 dnl
309 dnl We don't try all the possible flags, just in case some flag means
310 dnl "generate dependencies" on one compiler but means something else
311 dnl on another compiler.
312 dnl
313 dnl Most compilers that support this send the output to the standard
314 dnl output by default. IBM's XLC, however, supports -M but sends
315 dnl the output to {sourcefile-basename}.u, and AIX has no /dev/stdout
316 dnl to work around that, so we don't bother with XLC.
317 dnl
318 AC_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
413 dnl
414 dnl Determine what options are needed to build a shared library
415 dnl
416 dnl usage:
417 dnl
418 dnl AC_LBL_SHLIBS_INIT
419 dnl
420 dnl results:
421 dnl
422 dnl V_CCOPT (modified to build position-independent code)
423 dnl V_SHLIB_CMD
424 dnl V_SHLIB_OPT
425 dnl V_SONAME_OPT
426 dnl V_RPATH_OPT
427 dnl
428 AC_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 #
589 AC_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
628 dnl
629 dnl If using gcc, make sure we have ANSI ioctl definitions
630 dnl
631 dnl usage:
632 dnl
633 dnl AC_LBL_FIXINCLUDES
634 dnl
635 AC_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
664 dnl
665 dnl Checks to see if union wait is used with WEXITSTATUS()
666 dnl
667 dnl usage:
668 dnl
669 dnl AC_LBL_UNION_WAIT
670 dnl
671 dnl results:
672 dnl
673 dnl DECLWAITSTATUS (defined)
674 dnl
675 AC_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
693 dnl
694 dnl Checks to see if the sockaddr struct has the 4.4 BSD sa_len member
695 dnl
696 dnl usage:
697 dnl
698 dnl AC_LBL_SOCKADDR_SA_LEN
699 dnl
700 dnl results:
701 dnl
702 dnl HAVE_SOCKADDR_SA_LEN (defined)
703 dnl
704 AC_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
718 dnl
719 dnl Checks to see if there's a sockaddr_storage structure
720 dnl
721 dnl usage:
722 dnl
723 dnl AC_LBL_SOCKADDR_STORAGE
724 dnl
725 dnl results:
726 dnl
727 dnl HAVE_SOCKADDR_STORAGE (defined)
728 dnl
729 AC_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
743 dnl
744 dnl Checks to see if the dl_hp_ppa_info_t struct has the HP-UX 11.00
745 dnl dl_module_id_1 member
746 dnl
747 dnl usage:
748 dnl
749 dnl AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1
750 dnl
751 dnl results:
752 dnl
753 dnl HAVE_HP_PPA_INFO_T_DL_MODULE_ID_1 (defined)
754 dnl
755 dnl NOTE: any compile failure means we conclude that it doesn't have
756 dnl that member, so if we don't have DLPI, don't have a <sys/dlpi_ext.h>
757 dnl header, or have one that doesn't declare a dl_hp_ppa_info_t type,
758 dnl we conclude it doesn't have that member (which is OK, as either we
759 dnl won't be using code that would use that member, or we wouldn't
760 dnl compile in any case).
761 dnl
762 AC_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
777 dnl
778 dnl Checks to see if -R is used
779 dnl
780 dnl usage:
781 dnl
782 dnl AC_LBL_HAVE_RUN_PATH
783 dnl
784 dnl results:
785 dnl
786 dnl ac_cv_lbl_have_run_path (yes or no)
787 dnl
788 AC_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
802 dnl
803 dnl Checks to see if unaligned memory accesses fail
804 dnl
805 dnl usage:
806 dnl
807 dnl AC_LBL_UNALIGNED_ACCESS
808 dnl
809 dnl results:
810 dnl
811 dnl LBL_ALIGN (DEFINED)
812 dnl
813 AC_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 }
880 EOF
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
902 dnl
903 dnl If the file .devel exists:
904 dnl Add some warning flags if the compiler supports them
905 dnl If an os prototype include exists, symlink os-proto.h to it
906 dnl
907 dnl usage:
908 dnl
909 dnl AC_LBL_DEVEL(copt)
910 dnl
911 dnl results:
912 dnl
913 dnl $1 (copt appended)
914 dnl HAVE_OS_PROTO_H (defined)
915 dnl os-proto.h (symlinked)
916 dnl
917 AC_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, -Wmissing-prototypes)
930 AC_LBL_CHECK_COMPILER_OPT($1, -Wstrict-prototypes)
931 AC_LBL_CHECK_COMPILER_OPT($1, -Wdeclaration-after-statement)
932 fi
933 AC_LBL_CHECK_DEPENDENCY_GENERATION_OPT()
934 #
935 # We used to set -n32 for IRIX 6 when not using GCC (presumed
936 # to mean that we're using MIPS C or MIPSpro C); it specified
937 # the "new" faster 32-bit ABI, introduced in IRIX 6.2. I'm
938 # not sure why that would be something to do *only* with a
939 # .devel file; why should the ABI for which we produce code
940 # depend on .devel?
941 #
942 os=`echo $host_os | sed -e 's/\([[0-9]][[0-9]]*\)[[^0-9]].*$/\1/'`
943 name="lbl/os-$os.h"
944 if test -f $name ; then
945 ln -s $name os-proto.h
946 AC_DEFINE(HAVE_OS_PROTO_H, 1,
947 [if there's an os_proto.h for this platform, to use additional prototypes])
948 else
949 AC_MSG_WARN(can't find $name)
950 fi
951 fi])
952
953 dnl
954 dnl Improved version of AC_CHECK_LIB
955 dnl
956 dnl Thanks to John Hawkinson (jhawk@mit.edu)
957 dnl
958 dnl usage:
959 dnl
960 dnl AC_LBL_CHECK_LIB(LIBRARY, FUNCTION [, ACTION-IF-FOUND [,
961 dnl ACTION-IF-NOT-FOUND [, OTHER-LIBRARIES]]])
962 dnl
963 dnl results:
964 dnl
965 dnl LIBS
966 dnl
967 dnl XXX - "AC_LBL_LIBRARY_NET" was redone to use "AC_SEARCH_LIBS"
968 dnl rather than "AC_LBL_CHECK_LIB", so this isn't used any more.
969 dnl We keep it around for reference purposes in case it's ever
970 dnl useful in the future.
971 dnl
972
973 define(AC_LBL_CHECK_LIB,
974 [AC_MSG_CHECKING([for $2 in -l$1])
975 dnl Use a cache variable name containing the library, function
976 dnl name, and extra libraries to link with, because the test really is
977 dnl for library $1 defining function $2, when linked with potinal
978 dnl library $5, not just for library $1. Separate tests with the same
979 dnl $1 and different $2's or $5's may have different results.
980 ac_lib_var=`echo $1['_']$2['_']$5 | sed 'y%./+- %__p__%'`
981 AC_CACHE_VAL(ac_cv_lbl_lib_$ac_lib_var,
982 [ac_save_LIBS="$LIBS"
983 LIBS="-l$1 $5 $LIBS"
984 AC_TRY_LINK(dnl
985 ifelse([$2], [main], , dnl Avoid conflicting decl of main.
986 [/* Override any gcc2 internal prototype to avoid an error. */
987 ]ifelse(AC_LANG, CPLUSPLUS, [#ifdef __cplusplus
988 extern "C"
989 #endif
990 ])dnl
991 [/* We use char because int might match the return type of a gcc2
992 builtin and then its argument prototype would still apply. */
993 char $2();
994 ]),
995 [$2()],
996 eval "ac_cv_lbl_lib_$ac_lib_var=yes",
997 eval "ac_cv_lbl_lib_$ac_lib_var=no")
998 LIBS="$ac_save_LIBS"
999 ])dnl
1000 if eval "test \"`echo '$ac_cv_lbl_lib_'$ac_lib_var`\" = yes"; then
1001 AC_MSG_RESULT(yes)
1002 ifelse([$3], ,
1003 [changequote(, )dnl
1004 ac_tr_lib=HAVE_LIB`echo $1 | sed -e 's/[^a-zA-Z0-9_]/_/g' \
1005 -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
1006 changequote([, ])dnl
1007 AC_DEFINE_UNQUOTED($ac_tr_lib)
1008 LIBS="-l$1 $LIBS"
1009 ], [$3])
1010 else
1011 AC_MSG_RESULT(no)
1012 ifelse([$4], , , [$4
1013 ])dnl
1014 fi
1015 ])
1016
1017 dnl
1018 dnl AC_LBL_LIBRARY_NET
1019 dnl
1020 dnl This test is for network applications that need socket() and
1021 dnl gethostbyname() -ish functions. Under Solaris, those applications
1022 dnl need to link with "-lsocket -lnsl". Under IRIX, they need to link
1023 dnl with "-lnsl" but should *not* link with "-lsocket" because
1024 dnl libsocket.a breaks a number of things (for instance:
1025 dnl gethostbyname() under IRIX 5.2, and snoop sockets under most
1026 dnl versions of IRIX).
1027 dnl
1028 dnl Unfortunately, many application developers are not aware of this,
1029 dnl and mistakenly write tests that cause -lsocket to be used under
1030 dnl IRIX. It is also easy to write tests that cause -lnsl to be used
1031 dnl under operating systems where neither are necessary (or useful),
1032 dnl such as SunOS 4.1.4, which uses -lnsl for TLI.
1033 dnl
1034 dnl This test exists so that every application developer does not test
1035 dnl this in a different, and subtly broken fashion.
1036
1037 dnl It has been argued that this test should be broken up into two
1038 dnl seperate tests, one for the resolver libraries, and one for the
1039 dnl libraries necessary for using Sockets API. Unfortunately, the two
1040 dnl are carefully intertwined and allowing the autoconf user to use
1041 dnl them independantly potentially results in unfortunate ordering
1042 dnl dependancies -- as such, such component macros would have to
1043 dnl carefully use indirection and be aware if the other components were
1044 dnl executed. Since other autoconf macros do not go to this trouble,
1045 dnl and almost no applications use sockets without the resolver, this
1046 dnl complexity has not been implemented.
1047 dnl
1048 dnl The check for libresolv is in case you are attempting to link
1049 dnl statically and happen to have a libresolv.a lying around (and no
1050 dnl libnsl.a).
1051 dnl
1052 AC_DEFUN(AC_LBL_LIBRARY_NET, [
1053 # Most operating systems have gethostbyname() in the default searched
1054 # libraries (i.e. libc):
1055 # Some OSes (eg. Solaris) place it in libnsl
1056 # Some strange OSes (SINIX) have it in libsocket:
1057 AC_SEARCH_LIBS(gethostbyname, nsl socket resolv)
1058 # Unfortunately libsocket sometimes depends on libnsl and
1059 # AC_SEARCH_LIBS isn't up to the task of handling dependencies like this.
1060 if test "$ac_cv_search_gethostbyname" = "no"
1061 then
1062 AC_CHECK_LIB(socket, gethostbyname,
1063 LIBS="-lsocket -lnsl $LIBS", , -lnsl)
1064 fi
1065 AC_SEARCH_LIBS(socket, socket, ,
1066 AC_CHECK_LIB(socket, socket, LIBS="-lsocket -lnsl $LIBS", , -lnsl))
1067 # DLPI needs putmsg under HPUX so test for -lstr while we're at it
1068 AC_SEARCH_LIBS(putmsg, str)
1069 ])
1070
1071 dnl
1072 dnl Test for __attribute__
1073 dnl
1074
1075 AC_DEFUN(AC_C___ATTRIBUTE__, [
1076 AC_MSG_CHECKING(for __attribute__)
1077 AC_CACHE_VAL(ac_cv___attribute__, [
1078 AC_COMPILE_IFELSE([
1079 AC_LANG_SOURCE([[
1080 #include <stdlib.h>
1081
1082 static void foo(void) __attribute__ ((noreturn));
1083
1084 static void
1085 foo(void)
1086 {
1087 exit(1);
1088 }
1089
1090 int
1091 main(int argc, char **argv)
1092 {
1093 foo();
1094 }
1095 ]])],
1096 ac_cv___attribute__=yes,
1097 ac_cv___attribute__=no)])
1098 if test "$ac_cv___attribute__" = "yes"; then
1099 AC_DEFINE(HAVE___ATTRIBUTE__, 1, [define if your compiler has __attribute__])
1100 else
1101 #
1102 # We can't use __attribute__, so we can't use __attribute__((unused)),
1103 # so we define _U_ to an empty string.
1104 #
1105 V_DEFS="$V_DEFS -D_U_=\"\""
1106 fi
1107 AC_MSG_RESULT($ac_cv___attribute__)
1108 ])
1109
1110 dnl
1111 dnl Test whether __attribute__((unused)) can be used without warnings
1112 dnl
1113
1114 AC_DEFUN(AC_C___ATTRIBUTE___UNUSED, [
1115 AC_MSG_CHECKING([whether __attribute__((unused)) can be used without warnings])
1116 AC_CACHE_VAL(ac_cv___attribute___unused, [
1117 save_CFLAGS="$CFLAGS"
1118 CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
1119 AC_COMPILE_IFELSE([
1120 AC_LANG_SOURCE([[
1121 #include <stdlib.h>
1122 #include <stdio.h>
1123
1124 int
1125 main(int argc __attribute((unused)), char **argv __attribute((unused)))
1126 {
1127 printf("Hello, world!\n");
1128 return 0;
1129 }
1130 ]])],
1131 ac_cv___attribute___unused=yes,
1132 ac_cv___attribute___unused=no)])
1133 CFLAGS="$save_CFLAGS"
1134 if test "$ac_cv___attribute___unused" = "yes"; then
1135 V_DEFS="$V_DEFS -D_U_=\"__attribute__((unused))\""
1136 else
1137 V_DEFS="$V_DEFS -D_U_=\"\""
1138 fi
1139 AC_MSG_RESULT($ac_cv___attribute___unused)
1140 ])
1141
1142 dnl
1143 dnl Test whether __attribute__((format)) can be used without warnings
1144 dnl
1145
1146 AC_DEFUN(AC_C___ATTRIBUTE___FORMAT, [
1147 AC_MSG_CHECKING([whether __attribute__((format)) can be used without warnings])
1148 AC_CACHE_VAL(ac_cv___attribute___format, [
1149 save_CFLAGS="$CFLAGS"
1150 CFLAGS="$CFLAGS $ac_lbl_cc_force_warning_errors"
1151 AC_COMPILE_IFELSE([
1152 AC_LANG_SOURCE([[
1153 #include <stdlib.h>
1154
1155 extern int foo(const char *fmt, ...)
1156 __attribute__ ((format (printf, 1, 2)));
1157
1158 int
1159 main(int argc, char **argv)
1160 {
1161 foo("%s", "test");
1162 }
1163 ]])],
1164 ac_cv___attribute___format=yes,
1165 ac_cv___attribute___format=no)])
1166 CFLAGS="$save_CFLAGS"
1167 if test "$ac_cv___attribute___format" = "yes"; then
1168 AC_DEFINE(__ATTRIBUTE___FORMAT_OK, 1,
1169 [define if your compiler allows __attribute__((format)) without a warning])
1170 fi
1171 AC_MSG_RESULT($ac_cv___attribute___format)
1172 ])
1173
1174 dnl
1175 dnl Checks to see if tpacket_stats is defined in linux/if_packet.h
1176 dnl If so then pcap-linux.c can use this to report proper statistics.
1177 dnl
1178 dnl -Scott Barron
1179 dnl
1180 AC_DEFUN(AC_LBL_TPACKET_STATS,
1181 [AC_MSG_CHECKING(if if_packet.h has tpacket_stats defined)
1182 AC_CACHE_VAL(ac_cv_lbl_tpacket_stats,
1183 AC_TRY_COMPILE([
1184 # include <linux/if_packet.h>],
1185 [struct tpacket_stats stats],
1186 ac_cv_lbl_tpacket_stats=yes,
1187 ac_cv_lbl_tpacket_stats=no))
1188 AC_MSG_RESULT($ac_cv_lbl_tpacket_stats)
1189 if test $ac_cv_lbl_tpacket_stats = yes; then
1190 AC_DEFINE(HAVE_TPACKET_STATS,1,[if if_packet.h has tpacket_stats defined])
1191 fi])
1192
1193 dnl
1194 dnl Checks to see if the tpacket_auxdata struct has a tp_vlan_tci member.
1195 dnl
1196 dnl usage:
1197 dnl
1198 dnl AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI
1199 dnl
1200 dnl results:
1201 dnl
1202 dnl HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI (defined)
1203 dnl
1204 dnl NOTE: any compile failure means we conclude that it doesn't have
1205 dnl that member, so if we don't have tpacket_auxdata, we conclude it
1206 dnl doesn't have that member (which is OK, as either we won't be using
1207 dnl code that would use that member, or we wouldn't compile in any case).
1208 dnl
1209 AC_DEFUN(AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI,
1210 [AC_MSG_CHECKING(if tpacket_auxdata struct has tp_vlan_tci member)
1211 AC_CACHE_VAL(ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci,
1212 AC_TRY_COMPILE([
1213 # include <sys/types.h>
1214 # include <linux/if_packet.h>],
1215 [u_int i = sizeof(((struct tpacket_auxdata *)0)->tp_vlan_tci)],
1216 ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci=yes,
1217 ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci=no))
1218 AC_MSG_RESULT($ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci)
1219 if test $ac_cv_lbl_linux_tpacket_auxdata_tp_vlan_tci = yes ; then
1220 HAVE_LINUX_TPACKET_AUXDATA=tp_vlan_tci
1221 AC_SUBST(HAVE_LINUX_TPACKET_AUXDATA)
1222 AC_DEFINE(HAVE_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI,1,[if tp_vlan_tci exists])
1223 fi])
1224
1225 dnl
1226 dnl Checks to see if Solaris has the dl_passive_req_t struct defined
1227 dnl in <sys/dlpi.h>.
1228 dnl
1229 dnl usage:
1230 dnl
1231 dnl AC_LBL_DL_PASSIVE_REQ_T
1232 dnl
1233 dnl results:
1234 dnl
1235 dnl HAVE_DLPI_PASSIVE (defined)
1236 dnl
1237 AC_DEFUN(AC_LBL_DL_PASSIVE_REQ_T,
1238 [AC_MSG_CHECKING(if dl_passive_req_t struct exists)
1239 AC_CACHE_VAL(ac_cv_lbl_has_dl_passive_req_t,
1240 AC_TRY_COMPILE([
1241 # include <sys/types.h>
1242 # include <sys/dlpi.h>],
1243 [u_int i = sizeof(dl_passive_req_t)],
1244 ac_cv_lbl_has_dl_passive_req_t=yes,
1245 ac_cv_lbl_has_dl_passive_req_t=no))
1246 AC_MSG_RESULT($ac_cv_lbl_has_dl_passive_req_t)
1247 if test $ac_cv_lbl_has_dl_passive_req_t = yes ; then
1248 AC_DEFINE(HAVE_DLPI_PASSIVE,1,[if passive_req_t primitive
1249 exists])
1250 fi])