~ubuntu-branches/ubuntu/wily/tcpdump/wily

« back to all changes in this revision

Viewing changes to .pc/50_kfreebsd.diff/configure.in

  • Committer: Package Import Robot
  • Author(s): Logan Rosen
  • Date: 2012-08-08 20:06:38 UTC
  • mfrom: (7.1.12 sid)
  • Revision ID: package-import@ubuntu.com-20120808200638-fzv1zks6p7a1qb2f
Tags: 4.3.0-1ubuntu1
* Merge from Debian unstable. Remaining changes:
  - Add enforcing AppArmor profile.
  - debian/control: Build-Depends on dh-apparmor.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
dnl @(#) $Header: /tcpdump/master/tcpdump/configure.in,v 1.204 2008-11-18 07:39:20 guy Exp $ (LBL)
2
 
dnl
3
 
dnl Copyright (c) 1994, 1995, 1996, 1997
4
 
dnl     The Regents of the University of California.  All rights reserved.
5
 
dnl
6
 
dnl Process this file with autoconf to produce a configure script.
7
 
dnl
8
 
 
9
 
#
10
 
# See
11
 
#
12
 
#       http://ftp.gnu.org/gnu/config/README
13
 
#
14
 
# for the URLs to use to fetch new versions of config.guess and
15
 
# config.sub.
16
 
#
17
 
 
18
 
AC_REVISION($Revision: 1.204 $)
19
 
AC_PREREQ(2.50)
20
 
AC_INIT(tcpdump.c)
21
 
 
22
 
AC_CANONICAL_HOST
23
 
 
24
 
AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS)
25
 
AC_PROG_CC
26
 
AC_LBL_C_INIT(V_CCOPT, V_INCLS)
27
 
AC_LBL_C_INLINE
28
 
AC_C___ATTRIBUTE__
29
 
if test "$ac_cv___attribute__" = "yes"; then
30
 
        AC_C___ATTRIBUTE___FORMAT_FUNCTION_POINTER
31
 
fi
32
 
AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h netdnet/dnetdb.h)
33
 
AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h>
34
 
#include <sys/socket.h>
35
 
#include <net/if.h>])
36
 
if test "$ac_cv_header_net_pfvar_h" = yes; then
37
 
        LOCALSRC="print-pflog.c $LOCALSRC"
38
 
fi
39
 
AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
40
 
#include <sys/socket.h>])
41
 
if test "$ac_cv_header_netinet_if_ether_h" != yes; then
42
 
        #
43
 
        # The simple test didn't work.
44
 
        # Do we need to include <net/if.h> first?
45
 
        # Unset ac_cv_header_netinet_if_ether_h so we don't
46
 
        # treat the previous failure as a cached value and
47
 
        # suppress the next test.
48
 
        #
49
 
        AC_MSG_NOTICE([Rechecking with some additional includes])
50
 
        unset ac_cv_header_netinet_if_ether_h
51
 
        AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h>
52
 
#include <sys/socket.h>
53
 
#include <netinet/in.h>
54
 
struct mbuf;
55
 
struct rtentry;
56
 
#include <net/if.h>])
57
 
fi
58
 
 
59
 
AC_HEADER_TIME
60
 
 
61
 
case "$host_os" in
62
 
 
63
 
darwin*)
64
 
        AC_ARG_ENABLE(universal,
65
 
        AC_HELP_STRING([--disable-universal],[don't build universal on OS X]))
66
 
        if test "$enable_universal" != "no"; then
67
 
                case "$host_os" in
68
 
 
69
 
                darwin9.*)
70
 
                        #
71
 
                        # Leopard.  Build for x86 and 32-bit PowerPC, with
72
 
                        # x86 first.  (That's what Apple does.)
73
 
                        #
74
 
                        V_CCOPT="$V_CCOPT -arch i386 -arch ppc"
75
 
                        LDFLAGS="$LDFLAGS -arch i386 -arch ppc"
76
 
                        ;;
77
 
 
78
 
                darwin10.*)
79
 
                        #
80
 
                        # Snow Leopard.  Build for x86-64 and x86, with
81
 
                        # x86-64 first.  (That's what Apple does.)
82
 
                        #
83
 
                        V_CCOPT="$V_CCOPT -arch x86_64 -arch i386"
84
 
                        LDFLAGS="$LDFLAGS -arch x86_64 -arch i386"
85
 
                        ;;
86
 
                esac
87
 
        fi
88
 
        ;;
89
 
 
90
 
linux*)
91
 
        AC_MSG_CHECKING(Linux kernel version)
92
 
        if test "$cross_compiling" = yes; then
93
 
                AC_CACHE_VAL(ac_cv_linux_vers,
94
 
                    ac_cv_linux_vers=unknown)
95
 
        else
96
 
                AC_CACHE_VAL(ac_cv_linux_vers,
97
 
                    ac_cv_linux_vers=`uname -r 2>&1 | \
98
 
                        sed -n -e '$s/.* //' -e '$s/\..*//p'`)
99
 
        fi
100
 
        AC_MSG_RESULT($ac_cv_linux_vers)
101
 
        if test $ac_cv_linux_vers = unknown ; then
102
 
                AC_MSG_ERROR(cannot determine linux version when cross-compiling)
103
 
        fi
104
 
        if test $ac_cv_linux_vers -lt 2 ; then
105
 
                AC_MSG_ERROR(version 2 or higher required; see the INSTALL doc for more info)
106
 
        fi
107
 
        ;;
108
 
 
109
 
*)
110
 
        ;;
111
 
esac
112
 
 
113
 
 
114
 
AC_ARG_WITH(smi,
115
 
[  --with-smi              link with libsmi (allows to load MIBs on the fly to decode SNMP packets. [default=yes]
116
 
  --without-smi           don't link with libsmi],,
117
 
   with_smi=yes)
118
 
 
119
 
if test "x$with_smi" != "xno" ; then
120
 
AC_CHECK_HEADERS(smi.h)
121
 
AC_CHECK_LIB(smi, smiInit)
122
 
if test "$ac_cv_header_smi_h" = yes -a "$ac_cv_lib_smi_smiInit" = yes
123
 
then
124
 
AC_MSG_CHECKING([whether to enable libsmi])
125
 
        AC_TRY_RUN([ /* libsmi available check */
126
 
#include <smi.h>
127
 
main()
128
 
{
129
 
  int current, revision, age, n;
130
 
  const int required = 2;
131
 
  if (smiInit("")) 
132
 
    exit(1);
133
 
  if (strcmp(SMI_LIBRARY_VERSION, smi_library_version))
134
 
    exit(2);
135
 
  n = sscanf(smi_library_version, "%d:%d:%d", &current, &revision, &age);
136
 
  if (n != 3)
137
 
    exit(3);
138
 
  if (required < current - age || required > current)
139
 
    exit(4);
140
 
  exit(0);
141
 
}
142
 
],
143
 
[ AC_MSG_RESULT(yes)
144
 
  AC_DEFINE(LIBSMI)
145
 
  libsmi=yes],
146
 
dnl autoconf documentation says that $? contains the exit value.
147
 
dnl reality is that it does not.  We leave this in just in case
148
 
dnl autoconf ever comes back to match the documentation.
149
 
[ case $? in
150
 
  1) AC_MSG_RESULT(no - smiInit failed) ;;
151
 
  2) AC_MSG_RESULT(no - header/library version mismatch) ;;
152
 
  3) AC_MSG_RESULT(no - can't determine library version) ;;
153
 
  4) AC_MSG_RESULT(no - too old) ;;
154
 
  *) AC_MSG_RESULT(no) ;;
155
 
  esac
156
 
  libsmi=no],
157
 
[ AC_MSG_RESULT(not when cross-compiling)
158
 
  libsmi=no]
159
 
)
160
 
fi
161
 
fi
162
 
 
163
 
AC_MSG_CHECKING([whether to enable the possibly-buggy SMB printer])
164
 
AC_ARG_ENABLE(smb,
165
 
[  --enable-smb            enable possibly-buggy SMB printer [default=yes]
166
 
  --disable-smb           disable possibly-buggy SMB printer],,
167
 
   enableval=yes)
168
 
case "$enableval" in
169
 
yes)    AC_MSG_RESULT(yes)
170
 
        AC_WARN([The SMB printer may have exploitable buffer overflows!!!])
171
 
        AC_DEFINE(TCPDUMP_DO_SMB)
172
 
        LOCALSRC="print-smb.c smbutil.c $LOCALSRC"
173
 
        ;;
174
 
*)      AC_MSG_RESULT(no)
175
 
        ;;
176
 
esac
177
 
 
178
 
AC_ARG_WITH(user, [  --with-user=USERNAME    drop privileges by default to USERNAME])
179
 
AC_MSG_CHECKING([whether to drop root privileges by default])
180
 
if test ! -z "$with_user" ; then
181
 
        AC_DEFINE_UNQUOTED(WITH_USER, "$withval")
182
 
       AC_MSG_RESULT(to \"$withval\")
183
 
else
184
 
       AC_MSG_RESULT(no)
185
 
fi
186
 
 
187
 
AC_ARG_WITH(chroot, [  --with-chroot=DIRECTORY when dropping privileges, chroot to DIRECTORY])
188
 
AC_MSG_CHECKING([whether to chroot])
189
 
if test ! -z "$with_chroot" && test "$with_chroot" != "no" ; then
190
 
        AC_DEFINE_UNQUOTED(WITH_CHROOT, "$withval")
191
 
       AC_MSG_RESULT(to \"$withval\")
192
 
else
193
 
       AC_MSG_RESULT(no)
194
 
fi
195
 
 
196
 
AC_MSG_CHECKING([whether to enable ipv6])
197
 
AC_ARG_ENABLE(ipv6,
198
 
[  --enable-ipv6           enable ipv6 (with ipv4) support
199
 
  --disable-ipv6          disable ipv6 support],
200
 
[ case "$enableval" in
201
 
yes)   AC_MSG_RESULT(yes)
202
 
       LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c print-babel.c $LOCALSRC"
203
 
       AC_DEFINE(INET6)
204
 
       ipv6=yes
205
 
       ;;
206
 
*)
207
 
       AC_MSG_RESULT(no)
208
 
       ipv6=no
209
 
       ;;
210
 
  esac ],
211
 
 
212
 
  AC_TRY_RUN([ /* AF_INET6 available check */
213
 
#include <sys/types.h>
214
 
#include <sys/socket.h>
215
 
main()
216
 
{
217
 
 if (socket(AF_INET6, SOCK_STREAM, 0) < 0)
218
 
   exit(1);
219
 
 else
220
 
   exit(0);
221
 
}
222
 
],
223
 
[ AC_MSG_RESULT(yes)
224
 
  LOCALSRC="print-ip6.c print-ip6opts.c print-mobility.c print-ripng.c print-icmp6.c print-frag6.c print-rt6.c print-ospf6.c print-dhcp6.c print-babel.c $LOCALSRC"
225
 
  AC_DEFINE(INET6)
226
 
  ipv6=yes],
227
 
[ AC_MSG_RESULT(no)
228
 
  ipv6=no],
229
 
[ AC_MSG_RESULT(no)
230
 
  ipv6=no]
231
 
))
232
 
 
233
 
ipv6type=unknown
234
 
ipv6lib=none
235
 
ipv6trylibc=no
236
 
 
237
 
if test "$ipv6" = "yes"; then
238
 
        AC_MSG_CHECKING([ipv6 stack type])
239
 
        for i in inria kame linux-glibc linux-libinet6 toshiba v6d zeta; do
240
 
                case $i in
241
 
                inria)
242
 
                        dnl http://www.kame.net/
243
 
                        AC_EGREP_CPP(yes,
244
 
[#include <netinet/in.h>
245
 
#ifdef IPV6_INRIA_VERSION
246
 
yes
247
 
#endif],
248
 
                                [ipv6type=$i;
249
 
                                CFLAGS="-DINET6 $CFLAGS"])
250
 
                        ;;
251
 
                kame)
252
 
                        dnl http://www.kame.net/
253
 
                        AC_EGREP_CPP(yes,
254
 
[#include <netinet/in.h>
255
 
#ifdef __KAME__
256
 
yes
257
 
#endif],
258
 
                                [ipv6type=$i;
259
 
                                ipv6lib=inet6;
260
 
                                ipv6libdir=/usr/local/v6/lib;
261
 
                                ipv6trylibc=yes;
262
 
                                CFLAGS="-DINET6 $CFLAGS"])
263
 
                        ;;
264
 
                linux-glibc)
265
 
                        dnl http://www.v6.linux.or.jp/
266
 
                        AC_EGREP_CPP(yes,
267
 
[#include <features.h>
268
 
#if defined(__GLIBC__) && __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
269
 
yes
270
 
#endif],
271
 
                                [ipv6type=$i;
272
 
                                CFLAGS="-DINET6 $CFLAGS"])
273
 
                        ;;
274
 
                linux-libinet6)
275
 
                        dnl http://www.v6.linux.or.jp/
276
 
                        dnl
277
 
                        dnl This also matches Solaris 8 and Tru64 UNIX 5.1,
278
 
                        dnl and possibly other versions of those OSes
279
 
                        dnl
280
 
                        if test -d /usr/inet6 -o -f /usr/include/netinet/ip6.h; then
281
 
                                ipv6type=$i
282
 
                                ipv6lib=inet6
283
 
                                ipv6libdir=/usr/inet6/lib
284
 
                                ipv6trylibc=yes;
285
 
                                CFLAGS="-DINET6 -I/usr/inet6/include $CFLAGS"
286
 
                        fi
287
 
                        ;;
288
 
                toshiba)
289
 
                        AC_EGREP_CPP(yes,
290
 
[#include <sys/param.h>
291
 
#ifdef _TOSHIBA_INET6
292
 
yes
293
 
#endif],
294
 
                                [ipv6type=$i;
295
 
                                ipv6lib=inet6;
296
 
                                ipv6libdir=/usr/local/v6/lib;
297
 
                                CFLAGS="-DINET6 $CFLAGS"])
298
 
                        ;;
299
 
                v6d)
300
 
                        AC_EGREP_CPP(yes,
301
 
[#include </usr/local/v6/include/sys/v6config.h>
302
 
#ifdef __V6D__
303
 
yes
304
 
#endif],
305
 
                                [ipv6type=$i;
306
 
                                ipv6lib=v6;
307
 
                                ipv6libdir=/usr/local/v6/lib;
308
 
                                CFLAGS="-I/usr/local/v6/include $CFLAGS"])
309
 
                        ;;
310
 
                zeta)
311
 
                        AC_EGREP_CPP(yes,
312
 
[#include <sys/param.h>
313
 
#ifdef _ZETA_MINAMI_INET6
314
 
yes
315
 
#endif],
316
 
                                [ipv6type=$i;
317
 
                                ipv6lib=inet6;
318
 
                                ipv6libdir=/usr/local/v6/lib;
319
 
                                CFLAGS="-DINET6 $CFLAGS"])
320
 
                        ;;
321
 
                esac
322
 
                if test "$ipv6type" != "unknown"; then
323
 
                        break
324
 
                fi
325
 
        done
326
 
        AC_MSG_RESULT($ipv6type)
327
 
fi
328
 
 
329
 
if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then
330
 
        if test -d $ipv6libdir -a -f $ipv6libdir/lib$ipv6lib.a; then
331
 
                LIBS="-L$ipv6libdir -l$ipv6lib $LIBS"
332
 
                echo "You have $ipv6lib library, using it"
333
 
        else
334
 
                if test "$ipv6trylibc" = "yes"; then
335
 
                        echo "You do not have $ipv6lib library, using libc"
336
 
                else
337
 
                        echo 'Fatal: no $ipv6lib library found.  cannot continue.'
338
 
                        echo "You need to fetch lib$ipv6lib.a from appropriate"
339
 
                        echo 'ipv6 kit and compile beforehand.'
340
 
                        exit 1
341
 
                fi
342
 
        fi
343
 
fi
344
 
 
345
 
 
346
 
if test "$ipv6" = "yes"; then
347
 
        #
348
 
        # XXX - on Tru64 UNIX 5.1, there is no "getaddrinfo()"
349
 
        # function in libc; there are "ngetaddrinfo()" and
350
 
        # "ogetaddrinfo()" functions, and <netdb.h> #defines
351
 
        # "getaddrinfo" to be either "ngetaddrinfo" or
352
 
        # "ogetaddrinfo", depending on whether _SOCKADDR_LEN
353
 
        # or _XOPEN_SOURCE_EXTENDED are defined or not.
354
 
        #
355
 
        # So this test doesn't work on Tru64 5.1, and possibly
356
 
        # on other 5.x releases.  This causes the configure
357
 
        # script to become confused, and results in libpcap
358
 
        # being unbuildable.
359
 
        #
360
 
        AC_SEARCH_LIBS(getaddrinfo, socket, [dnl
361
 
        AC_MSG_CHECKING(getaddrinfo bug)
362
 
        AC_CACHE_VAL(td_cv_buggygetaddrinfo, [AC_TRY_RUN([
363
 
#include <sys/types.h>
364
 
#include <netdb.h>
365
 
#include <string.h>
366
 
#include <sys/socket.h>
367
 
#include <netinet/in.h>
368
 
 
369
 
main()
370
 
{
371
 
  int passive, gaierr, inet4 = 0, inet6 = 0;
372
 
  struct addrinfo hints, *ai, *aitop;
373
 
  char straddr[INET6_ADDRSTRLEN], strport[16];
374
 
 
375
 
  for (passive = 0; passive <= 1; passive++) {
376
 
    memset(&hints, 0, sizeof(hints));
377
 
    hints.ai_family = AF_UNSPEC;
378
 
    hints.ai_flags = passive ? AI_PASSIVE : 0;
379
 
    hints.ai_socktype = SOCK_STREAM;
380
 
    hints.ai_protocol = IPPROTO_TCP;
381
 
    if ((gaierr = getaddrinfo(NULL, "54321", &hints, &aitop)) != 0) {
382
 
      (void)gai_strerror(gaierr);
383
 
      goto bad;
384
 
    }
385
 
    for (ai = aitop; ai; ai = ai->ai_next) {
386
 
      if (ai->ai_addr == NULL ||
387
 
          ai->ai_addrlen == 0 ||
388
 
          getnameinfo(ai->ai_addr, ai->ai_addrlen,
389
 
                      straddr, sizeof(straddr), strport, sizeof(strport),
390
 
                      NI_NUMERICHOST|NI_NUMERICSERV) != 0) {
391
 
        goto bad;
392
 
      }
393
 
      switch (ai->ai_family) {
394
 
      case AF_INET:
395
 
        if (strcmp(strport, "54321") != 0) {
396
 
          goto bad;
397
 
        }
398
 
        if (passive) {
399
 
          if (strcmp(straddr, "0.0.0.0") != 0) {
400
 
            goto bad;
401
 
          }
402
 
        } else {
403
 
          if (strcmp(straddr, "127.0.0.1") != 0) {
404
 
            goto bad;
405
 
          }
406
 
        }
407
 
        inet4++;
408
 
        break;
409
 
      case AF_INET6:
410
 
        if (strcmp(strport, "54321") != 0) {
411
 
          goto bad;
412
 
        }
413
 
        if (passive) {
414
 
          if (strcmp(straddr, "::") != 0) {
415
 
            goto bad;
416
 
          }
417
 
        } else {
418
 
          if (strcmp(straddr, "::1") != 0) {
419
 
            goto bad;
420
 
          }
421
 
        }
422
 
        inet6++;
423
 
        break;
424
 
      case AF_UNSPEC:
425
 
        goto bad;
426
 
        break;
427
 
#ifdef AF_UNIX
428
 
      case AF_UNIX:
429
 
#else
430
 
#ifdef AF_LOCAL
431
 
      case AF_LOCAL:
432
 
#endif
433
 
#endif
434
 
      default:
435
 
        /* another family support? */
436
 
        break;
437
 
      }
438
 
    }
439
 
  }
440
 
 
441
 
  /* supported family should be 2, unsupported family should be 0 */
442
 
  if (!(inet4 == 0 || inet4 == 2))
443
 
    goto bad;
444
 
  if (!(inet6 == 0 || inet6 == 2))
445
 
    goto bad;
446
 
 
447
 
  if (aitop)
448
 
    freeaddrinfo(aitop);
449
 
  exit(0);
450
 
 
451
 
 bad:
452
 
  if (aitop)
453
 
    freeaddrinfo(aitop);
454
 
  exit(1);
455
 
}
456
 
],
457
 
        td_cv_buggygetaddrinfo=no,
458
 
        td_cv_buggygetaddrinfo=yes,
459
 
        td_cv_buggygetaddrinfo=yes)])
460
 
        if test "$td_cv_buggygetaddrinfo" = no; then
461
 
                AC_MSG_RESULT(good)
462
 
        else
463
 
                AC_MSG_RESULT(buggy)
464
 
        fi
465
 
 
466
 
        if test "$td_cv_buggygetaddrinfo" = "yes"; then
467
 
                #
468
 
                # XXX - it doesn't appear that "ipv6type" can ever be
469
 
                # set to "linux".  Should this be testing for
470
 
                # "linux-glibc", or for that *or* "linux-libinet6"?
471
 
                # If the latter, note that "linux-libinet6" is also
472
 
                # the type given to some non-Linux OSes.
473
 
                #
474
 
                if test "$ipv6type" != "linux"; then
475
 
                        echo 'Fatal: You must get working getaddrinfo() function.'
476
 
                        echo '       or you can specify "--disable-ipv6"'.
477
 
                        exit 1
478
 
                else
479
 
                        echo 'Warning: getaddrinfo() implementation on your system seems be buggy.'
480
 
                        echo '         Better upgrade your system library to newest version'
481
 
                        echo '         of GNU C library (aka glibc).'
482
 
                fi
483
 
        fi
484
 
        ])
485
 
        AC_REPLACE_FUNCS(getnameinfo)
486
 
fi
487
 
 
488
 
AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h],
489
 
[td_cv_decl_netdnet_dnetdb_h_dnet_htoa],
490
 
[AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h,
491
 
        td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes,
492
 
        td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)])
493
 
if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then
494
 
        AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA)
495
 
fi
496
 
 
497
 
dnl
498
 
dnl Checks for addrinfo structure
499
 
AC_STRUCT_ADDRINFO(ac_cv_addrinfo)
500
 
if test "$ac_cv_addrinfo" = no; then
501
 
        missing_includes=yes
502
 
fi
503
 
 
504
 
dnl
505
 
dnl Checks for NI_MAXSERV
506
 
AC_NI_MAXSERV(ac_cv_maxserv)
507
 
if test "$ac_cv_maxserv" = no; then
508
 
        missing_includes=yes
509
 
fi
510
 
 
511
 
dnl
512
 
dnl Checks for NI_NAMEREQD
513
 
AC_NI_NAMEREQD(ac_cv_namereqd)
514
 
if test "$ac_cv_namereqd" = no; then
515
 
        missing_includes=yes
516
 
fi
517
 
 
518
 
dnl
519
 
dnl Checks for sockaddr_storage structure
520
 
AC_STRUCT_SA_STORAGE(ac_cv_sa_storage)
521
 
if test "$ac_cv_sa_storage" = no; then
522
 
        missing_includes=yes
523
 
fi
524
 
 
525
 
AC_REPLACE_FUNCS(vfprintf strcasecmp strlcat strlcpy strdup strsep)
526
 
AC_CHECK_FUNCS(fork vfork strftime)
527
 
AC_CHECK_FUNCS(setlinebuf alarm)
528
 
 
529
 
needsnprintf=no
530
 
AC_CHECK_FUNCS(vsnprintf snprintf,,
531
 
        [needsnprintf=yes])
532
 
if test $needsnprintf = yes; then
533
 
        AC_LIBOBJ(snprintf)
534
 
fi
535
 
 
536
 
AC_LBL_TYPE_SIGNAL
537
 
 
538
 
AC_SEARCH_LIBS(dnet_htoa, dnet, AC_DEFINE(HAVE_DNET_HTOA))
539
 
 
540
 
AC_CHECK_LIB(rpc, main)         dnl It's unclear why we might need -lrpc
541
 
 
542
 
dnl Some platforms may need -lnsl for getrpcbynumber.
543
 
AC_SEARCH_LIBS(getrpcbynumber, nsl, AC_DEFINE(HAVE_GETRPCBYNUMBER))
544
 
 
545
 
dnl AC_CHECK_LIB(z, uncompress)
546
 
dnl AC_CHECK_HEADERS(zlib.h)
547
 
 
548
 
AC_LBL_LIBPCAP(V_PCAPDEP, V_INCLS)
549
 
 
550
 
#
551
 
# Check for these after AC_LBL_LIBPCAP, so we link with the appropriate
552
 
# libraries (e.g., "-lsocket -lnsl" on Solaris).
553
 
#
554
 
# We don't use AC_REPLACE_FUNCS because that uses AC_CHECK_FUNCS which
555
 
# use AC_CHECK_FUNC which doesn't let us specify the right #includes
556
 
# to make this work on BSD/OS 4.x.  BSD/OS 4.x ships with the BIND8
557
 
# resolver, and the way it defines inet_{ntop,pton} is rather strange;
558
 
# it does not ship with a libc symbol "inet_ntop()", it ships with
559
 
# "_inet_ntop()", and has a #define macro in one of the system headers
560
 
# to rename it.
561
 
#
562
 
dnl AC_TRY_COMPILE(inet_ntop inet_pton inet_aton)
563
 
AC_MSG_CHECKING(for inet_ntop)
564
 
AC_TRY_LINK([#include <sys/types.h>
565
 
#include <sys/socket.h>
566
 
#include <netinet/in.h>
567
 
#include <arpa/inet.h>], [char src[4], dst[128];
568
 
inet_ntop(AF_INET, src, dst, sizeof(dst));],
569
 
        [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
570
 
        AC_LIBOBJ(inet_ntop)])
571
 
AC_MSG_CHECKING(for inet_pton)
572
 
AC_TRY_LINK([#include <sys/types.h>
573
 
#include <sys/socket.h>
574
 
#include <netinet/in.h>
575
 
#include <arpa/inet.h>], [char src[128], dst[4];
576
 
inet_pton(AF_INET, src, dst);],
577
 
        [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
578
 
        AC_LIBOBJ(inet_pton)])
579
 
AC_MSG_CHECKING(for inet_aton)
580
 
AC_TRY_LINK([#include <sys/types.h>
581
 
#include <netinet/in.h>
582
 
#include <arpa/inet.h>], [char src[128];
583
 
struct in_addr dst;
584
 
inet_aton(src, &dst);],
585
 
        [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no)
586
 
        AC_LIBOBJ(inet_aton)])
587
 
 
588
 
#
589
 
# Check for these after AC_LBL_LIBPCAP, for the same reason.
590
 
#
591
 
# You are in a twisty little maze of UN*Xes, all different.
592
 
# Some might not have ether_ntohost().
593
 
# Some might have it, but not declare it in any header file.
594
 
# Some might have it, but declare it in <netinet/if_ether.h>.
595
 
# Some might have it, but declare it in <netinet/ether.h>
596
 
# (And some might have it but document it as something declared in
597
 
# <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.)
598
 
#
599
 
# Before you is a C compiler.
600
 
#
601
 
AC_CHECK_FUNCS(ether_ntohost, [
602
 
    AC_CACHE_CHECK(for buggy ether_ntohost, ac_cv_buggy_ether_ntohost, [
603
 
        AC_TRY_RUN([
604
 
                #include <netdb.h>
605
 
                #include <sys/types.h>
606
 
                #include <sys/param.h>
607
 
                #include <sys/socket.h>
608
 
 
609
 
                int
610
 
                main(int argc, char **argv)
611
 
                {
612
 
                        u_char ea[6] = { 0xff, 0xff, 0xff, 0xff, 0xff };
613
 
                        char name[MAXHOSTNAMELEN];
614
 
 
615
 
                        ether_ntohost(name, (struct ether_addr *)ea);
616
 
                        exit(0);
617
 
                }
618
 
        ], [ac_cv_buggy_ether_ntohost=no],
619
 
           [ac_cv_buggy_ether_ntohost=yes],
620
 
           [ac_cv_buggy_ether_ntohost="not while cross-compiling"])])
621
 
    if test "$ac_cv_buggy_ether_ntohost" = "no"; then
622
 
        AC_DEFINE(USE_ETHER_NTOHOST)
623
 
    fi
624
 
])
625
 
if test "$ac_cv_func_ether_ntohost" = yes -a \
626
 
    "$ac_cv_buggy_ether_ntohost" = "no"; then
627
 
        #
628
 
        # OK, we have ether_ntohost().  Do we have <netinet/if_ether.h>?
629
 
        #
630
 
        if test "$ac_cv_header_netinet_if_ether_h" = yes; then
631
 
                #
632
 
                # Yes.  Does it declare ether_ntohost()?
633
 
                #
634
 
                AC_CHECK_DECL(ether_ntohost,
635
 
                    [
636
 
                        AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_NTOHOST,,
637
 
                            [Define to 1 if netinet/if_ether.h declares `ether_ntohost'])
638
 
                    ],,
639
 
                    [
640
 
#include <sys/types.h>
641
 
#include <sys/socket.h>
642
 
#include <netinet/in.h>
643
 
#include <arpa/inet.h>
644
 
struct mbuf;
645
 
struct rtentry;
646
 
#include <net/if.h>
647
 
#include <netinet/if_ether.h>
648
 
                    ])
649
 
        fi
650
 
        #
651
 
        # Did that succeed?
652
 
        #
653
 
        if test "$ac_cv_have_decl_ether_ntohost" != yes; then
654
 
                #
655
 
                # No, how about <netinet/ether.h>, as on Linux?
656
 
                #
657
 
                AC_CHECK_HEADERS(netinet/ether.h)
658
 
                if test "$ac_cv_header_netinet_ether_h" = yes; then
659
 
                        #
660
 
                        # We have it - does it declare ether_ntohost()?
661
 
                        # Unset ac_cv_have_decl_ether_ntohost so we don't
662
 
                        # treat the previous failure as a cached value and
663
 
                        # suppress the next test.
664
 
                        #
665
 
                        unset ac_cv_have_decl_ether_ntohost
666
 
                        AC_CHECK_DECL(ether_ntohost,
667
 
                            [
668
 
                                AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_NTOHOST,,
669
 
                                    [Define to 1 if netinet/ether.h declares `ether_ntohost'])
670
 
                            ],,
671
 
                            [
672
 
#include <netinet/ether.h>
673
 
                            ])
674
 
                fi
675
 
        fi
676
 
        #
677
 
        # Is ether_ntohost() declared?
678
 
        #
679
 
        if test "$ac_cv_have_decl_ether_ntohost" != yes; then
680
 
                #
681
 
                # No, we'll have to declare it ourselves.
682
 
                # Do we have "struct ether_addr"?
683
 
                #
684
 
                AC_CHECK_TYPES(struct ether_addr,,,
685
 
                    [
686
 
#include <sys/types.h>
687
 
#include <sys/socket.h>
688
 
#include <netinet/in.h>
689
 
#include <arpa/inet.h>
690
 
struct mbuf;
691
 
struct rtentry;
692
 
#include <net/if.h>
693
 
#include <netinet/if_ether.h>
694
 
                    ])
695
 
                AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 0,
696
 
                    [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
697
 
don't.])
698
 
        else
699
 
                AC_DEFINE(HAVE_DECL_ETHER_NTOHOST, 1,
700
 
                    [Define to 1 if you have the declaration of `ether_ntohost', and to 0 if you
701
 
don't.])
702
 
        fi
703
 
fi
704
 
 
705
 
# libdlpi is needed for Solaris 11 and later.
706
 
AC_CHECK_LIB(dlpi, dlpi_walk, LIBS="$LIBS -ldlpi" LDFLAGS="-L/lib $LDFLAGS", ,-L/lib)
707
 
 
708
 
dnl portability macros for getaddrinfo/getnameinfo
709
 
dnl
710
 
dnl Check for sa_len
711
 
AC_CHECK_SA_LEN(ac_cv_sockaddr_has_sa_len)
712
 
if test "$ac_cv_sockaddr_has_sa_len" = no; then
713
 
        missing_includes=yes
714
 
fi
715
 
 
716
 
#
717
 
# Do we have the new open API?  Check for pcap_create, and assume that,
718
 
# if we do, we also have pcap_activate() and the other new routines
719
 
# introduced in libpcap 1.0.0.
720
 
#
721
 
AC_CHECK_FUNCS(pcap_create)
722
 
if test $ac_cv_func_pcap_create = "yes" ; then
723
 
        #
724
 
        # OK, do we have pcap_set_tstamp_type?  If so, assume we have
725
 
        # pcap_list_tstamp_types and pcap_free_tstamp_types as well.
726
 
        #
727
 
        AC_CHECK_FUNCS(pcap_set_tstamp_type)
728
 
fi
729
 
 
730
 
AC_CHECK_FUNCS(pcap_findalldevs pcap_dump_flush pcap_lib_version)
731
 
if test $ac_cv_func_pcap_findalldevs = "yes" ; then
732
 
dnl Check for Mac OS X, which may ship pcap.h from 0.6 but libpcap may
733
 
dnl be 0.8; this means that lib has pcap_findalldevs but header doesn't
734
 
dnl have pcap_if_t.
735
 
    savedppflags="$CPPLAGS"
736
 
    CPPFLAGS="$CPPFLAGS $V_INCLS"
737
 
    AC_CHECK_TYPES(pcap_if_t, , , [#include <pcap.h>])
738
 
    CPPFLAGS="$savedcppflags"
739
 
fi
740
 
 
741
 
if test $ac_cv_func_pcap_lib_version = "no" ; then
742
 
    AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
743
 
    AC_TRY_LINK([],
744
 
       [
745
 
        extern char pcap_version[];
746
 
 
747
 
        return (int)pcap_version;
748
 
       ],
749
 
       ac_lbl_cv_pcap_version_defined=yes,
750
 
       ac_lbl_cv_pcap_version_defined=no)
751
 
    if test "$ac_lbl_cv_pcap_version_defined" = yes ; then
752
 
        AC_MSG_RESULT(yes)
753
 
        AC_DEFINE(HAVE_PCAP_VERSION)
754
 
    else
755
 
        AC_MSG_RESULT(no)
756
 
    fi
757
 
fi
758
 
AC_MSG_CHECKING(whether pcap_debug is defined by libpcap)
759
 
AC_TRY_LINK([],
760
 
   [
761
 
        extern int pcap_debug;
762
 
 
763
 
        return pcap_debug;
764
 
   ],
765
 
   ac_lbl_cv_pcap_debug_defined=yes,
766
 
   ac_lbl_cv_pcap_debug_defined=no)
767
 
if test "$ac_lbl_cv_pcap_debug_defined" = yes ; then
768
 
        AC_MSG_RESULT(yes)
769
 
        AC_DEFINE(HAVE_PCAP_DEBUG)
770
 
else
771
 
        AC_MSG_RESULT(no)
772
 
        #
773
 
        # OK, what about "yydebug"?
774
 
        #
775
 
        AC_MSG_CHECKING(whether yydebug is defined by libpcap)
776
 
        AC_TRY_LINK([],
777
 
           [
778
 
                extern int yydebug;
779
 
 
780
 
                return yydebug;
781
 
           ],
782
 
           ac_lbl_cv_yydebug_defined=yes,
783
 
           ac_lbl_cv_yydebug_defined=no)
784
 
        if test "$ac_lbl_cv_yydebug_defined" = yes ; then
785
 
                AC_MSG_RESULT(yes)
786
 
                AC_DEFINE(HAVE_YYDEBUG)
787
 
        else
788
 
                AC_MSG_RESULT(no)
789
 
        fi
790
 
fi
791
 
AC_REPLACE_FUNCS(bpf_dump)      dnl moved to libpcap in 0.6
792
 
 
793
 
V_GROUP=0
794
 
if test -f /etc/group -a ! -z "`grep '^wheel:' /etc/group`" ; then
795
 
        V_GROUP=wheel
796
 
fi
797
 
#
798
 
# Assume V7/BSD convention for man pages (file formats in section 5,
799
 
# miscellaneous info in section 7).
800
 
#
801
 
MAN_FILE_FORMATS=5
802
 
MAN_MISC_INFO=7
803
 
case "$host_os" in
804
 
 
805
 
aix*)
806
 
        dnl Workaround to enable certain features
807
 
        AC_DEFINE(_SUN,1,[define on AIX to get certain functions])
808
 
        ;;
809
 
 
810
 
hpux*)
811
 
        #
812
 
        # Use System V conventions for man pages.
813
 
        #
814
 
        MAN_FILE_FORMATS=4
815
 
        MAN_MISC_INFO=5
816
 
        ;;
817
 
 
818
 
irix*)
819
 
        V_GROUP=sys
820
 
 
821
 
        #
822
 
        # Use System V conventions for man pages.
823
 
        #
824
 
        MAN_FILE_FORMATS=4
825
 
        MAN_MISC_INFO=5
826
 
        ;;
827
 
 
828
 
osf*)
829
 
        V_GROUP=system
830
 
 
831
 
        #
832
 
        # Use System V conventions for man pages.
833
 
        #
834
 
        MAN_FILE_FORMATS=4
835
 
        MAN_MISC_INFO=5
836
 
        ;;
837
 
 
838
 
solaris*)
839
 
        V_GROUP=sys
840
 
 
841
 
        #
842
 
        # Use System V conventions for man pages.
843
 
        #
844
 
        MAN_FILE_FORMATS=4
845
 
        MAN_MISC_INFO=5
846
 
        ;;
847
 
esac
848
 
 
849
 
if test -f /dev/bpf0 ; then
850
 
        V_GROUP=bpf
851
 
fi
852
 
 
853
 
AC_CHECK_HEADERS(sys/bitypes.h)
854
 
 
855
 
AC_CHECK_TYPE([int8_t], ,
856
 
        [AC_DEFINE([int8_t], [signed char],
857
 
        [Define to `signed char' if int8_t not defined.])],
858
 
        [AC_INCLUDES_DEFAULT
859
 
#ifdef HAVE_SYS_BITYPES_H
860
 
#include <sys/bitypes.h>
861
 
#endif])
862
 
AC_CHECK_TYPE([u_int8_t], ,
863
 
        [AC_DEFINE([u_int8_t], [unsigned char],
864
 
        [Define to `unsigned char' if u_int8_t not defined.])],
865
 
        [AC_INCLUDES_DEFAULT
866
 
#ifdef HAVE_SYS_BITYPES_H
867
 
#include <sys/bitypes.h>
868
 
#endif])
869
 
AC_CHECK_TYPE([int16_t], ,
870
 
        [AC_DEFINE([int16_t], [short],
871
 
        [Define to `short' if int16_t not defined.])]
872
 
        [AC_INCLUDES_DEFAULT
873
 
#ifdef HAVE_SYS_BITYPES_H
874
 
#include <sys/bitypes.h>
875
 
#endif])
876
 
AC_CHECK_TYPE([u_int16_t], ,
877
 
        [AC_DEFINE([u_int16_t], [unsigned short],
878
 
        [Define to `unsigned short' if u_int16_t not defined.])],
879
 
        [AC_INCLUDES_DEFAULT
880
 
#ifdef HAVE_SYS_BITYPES_H
881
 
#include <sys/bitypes.h>
882
 
#endif])
883
 
AC_CHECK_TYPE([int32_t], ,
884
 
        [AC_DEFINE([int32_t], [int],
885
 
        [Define to `int' if int32_t not defined.])],
886
 
        [AC_INCLUDES_DEFAULT
887
 
#ifdef HAVE_SYS_BITYPES_H
888
 
#include <sys/bitypes.h>
889
 
#endif])
890
 
AC_CHECK_TYPE([u_int32_t], ,
891
 
        [AC_DEFINE([u_int32_t], [unsigned int],
892
 
        [Define to `unsigned int' if u_int32_t not defined.])],
893
 
        [AC_INCLUDES_DEFAULT
894
 
#ifdef HAVE_SYS_BITYPES_H
895
 
#include <sys/bitypes.h>
896
 
#endif])
897
 
AC_CHECK_TYPE([int64_t], ,
898
 
        [AC_DEFINE([int64_t], [long long],
899
 
        [Define to `long long' if int64_t not defined.])],
900
 
        [AC_INCLUDES_DEFAULT
901
 
#ifdef HAVE_SYS_BITYPES_H
902
 
#include <sys/bitypes.h>
903
 
#endif])
904
 
AC_CHECK_TYPE([u_int64_t], ,
905
 
        [AC_DEFINE([u_int64_t], [unsigned long long],
906
 
        [Define to `unsigned long long' if u_int64_t not defined.])],
907
 
        [AC_INCLUDES_DEFAULT
908
 
#ifdef HAVE_SYS_BITYPES_H
909
 
#include <sys/bitypes.h>
910
 
#endif])
911
 
 
912
 
#
913
 
# We can't just check for <inttypes.h> - some systems have one that
914
 
# doesn't define all the PRI[doxu]64 macros.
915
 
#
916
 
AC_CHECK_HEADERS(inttypes.h,
917
 
  [
918
 
    #
919
 
    # OK, we have inttypes.h, but does it define those macros?
920
 
    #
921
 
    AC_MSG_CHECKING([[whether inttypes.h defines the PRI[doxu]64 macros]])
922
 
    AC_COMPILE_IFELSE(
923
 
      [
924
 
        AC_LANG_SOURCE(
925
 
          [[
926
 
            #include <inttypes.h>
927
 
            #include <stdio.h>
928
 
            #include <sys/types.h>
929
 
            #ifdef HAVE_SYS_BITYPES_H
930
 
            #include <sys/bitypes.h>
931
 
            #endif
932
 
 
933
 
            main()
934
 
            {
935
 
              printf("%" PRId64 "\n", (u_int64_t)1);
936
 
              printf("%" PRIo64 "\n", (u_int64_t)1);
937
 
              printf("%" PRIx64 "\n", (u_int64_t)1);
938
 
              printf("%" PRIu64 "\n", (u_int64_t)1);
939
 
            }
940
 
          ]])
941
 
      ],
942
 
      [
943
 
        AC_MSG_RESULT(yes)
944
 
        ac_lbl_inttypes_h_defines_formats=yes
945
 
      ],
946
 
      [
947
 
        AC_MSG_RESULT(no)
948
 
        ac_lbl_inttypes_h_defines_formats=no
949
 
      ])
950
 
  ],
951
 
  [
952
 
    #
953
 
    # We don't have inttypes.h, so it obviously can't define those
954
 
    # macros.
955
 
    #
956
 
    ac_lbl_inttypes_h_defines_formats=no
957
 
  ])
958
 
if test "$ac_lbl_inttypes_h_defines_formats" = no; then
959
 
  AC_LBL_CHECK_64BIT_FORMAT(l,
960
 
    [
961
 
      AC_LBL_CHECK_64BIT_FORMAT(ll,
962
 
        [
963
 
          AC_LBL_CHECK_64BIT_FORMAT(L,
964
 
            [
965
 
              AC_LBL_CHECK_64BIT_FORMAT(q,
966
 
                [
967
 
                  AC_MSG_ERROR([neither %llx nor %Lx nor %qx worked on a 64-bit integer])
968
 
                ])
969
 
            ])
970
 
        ])
971
 
    ])
972
 
fi
973
 
 
974
 
#
975
 
# Check for some headers introduced in later versions of libpcap
976
 
# and used by some printers.
977
 
#
978
 
# Those headers use the {u_}intN_t types, so we must do this after
979
 
# we check for what's needed to get them defined.
980
 
#
981
 
savedcppflags="$CPPFLAGS"
982
 
CPPFLAGS="$CPPFLAGS $V_INCLS"
983
 
AC_CHECK_HEADERS(pcap/bluetooth.h,,,[#include <tcpdump-stdinc.h>])
984
 
AC_CHECK_HEADERS(pcap/usb.h,,,[#include <tcpdump-stdinc.h>])
985
 
CPPFLAGS="$savedcppflags"
986
 
 
987
 
AC_PROG_RANLIB
988
 
 
989
 
AC_LBL_DEVEL(V_CCOPT)
990
 
 
991
 
AC_LBL_SOCKADDR_SA_LEN
992
 
 
993
 
AC_LBL_UNALIGNED_ACCESS
994
 
 
995
 
AC_VAR_H_ERRNO
996
 
 
997
 
# Check for SSLeay
998
 
AC_MSG_CHECKING(whether to use SSLeay libcrypto)
999
 
# Specify location for both includes and libraries.
1000
 
want_libcrypto=youmama
1001
 
AC_ARG_WITH(crypto,
1002
 
    AS_HELP_STRING([--with-crypto@<:@=PATH@:>@],
1003
 
                   [use SSLeay libcrypto (located in directory PATH, if supplied).  @<:@default=yes, if available@:>@]),
1004
 
[
1005
 
        if test $withval = no
1006
 
        then
1007
 
                want_libcrypto=no
1008
 
                AC_MSG_RESULT(no)
1009
 
        elif test $withval = yes
1010
 
        then
1011
 
                want_libcrypto=yes
1012
 
                AC_MSG_RESULT(yes)
1013
 
        else
1014
 
                want_libcrypto=yes
1015
 
                AC_MSG_RESULT(yes)
1016
 
                crypto_dir=$withval
1017
 
        fi
1018
 
],[
1019
 
        #
1020
 
        # Use libcrypto if it's present, otherwise don't.
1021
 
        #
1022
 
        want_libcrypto=ifavailable
1023
 
        AC_MSG_RESULT([yes, if available])
1024
 
])
1025
 
if test "$want_libcrypto" != "no"; then
1026
 
        AC_CHECK_LIB(crypto, DES_cbc_encrypt)
1027
 
        AC_CHECK_HEADERS(openssl/evp.h)
1028
 
fi
1029
 
 
1030
 
dnl
1031
 
dnl set additional include path if necessary
1032
 
if test "$missing_includes" = "yes"; then
1033
 
        CPPFLAGS="$CPPFLAGS -I$srcdir/missing"
1034
 
        V_INCLS="$V_INCLS -I$srcdir/missing"
1035
 
fi
1036
 
 
1037
 
AC_SUBST(V_CCOPT)
1038
 
AC_SUBST(V_DEFS)
1039
 
AC_SUBST(V_GROUP)
1040
 
AC_SUBST(V_INCLS)
1041
 
AC_SUBST(V_PCAPDEP)
1042
 
AC_SUBST(LOCALSRC)
1043
 
AC_SUBST(MAN_FILE_FORMATS)
1044
 
AC_SUBST(MAN_MISC_INFO)
1045
 
 
1046
 
AC_PROG_INSTALL
1047
 
 
1048
 
AC_CONFIG_HEADER(config.h)
1049
 
 
1050
 
AC_OUTPUT_COMMANDS([if test -f .devel; then
1051
 
        echo timestamp > stamp-h
1052
 
        cat Makefile-devel-adds >> Makefile
1053
 
        make depend
1054
 
fi])
1055
 
AC_OUTPUT(Makefile tcpdump.1)
1056
 
exit 0