The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1 | dnl |
| 2 | dnl Copyright (c) 1994, 1995, 1996, 1997 |
| 3 | dnl The Regents of the University of California. All rights reserved. |
| 4 | dnl |
| 5 | dnl Process this file with autoconf to produce a configure script. |
| 6 | dnl |
| 7 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 8 | # |
| 9 | # See |
| 10 | # |
| 11 | # http://ftp.gnu.org/gnu/config/README |
| 12 | # |
| 13 | # for the URLs to use to fetch new versions of config.guess and |
| 14 | # config.sub. |
| 15 | # |
| 16 | |
| 17 | AC_PREREQ(2.61) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 18 | AC_INIT(pcap.c) |
| 19 | |
| 20 | AC_CANONICAL_SYSTEM |
| 21 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 22 | AC_LBL_C_INIT_BEFORE_CC(V_CCOPT, V_INCLS) |
| 23 | AC_PROG_CC |
| 24 | AC_LBL_C_INIT(V_CCOPT, V_INCLS) |
| 25 | AC_LBL_SHLIBS_INIT |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 26 | AC_LBL_C_INLINE |
| 27 | AC_C___ATTRIBUTE__ |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 28 | if test "$ac_cv___attribute__" = "yes"; then |
| 29 | AC_C___ATTRIBUTE___UNUSED |
| 30 | AC_C___ATTRIBUTE___FORMAT |
| 31 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 32 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 33 | AC_CHECK_HEADERS(sys/bitypes.h) |
| 34 | |
| 35 | AC_CHECK_TYPE([int8_t], , |
| 36 | [AC_DEFINE([int8_t], [signed char], |
| 37 | [Define to `signed char' if int8_t not defined.])], |
| 38 | [AC_INCLUDES_DEFAULT |
| 39 | #ifdef HAVE_SYS_BITYPES_H |
| 40 | #include <sys/bitypes.h> |
| 41 | #endif]) |
| 42 | AC_CHECK_TYPE([u_int8_t], , |
| 43 | [AC_DEFINE([u_int8_t], [unsigned char], |
| 44 | [Define to `unsigned char' if u_int8_t not defined.])], |
| 45 | [AC_INCLUDES_DEFAULT |
| 46 | #ifdef HAVE_SYS_BITYPES_H |
| 47 | #include <sys/bitypes.h> |
| 48 | #endif]) |
| 49 | AC_CHECK_TYPE([int16_t], , |
| 50 | [AC_DEFINE([int16_t], [short], |
| 51 | [Define to `short' if int16_t not defined.])] |
| 52 | [AC_INCLUDES_DEFAULT |
| 53 | #ifdef HAVE_SYS_BITYPES_H |
| 54 | #include <sys/bitypes.h> |
| 55 | #endif]) |
| 56 | AC_CHECK_TYPE([u_int16_t], , |
| 57 | [AC_DEFINE([u_int16_t], [unsigned short], |
| 58 | [Define to `unsigned short' if u_int16_t not defined.])], |
| 59 | [AC_INCLUDES_DEFAULT |
| 60 | #ifdef HAVE_SYS_BITYPES_H |
| 61 | #include <sys/bitypes.h> |
| 62 | #endif]) |
| 63 | AC_CHECK_TYPE([int32_t], , |
| 64 | [AC_DEFINE([int32_t], [int], |
| 65 | [Define to `int' if int32_t not defined.])], |
| 66 | [AC_INCLUDES_DEFAULT |
| 67 | #ifdef HAVE_SYS_BITYPES_H |
| 68 | #include <sys/bitypes.h> |
| 69 | #endif]) |
| 70 | AC_CHECK_TYPE([u_int32_t], , |
| 71 | [AC_DEFINE([u_int32_t], [unsigned int], |
| 72 | [Define to `unsigned int' if u_int32_t not defined.])], |
| 73 | [AC_INCLUDES_DEFAULT |
| 74 | #ifdef HAVE_SYS_BITYPES_H |
| 75 | #include <sys/bitypes.h> |
| 76 | #endif]) |
| 77 | AC_CHECK_TYPE([int64_t], , |
| 78 | [AC_DEFINE([int64_t], [long long], |
| 79 | [Define to `long long' if int64_t not defined.])], |
| 80 | [AC_INCLUDES_DEFAULT |
| 81 | #ifdef HAVE_SYS_BITYPES_H |
| 82 | #include <sys/bitypes.h> |
| 83 | #endif]) |
| 84 | AC_CHECK_TYPE([u_int64_t], , |
| 85 | [AC_DEFINE([u_int64_t], [unsigned long long], |
| 86 | [Define to `unsigned long long' if u_int64_t not defined.])], |
| 87 | [AC_INCLUDES_DEFAULT |
| 88 | #ifdef HAVE_SYS_BITYPES_H |
| 89 | #include <sys/bitypes.h> |
| 90 | #endif]) |
| 91 | |
| 92 | # |
| 93 | # Try to arrange for large file support. |
| 94 | # |
| 95 | AC_SYS_LARGEFILE |
| 96 | AC_FUNC_FSEEKO |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 97 | |
| 98 | dnl |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 99 | dnl Even if <net/bpf.h> were, on all OSes that support BPF, fixed to |
| 100 | dnl include <sys/ioccom.h>, and we were to drop support for older |
| 101 | dnl releases without that fix, so that pcap-bpf.c doesn't need to |
| 102 | dnl include <sys/ioccom.h>, the test program in "AC_LBL_FIXINCLUDES" |
| 103 | dnl in "aclocal.m4" uses it, so we would still have to test for it |
| 104 | dnl and set "HAVE_SYS_IOCCOM_H" if we have it, otherwise |
| 105 | dnl "AC_LBL_FIXINCLUDES" wouldn't work on some platforms such as Solaris. |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 106 | dnl |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 107 | AC_CHECK_HEADERS(sys/ioccom.h sys/select.h sys/sockio.h limits.h) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 108 | AC_CHECK_HEADERS(linux/types.h) |
| 109 | AC_CHECK_HEADERS(linux/if_packet.h netpacket/packet.h netpacket/if_packet.h) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 110 | AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h> |
| 111 | #include <sys/socket.h> |
| 112 | #include <net/if.h>]) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 113 | if test "$ac_cv_header_net_pfvar_h" = yes; then |
| 114 | # |
| 115 | # Check for various PF actions. |
| 116 | # |
| 117 | AC_MSG_CHECKING(whether net/pfvar.h defines PF_NAT through PF_NORDR) |
| 118 | AC_TRY_COMPILE( |
| 119 | [#include <sys/types.h> |
| 120 | #include <sys/socket.h> |
| 121 | #include <net/if.h> |
| 122 | #include <net/pfvar.h>], |
| 123 | [return PF_NAT+PF_NONAT+PF_BINAT+PF_NOBINAT+PF_RDR+PF_NORDR;], |
| 124 | [ |
| 125 | AC_MSG_RESULT(yes) |
| 126 | AC_DEFINE(HAVE_PF_NAT_THROUGH_PF_NORDR, 1, |
| 127 | [define if net/pfvar.h defines PF_NAT through PF_NORDR]) |
| 128 | ], |
| 129 | AC_MSG_RESULT(no)) |
| 130 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 131 | AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h> |
| 132 | #include <sys/socket.h>]) |
| 133 | if test "$ac_cv_header_netinet_if_ether_h" != yes; then |
| 134 | # |
| 135 | # The simple test didn't work. |
| 136 | # Do we need to include <net/if.h> first? |
| 137 | # Unset ac_cv_header_netinet_if_ether_h so we don't |
| 138 | # treat the previous failure as a cached value and |
| 139 | # suppress the next test. |
| 140 | # |
| 141 | AC_MSG_NOTICE([Rechecking with some additional includes]) |
| 142 | unset ac_cv_header_netinet_if_ether_h |
| 143 | AC_CHECK_HEADERS(netinet/if_ether.h, , , [#include <sys/types.h> |
| 144 | #include <sys/socket.h> |
| 145 | #include <netinet/in.h> |
| 146 | struct mbuf; |
| 147 | struct rtentry; |
| 148 | #include <net/if.h>]) |
| 149 | fi |
| 150 | |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 151 | case "$host_os" in |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 152 | linux*|uclinux*) |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 153 | AC_CHECK_HEADERS(linux/sockios.h linux/if_bonding.h,,, |
| 154 | [ |
| 155 | #include <sys/socket.h> |
| 156 | #include <linux/if.h> |
| 157 | ]) |
| 158 | ;; |
| 159 | esac |
| 160 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 161 | AC_LBL_FIXINCLUDES |
| 162 | |
| 163 | AC_CHECK_FUNCS(strerror strlcpy) |
| 164 | |
| 165 | needsnprintf=no |
| 166 | AC_CHECK_FUNCS(vsnprintf snprintf,, |
| 167 | [needsnprintf=yes]) |
| 168 | if test $needsnprintf = yes; then |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 169 | AC_LIBOBJ([snprintf]) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 170 | fi |
| 171 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 172 | needstrtok_r=no |
| 173 | AC_CHECK_FUNCS(strtok_r,, |
| 174 | [needstrtok_r=yes]) |
| 175 | if test $needstrtok_r = yes; then |
| 176 | AC_LIBOBJ([strtok_r]) |
| 177 | fi |
| 178 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 179 | # |
| 180 | # Do this before checking for ether_hostton(), as it's a |
| 181 | # "gethostbyname() -ish function". |
| 182 | # |
| 183 | AC_LBL_LIBRARY_NET |
| 184 | |
| 185 | # |
| 186 | # You are in a twisty little maze of UN*Xes, all different. |
| 187 | # Some might not have ether_hostton(). |
| 188 | # Some might have it, but not declare it in any header file. |
| 189 | # Some might have it, but declare it in <netinet/if_ether.h>. |
| 190 | # Some might have it, but declare it in <netinet/ether.h> |
| 191 | # (And some might have it but document it as something declared in |
| 192 | # <netinet/ethernet.h>, although <netinet/if_ether.h> appears to work.) |
| 193 | # |
| 194 | # Before you is a C compiler. |
| 195 | # |
| 196 | AC_CHECK_FUNCS(ether_hostton) |
| 197 | if test "$ac_cv_func_ether_hostton" = yes; then |
| 198 | # |
| 199 | # OK, we have ether_hostton(). Do we have <netinet/if_ether.h>? |
| 200 | # |
| 201 | if test "$ac_cv_header_netinet_if_ether_h" = yes; then |
| 202 | # |
| 203 | # Yes. Does it declare ether_hostton()? |
| 204 | # |
| 205 | AC_CHECK_DECL(ether_hostton, |
| 206 | [ |
| 207 | AC_DEFINE(NETINET_IF_ETHER_H_DECLARES_ETHER_HOSTTON,, |
| 208 | [Define to 1 if netinet/if_ether.h declares `ether_hostton']) |
| 209 | ],, |
| 210 | [ |
| 211 | #include <sys/types.h> |
| 212 | #include <sys/socket.h> |
| 213 | #include <netinet/in.h> |
| 214 | #include <arpa/inet.h> |
| 215 | struct mbuf; |
| 216 | struct rtentry; |
| 217 | #include <net/if.h> |
| 218 | #include <netinet/if_ether.h> |
| 219 | ]) |
| 220 | fi |
| 221 | # |
| 222 | # Did that succeed? |
| 223 | # |
| 224 | if test "$ac_cv_have_decl_ether_hostton" != yes; then |
| 225 | # |
| 226 | # No, how about <netinet/ether.h>, as on Linux? |
| 227 | # |
| 228 | AC_CHECK_HEADERS(netinet/ether.h) |
| 229 | if test "$ac_cv_header_netinet_ether_h" = yes; then |
| 230 | # |
| 231 | # We have it - does it declare ether_hostton()? |
| 232 | # Unset ac_cv_have_decl_ether_hostton so we don't |
| 233 | # treat the previous failure as a cached value and |
| 234 | # suppress the next test. |
| 235 | # |
| 236 | unset ac_cv_have_decl_ether_hostton |
| 237 | AC_CHECK_DECL(ether_hostton, |
| 238 | [ |
| 239 | AC_DEFINE(NETINET_ETHER_H_DECLARES_ETHER_HOSTTON,, |
| 240 | [Define to 1 if netinet/ether.h declares `ether_hostton']) |
| 241 | ],, |
| 242 | [ |
| 243 | #include <netinet/ether.h> |
| 244 | ]) |
| 245 | fi |
| 246 | fi |
| 247 | # |
| 248 | # Is ether_hostton() declared? |
| 249 | # |
| 250 | if test "$ac_cv_have_decl_ether_hostton" != yes; then |
| 251 | # |
| 252 | # No, we'll have to declare it ourselves. |
| 253 | # Do we have "struct ether_addr"? |
| 254 | # |
| 255 | AC_CHECK_TYPES(struct ether_addr,,, |
| 256 | [ |
| 257 | #include <sys/types.h> |
| 258 | #include <sys/socket.h> |
| 259 | #include <netinet/in.h> |
| 260 | #include <arpa/inet.h> |
| 261 | struct mbuf; |
| 262 | struct rtentry; |
| 263 | #include <net/if.h> |
| 264 | #include <netinet/if_ether.h> |
| 265 | ]) |
| 266 | AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 0, |
| 267 | [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you |
| 268 | don't.]) |
| 269 | else |
| 270 | AC_DEFINE(HAVE_DECL_ETHER_HOSTTON, 1, |
| 271 | [Define to 1 if you have the declaration of `ether_hostton', and to 0 if you |
| 272 | don't.]) |
| 273 | fi |
| 274 | fi |
| 275 | |
| 276 | dnl to pacify those who hate protochain insn |
| 277 | AC_MSG_CHECKING(if --disable-protochain option is specified) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 278 | AC_ARG_ENABLE(protochain, |
| 279 | AC_HELP_STRING([--disable-protochain],[disable \"protochain\" insn])) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 280 | case "x$enable_protochain" in |
| 281 | xyes) enable_protochain=enabled ;; |
| 282 | xno) enable_protochain=disabled ;; |
| 283 | x) enable_protochain=enabled ;; |
| 284 | esac |
| 285 | |
| 286 | if test "$enable_protochain" = "disabled"; then |
| 287 | AC_DEFINE(NO_PROTOCHAIN,1,[do not use protochain]) |
| 288 | fi |
| 289 | AC_MSG_RESULT(${enable_protochain}) |
| 290 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 291 | # |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 292 | # valgrindtest directly uses the native capture mechanism, but |
| 293 | # only tests with BPF and PF_PACKET sockets; only enable it if |
| 294 | # we have BPF or PF_PACKET sockets. |
| 295 | # |
| 296 | VALGRINDTEST= |
| 297 | |
| 298 | # |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 299 | # SITA support is mutually exclusive with native capture support; |
| 300 | # "--with-sita" selects SITA support. |
| 301 | # |
| 302 | AC_ARG_WITH(sita, |
| 303 | AC_HELP_STRING([--with-sita],[include SITA support]), |
| 304 | [ |
| 305 | if test ! "x$withval" = "xno" ; then |
| 306 | AC_DEFINE(SITA,1,[include ACN support]) |
| 307 | AC_MSG_NOTICE(Enabling SITA ACN support) |
| 308 | V_PCAP=sita |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 309 | fi |
| 310 | ], |
| 311 | [ |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 312 | dnl |
| 313 | dnl Not all versions of test support -c (character special) but it's a |
| 314 | dnl better way of testing since the device might be protected. So we |
| 315 | dnl check in our normal order using -r and then check the for the /dev |
| 316 | dnl guys again using -c. |
| 317 | dnl |
| 318 | dnl XXX This could be done for cross-compiling, but for now it's not. |
| 319 | dnl |
| 320 | if test -z "$with_pcap" && test "$cross_compiling" = yes; then |
| 321 | AC_MSG_ERROR(pcap type not determined when cross-compiling; use --with-pcap=...) |
| 322 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 323 | AC_ARG_WITH(pcap, |
| 324 | AC_HELP_STRING([--with-pcap=TYPE],[use packet capture TYPE])) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 325 | AC_MSG_CHECKING(packet capture type) |
| 326 | if test ! -z "$with_pcap" ; then |
| 327 | V_PCAP="$withval" |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 328 | elif test -r /dev/bpf -o -h /dev/bpf ; then |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 329 | # |
| 330 | # Cloning BPF device. |
| 331 | # |
| 332 | V_PCAP=bpf |
| 333 | AC_DEFINE(HAVE_CLONING_BPF,1,[define if you have a cloning BPF device]) |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 334 | |
| 335 | # |
| 336 | # We have BPF, so build valgrindtest with "make test". |
| 337 | # |
| 338 | VALGRINDTEST=valgrindtest |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 339 | elif test -r /dev/bpf0 ; then |
| 340 | V_PCAP=bpf |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 341 | |
| 342 | # |
| 343 | # We have BPF, so build valgrindtest with "make test". |
| 344 | # |
| 345 | VALGRINDTEST=valgrindtest |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 346 | elif test -r /usr/include/net/pfilt.h ; then |
| 347 | V_PCAP=pf |
| 348 | elif test -r /dev/enet ; then |
| 349 | V_PCAP=enet |
| 350 | elif test -r /dev/nit ; then |
| 351 | V_PCAP=snit |
| 352 | elif test -r /usr/include/sys/net/nit.h ; then |
| 353 | V_PCAP=nit |
| 354 | elif test -r /usr/include/linux/socket.h ; then |
| 355 | V_PCAP=linux |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 356 | |
| 357 | # |
| 358 | # XXX - this won't work with older kernels that have SOCK_PACKET |
| 359 | # sockets but not PF_PACKET sockets. |
| 360 | # |
| 361 | VALGRINDTEST=valgrindtest |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 362 | elif test -r /usr/include/net/raw.h ; then |
| 363 | V_PCAP=snoop |
| 364 | elif test -r /usr/include/odmi.h ; then |
| 365 | # |
| 366 | # On AIX, the BPF devices might not yet be present - they're |
| 367 | # created the first time libpcap runs after booting. |
| 368 | # We check for odmi.h instead. |
| 369 | # |
| 370 | V_PCAP=bpf |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 371 | elif test -c /dev/bpf0 ; then # check again in case not readable |
| 372 | V_PCAP=bpf |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 373 | |
| 374 | # |
| 375 | # We have BPF, so build valgrindtest with "make test". |
| 376 | # |
| 377 | VALGRINDTEST=valgrindtest |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 378 | elif test -r /usr/include/sys/dlpi.h ; then |
| 379 | V_PCAP=dlpi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 380 | elif test -c /dev/enet ; then # check again in case not readable |
| 381 | V_PCAP=enet |
| 382 | elif test -c /dev/nit ; then # check again in case not readable |
| 383 | V_PCAP=snit |
| 384 | else |
| 385 | V_PCAP=null |
| 386 | fi |
| 387 | AC_MSG_RESULT($V_PCAP) |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 388 | AC_SUBST(VALGRINDTEST) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 389 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 390 | # |
| 391 | # Do capture-mechanism-dependent tests. |
| 392 | # |
| 393 | case "$V_PCAP" in |
| 394 | dlpi) |
| 395 | # |
| 396 | # Needed for common functions used by pcap-[dlpi,libdlpi].c |
| 397 | # |
| 398 | SSRC="dlpisubs.c" |
| 399 | |
| 400 | # |
| 401 | # Checks for some header files. |
| 402 | # |
| 403 | AC_CHECK_HEADERS(sys/bufmod.h sys/dlpi_ext.h) |
| 404 | |
| 405 | # |
| 406 | # Checks to see if Solaris has the public libdlpi(3LIB) library. |
| 407 | # Note: The existence of /usr/include/libdlpi.h does not mean it is the |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 408 | # public libdlpi(3LIB) version. Before libdlpi was made public, a |
| 409 | # private version also existed, which did not have the same APIs. |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 410 | # Due to a gcc bug, the default search path for 32-bit libraries does |
| 411 | # not include /lib, we add it explicitly here. |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 412 | # [http://bugs.opensolaris.org/view_bug.do?bug_id=6619485]. |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 413 | # Also, due to the bug above applications that link to libpcap with |
| 414 | # libdlpi will have to add "-L/lib" option to "configure". |
| 415 | # |
| 416 | saved_ldflags=$LDFLAGS |
| 417 | LDFLAGS="$LIBS -L/lib" |
| 418 | AC_CHECK_LIB(dlpi, dlpi_walk, |
| 419 | [ |
| 420 | LIBS="-ldlpi $LIBS" |
| 421 | V_PCAP=libdlpi |
| 422 | AC_DEFINE(HAVE_LIBDLPI,1,[if libdlpi exists]) |
| 423 | ], |
| 424 | V_PCAP=dlpi) |
| 425 | LDFLAGS=$saved_ldflags |
| 426 | |
| 427 | # |
| 428 | # Checks whether <sys/dlpi.h> is usable, to catch weird SCO |
| 429 | # versions of DLPI. |
| 430 | # |
| 431 | AC_MSG_CHECKING(whether <sys/dlpi.h> is usable) |
| 432 | AC_CACHE_VAL(ac_cv_sys_dlpi_usable, |
| 433 | AC_TRY_COMPILE( |
| 434 | [ |
| 435 | #include <sys/types.h> |
| 436 | #include <sys/time.h> |
| 437 | #include <sys/dlpi.h> |
| 438 | ], |
| 439 | [int i = DL_PROMISC_PHYS;], |
| 440 | ac_cv_sys_dlpi_usable=yes, |
| 441 | ac_cv_sys_dlpi_usable=no)) |
| 442 | AC_MSG_RESULT($ac_cv_sys_dlpi_usable) |
| 443 | if test $ac_cv_sys_dlpi_usable = no ; then |
| 444 | AC_MSG_ERROR(<sys/dlpi.h> is not usable on this system; it probably has a non-standard DLPI) |
| 445 | fi |
| 446 | |
| 447 | # |
| 448 | # Check whether we have a /dev/dlpi device or have multiple devices. |
| 449 | # |
| 450 | AC_MSG_CHECKING(for /dev/dlpi device) |
| 451 | if test -c /dev/dlpi ; then |
| 452 | AC_MSG_RESULT(yes) |
| 453 | AC_DEFINE(HAVE_DEV_DLPI, 1, [define if you have a /dev/dlpi]) |
| 454 | else |
| 455 | AC_MSG_RESULT(no) |
| 456 | dir="/dev/dlpi" |
| 457 | AC_MSG_CHECKING(for $dir directory) |
| 458 | if test -d $dir ; then |
| 459 | AC_MSG_RESULT(yes) |
| 460 | AC_DEFINE_UNQUOTED(PCAP_DEV_PREFIX, "$dir", [/dev/dlpi directory]) |
| 461 | else |
| 462 | AC_MSG_RESULT(no) |
| 463 | fi |
| 464 | fi |
| 465 | |
| 466 | # |
| 467 | # This check is for Solaris with DLPI support for passive modes. |
| 468 | # See dlpi(7P) for more details. |
| 469 | # |
| 470 | AC_LBL_DL_PASSIVE_REQ_T |
| 471 | ;; |
| 472 | |
| 473 | linux) |
| 474 | # |
| 475 | # Do we have the wireless extensions? |
| 476 | # |
| 477 | AC_CHECK_HEADERS(linux/wireless.h, [], [], |
| 478 | [ |
| 479 | #include <sys/socket.h> |
| 480 | #include <linux/if.h> |
| 481 | #include <linux/types.h> |
| 482 | ]) |
| 483 | |
| 484 | # |
| 485 | # Do we have libnl? |
| 486 | # |
| 487 | AC_ARG_WITH(libnl, |
| 488 | AC_HELP_STRING([--without-libnl],[disable libnl support @<:@default=yes, on Linux, if present@:>@]), |
| 489 | with_libnl=$withval,,) |
| 490 | |
| 491 | if test x$with_libnl != xno ; then |
| 492 | have_any_nl="no" |
| 493 | |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 494 | incdir=-I/usr/include/libnl3 |
| 495 | libnldir= |
| 496 | if test x$withval != x ; then |
| 497 | libnldir=-L${withval}/lib/.libs |
| 498 | incdir=-I${withval}/include |
| 499 | fi |
| 500 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 501 | # |
| 502 | # Try libnl 3.x first. |
| 503 | # |
| 504 | AC_CHECK_LIB(nl-3, nl_socket_alloc, |
| 505 | [ |
| 506 | # |
| 507 | # Yes, we have libnl 3.x. |
| 508 | # |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 509 | LIBS="${libnldir} -lnl-genl-3 -lnl-3 $LIBS" |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 510 | AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]) |
| 511 | AC_DEFINE(HAVE_LIBNL_3_x,1,[if libnl exists and is version 3.x]) |
| 512 | AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE]) |
| 513 | AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api]) |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 514 | V_INCLS="$V_INCLS ${incdir}" |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 515 | have_any_nl="yes" |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 516 | ],[], ${incdir} ${libnldir} -lnl-genl-3 -lnl-3 ) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 517 | |
| 518 | if test x$have_any_nl = xno ; then |
| 519 | # |
| 520 | # Try libnl 2.x |
| 521 | # |
| 522 | AC_CHECK_LIB(nl, nl_socket_alloc, |
| 523 | [ |
| 524 | # |
| 525 | # Yes, we have libnl 2.x. |
| 526 | # |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 527 | LIBS="${libnldir} -lnl-genl -lnl $LIBS" |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 528 | AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]) |
| 529 | AC_DEFINE(HAVE_LIBNL_2_x,1,[if libnl exists and is version 2.x]) |
| 530 | AC_DEFINE(HAVE_LIBNL_NLE,1,[libnl has NLE_FAILURE]) |
| 531 | AC_DEFINE(HAVE_LIBNL_SOCKETS,1,[libnl has new-style socket api]) |
| 532 | have_any_nl="yes" |
| 533 | ]) |
| 534 | fi |
| 535 | |
| 536 | if test x$have_any_nl = xno ; then |
| 537 | # |
| 538 | # No, we don't; do we have libnl 1.x? |
| 539 | # |
| 540 | AC_CHECK_LIB(nl, nl_handle_alloc, |
| 541 | [ |
| 542 | # |
| 543 | # Yes. |
| 544 | # |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 545 | LIBS="${libnldir} -lnl $LIBS" |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 546 | AC_DEFINE(HAVE_LIBNL,1,[if libnl exists]) |
| 547 | have_any_nl="yes" |
| 548 | ]) |
| 549 | fi |
| 550 | |
| 551 | if test x$have_any_nl = xno ; then |
| 552 | # |
| 553 | # No, we don't have libnl at all. |
| 554 | # |
| 555 | if test x$with_libnl = xyes ; then |
| 556 | AC_MSG_ERROR([libnl support requested but libnl not found]) |
| 557 | fi |
| 558 | fi |
| 559 | fi |
| 560 | |
| 561 | AC_CHECK_HEADERS(linux/ethtool.h,,, |
| 562 | [ |
| 563 | AC_INCLUDES_DEFAULT |
| 564 | #include <linux/types.h> |
| 565 | ]) |
| 566 | AC_LBL_TPACKET_STATS |
| 567 | AC_LBL_LINUX_TPACKET_AUXDATA_TP_VLAN_TCI |
| 568 | ;; |
| 569 | |
| 570 | bpf) |
| 571 | # |
| 572 | # Check whether we have the *BSD-style ioctls. |
| 573 | # |
| 574 | AC_CHECK_HEADERS(net/if_media.h) |
| 575 | |
| 576 | AC_MSG_CHECKING(whether the system supports zerocopy BPF) |
| 577 | AC_TRY_COMPILE( |
| 578 | [#include <sys/socket.h> |
| 579 | #include <sys/ioctl.h> |
| 580 | #include <net/if.h> |
| 581 | #include <net/bpf.h>], |
| 582 | [return (BIOCROTZBUF + BPF_BUFMODE_ZBUF);], |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 583 | [ |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 584 | AC_MSG_RESULT(yes) |
| 585 | AC_DEFINE(HAVE_ZEROCOPY_BPF, 1, |
| 586 | [define if the system supports zerocopy BPF]) |
| 587 | ], |
| 588 | AC_MSG_RESULT(no)) |
| 589 | |
| 590 | # |
| 591 | # Check whether we have struct BPF_TIMEVAL. |
| 592 | # |
| 593 | AC_CHECK_TYPES(struct BPF_TIMEVAL,,, |
| 594 | [ |
| 595 | #include <sys/types.h> |
| 596 | #include <sys/ioctl.h> |
| 597 | #ifdef HAVE_SYS_IOCCOM_H |
| 598 | #include <sys/ioccom.h> |
| 599 | #endif |
| 600 | #include <net/bpf.h> |
| 601 | ]) |
| 602 | ;; |
| 603 | |
| 604 | dag) |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 605 | # |
| 606 | # --with-pcap=dag is the only way to get here, and it means |
| 607 | # "DAG support but nothing else" |
| 608 | # |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 609 | V_DEFS="$V_DEFS -DDAG_ONLY" |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 610 | xxx_only=yes |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 611 | ;; |
| 612 | |
| 613 | septel) |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 614 | # |
| 615 | # --with-pcap=septel is the only way to get here, and it means |
| 616 | # "Septel support but nothing else" |
| 617 | # |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 618 | V_DEFS="$V_DEFS -DSEPTEL_ONLY" |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 619 | xxx_only=yes |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 620 | ;; |
| 621 | |
| 622 | snf) |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 623 | # |
| 624 | # --with-pcap=snf is the only way to get here, and it means |
| 625 | # "SNF support but nothing else" |
| 626 | # |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 627 | V_DEFS="$V_DEFS -DSNF_ONLY" |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 628 | xxx_only=yes |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 629 | ;; |
| 630 | |
| 631 | null) |
| 632 | AC_MSG_WARN(cannot determine packet capture interface) |
| 633 | AC_MSG_WARN((see the INSTALL doc for more info)) |
| 634 | ;; |
| 635 | esac |
| 636 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 637 | dnl |
| 638 | dnl Now figure out how we get a list of interfaces and addresses, |
| 639 | dnl if we support capturing. Don't bother if we don't support |
| 640 | dnl capturing. |
| 641 | dnl |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 642 | if test "$V_PCAP" != null |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 643 | then |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 644 | AC_CHECK_FUNC(getifaddrs,[ |
| 645 | # |
| 646 | # We have "getifaddrs()"; make sure we have <ifaddrs.h> |
| 647 | # as well, just in case some platform is really weird. |
| 648 | # |
| 649 | AC_CHECK_HEADER(ifaddrs.h,[ |
| 650 | # |
| 651 | # We have the header, so we use "getifaddrs()" to |
| 652 | # get the list of interfaces. |
| 653 | # |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 654 | V_FINDALLDEVS=fad-getad.c |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 655 | ],[ |
| 656 | # |
| 657 | # We don't have the header - give up. |
| 658 | # XXX - we could also fall back on some other |
| 659 | # mechanism, but, for now, this'll catch this |
| 660 | # problem so that we can at least try to figure |
| 661 | # out something to do on systems with "getifaddrs()" |
| 662 | # but without "ifaddrs.h", if there is something |
| 663 | # we can do on those systems. |
| 664 | # |
| 665 | AC_MSG_ERROR([Your system has getifaddrs() but doesn't have a usable <ifaddrs.h>.]) |
| 666 | ]) |
| 667 | ],[ |
| 668 | # |
| 669 | # Well, we don't have "getifaddrs()", so we have to use |
| 670 | # some other mechanism; determine what that mechanism is. |
| 671 | # |
| 672 | # The first thing we use is the type of capture mechanism, |
| 673 | # which is somewhat of a proxy for the OS we're using. |
| 674 | # |
| 675 | case "$V_PCAP" in |
| 676 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 677 | dlpi|libdlpi) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 678 | # |
| 679 | # This might be Solaris 8 or later, with |
| 680 | # SIOCGLIFCONF, or it might be some other OS |
| 681 | # or some older version of Solaris, with |
| 682 | # just SIOCGIFCONF. |
| 683 | # |
| 684 | AC_MSG_CHECKING(whether we have SIOCGLIFCONF) |
| 685 | AC_CACHE_VAL(ac_cv_lbl_have_siocglifconf, |
| 686 | AC_TRY_COMPILE( |
| 687 | [#include <sys/param.h> |
| 688 | #include <sys/file.h> |
| 689 | #include <sys/ioctl.h> |
| 690 | #include <sys/socket.h> |
| 691 | #include <sys/sockio.h>], |
| 692 | [ioctl(0, SIOCGLIFCONF, (char *)0);], |
| 693 | ac_cv_lbl_have_siocglifconf=yes, |
| 694 | ac_cv_lbl_have_siocglifconf=no)) |
| 695 | AC_MSG_RESULT($ac_cv_lbl_have_siocglifconf) |
| 696 | if test $ac_cv_lbl_have_siocglifconf = yes ; then |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 697 | V_FINDALLDEVS=fad-glifc.c |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 698 | else |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 699 | V_FINDALLDEVS=fad-gifc.c |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 700 | fi |
| 701 | ;; |
| 702 | |
| 703 | *) |
| 704 | # |
| 705 | # Assume we just have SIOCGIFCONF. |
| 706 | # (XXX - on at least later Linux kernels, there's |
| 707 | # another mechanism, and we should be using that |
| 708 | # instead.) |
| 709 | # |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 710 | V_FINDALLDEVS=fad-gifc.c |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 711 | ;; |
| 712 | esac]) |
| 713 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 714 | ]) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 715 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 716 | AC_MSG_CHECKING(for socklen_t) |
| 717 | AC_TRY_COMPILE([ |
| 718 | #include <sys/types.h> |
| 719 | #include <sys/socket.h> |
| 720 | ], |
| 721 | [ socklen_t x; ], |
| 722 | have_socklen_t=yes, |
| 723 | have_socklen_t=no) |
| 724 | if test "x$have_socklen_t" = "xyes"; then |
| 725 | AC_DEFINE(HAVE_SOCKLEN_T, 1, [define if socklen_t is defined]) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 726 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 727 | AC_MSG_RESULT($have_socklen_t) |
| 728 | |
| 729 | AC_ARG_ENABLE(ipv6, |
| 730 | AC_HELP_STRING([--enable-ipv6],[build IPv6-capable version @<:@default=yes, if getaddrinfo available@:>@]), |
| 731 | [], |
| 732 | [enable_ipv6=ifavailable]) |
| 733 | if test "$enable_ipv6" != "no"; then |
| 734 | AC_CHECK_FUNC(getaddrinfo, |
| 735 | [ |
| 736 | AC_DEFINE(INET6,1,[IPv6]) |
| 737 | ], |
| 738 | [ |
| 739 | if test "$enable_ipv6" != "ifavailable"; then |
| 740 | AC_MSG_FAILURE([--enable-ipv6 was given, but getaddrinfo isn't available]) |
| 741 | fi |
| 742 | ]) |
| 743 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 744 | |
| 745 | AC_MSG_CHECKING(whether to build optimizer debugging code) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 746 | AC_ARG_ENABLE(optimizer-dbg, |
| 747 | AC_HELP_STRING([--enable-optimizer-dbg],[build optimizer debugging code])) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 748 | if test "$enable_optimizer_dbg" = "yes"; then |
| 749 | AC_DEFINE(BDEBUG,1,[Enable optimizer debugging]) |
| 750 | fi |
| 751 | AC_MSG_RESULT(${enable_optimizer_dbg-no}) |
| 752 | |
| 753 | AC_MSG_CHECKING(whether to build parser debugging code) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 754 | AC_ARG_ENABLE(yydebug, |
| 755 | AC_HELP_STRING([--enable-yydebug],[build parser debugging code])) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 756 | if test "$enable_yydebug" = "yes"; then |
| 757 | AC_DEFINE(YYDEBUG,1,[Enable parser debugging]) |
| 758 | fi |
| 759 | AC_MSG_RESULT(${enable_yydebug-no}) |
| 760 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 761 | # Check for Endace DAG card support. |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 762 | AC_ARG_WITH([dag], |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 763 | AC_HELP_STRING([--with-dag@<:@=DIR@:>@],[include Endace DAG support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]), |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 764 | [ |
| 765 | if test "$withval" = no |
| 766 | then |
| 767 | # User doesn't want DAG support. |
| 768 | want_dag=no |
| 769 | elif test "$withval" = yes |
| 770 | then |
| 771 | # User wants DAG support but hasn't specified a directory. |
| 772 | want_dag=yes |
| 773 | else |
| 774 | # User wants DAG support and has specified a directory, so use the provided value. |
| 775 | want_dag=yes |
| 776 | dag_root=$withval |
| 777 | fi |
| 778 | ],[ |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 779 | if test "$V_PCAP" = dag; then |
| 780 | # User requested DAG-only libpcap, so we'd better have |
| 781 | # the DAG API. |
| 782 | want_dag=yes |
| 783 | elif test "xxx_only" = yes; then |
| 784 | # User requested something-else-only pcap, so they don't |
| 785 | # want DAG support. |
| 786 | want_dag=no |
| 787 | else |
| 788 | # |
| 789 | # Use DAG API if present, otherwise don't |
| 790 | # |
| 791 | want_dag=ifpresent |
| 792 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 793 | ]) |
| 794 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 795 | AC_ARG_WITH([dag-includes], |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 796 | AC_HELP_STRING([--with-dag-includes=IDIR],[Endace DAG include directory, if not DIR/include]), |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 797 | [ |
| 798 | # User wants DAG support and has specified a header directory, so use the provided value. |
| 799 | want_dag=yes |
| 800 | dag_include_dir=$withval |
| 801 | ],[]) |
| 802 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 803 | AC_ARG_WITH([dag-libraries], |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 804 | AC_HELP_STRING([--with-dag-libraries=LDIR],[Endace DAG library directory, if not DIR/lib]), |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 805 | [ |
| 806 | # User wants DAG support and has specified a library directory, so use the provided value. |
| 807 | want_dag=yes |
| 808 | dag_lib_dir=$withval |
| 809 | ],[]) |
| 810 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 811 | ac_cv_lbl_dag_api=no |
| 812 | if test "$want_dag" != no; then |
| 813 | |
| 814 | AC_MSG_CHECKING([whether we have DAG API headers]) |
| 815 | |
| 816 | # If necessary, set default paths for DAG API headers and libraries. |
| 817 | if test -z "$dag_root"; then |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 818 | dag_root=/usr/local |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 819 | fi |
| 820 | |
| 821 | if test -z "$dag_include_dir"; then |
| 822 | dag_include_dir="$dag_root/include" |
| 823 | fi |
| 824 | |
| 825 | if test -z "$dag_lib_dir"; then |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 826 | dag_lib_dir="$dag_root/lib" |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 827 | fi |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 828 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 829 | if test -z "$dag_tools_dir"; then |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 830 | dag_tools_dir="$dag_root/tools" |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 831 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 832 | |
| 833 | if test -r $dag_include_dir/dagapi.h; then |
| 834 | ac_cv_lbl_dag_api=yes |
| 835 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 836 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 837 | if test "$ac_cv_lbl_dag_api" = yes; then |
| 838 | AC_MSG_RESULT([yes ($dag_include_dir)]) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 839 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 840 | V_INCLS="$V_INCLS -I$dag_include_dir" |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 841 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 842 | if test $V_PCAP != dag ; then |
| 843 | SSRC="$SSRC pcap-dag.c" |
| 844 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 845 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 846 | # See if we can find a general version string. |
| 847 | # Don't need to save and restore LIBS to prevent -ldag being |
| 848 | # included if there's a found-action (arg 3). |
| 849 | saved_ldflags=$LDFLAGS |
| 850 | LDFLAGS="-L$dag_lib_dir" |
| 851 | AC_CHECK_LIB([dag], [dag_attach_stream], [dag_streams="1"], [dag_streams="0"]) |
| 852 | AC_CHECK_LIB([dag],[dag_get_erf_types], [ |
| 853 | AC_DEFINE(HAVE_DAG_GET_ERF_TYPES, 1, [define if you have dag_get_erf_types()])]) |
| 854 | AC_CHECK_LIB([dag],[dag_get_stream_erf_types], [ |
| 855 | AC_DEFINE(HAVE_DAG_GET_STREAM_ERF_TYPES, 1, [define if you have dag_get_stream_erf_types()])]) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 856 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 857 | LDFLAGS=$saved_ldflags |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 858 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 859 | if test "$dag_streams" = 1; then |
| 860 | AC_DEFINE(HAVE_DAG_STREAMS_API, 1, [define if you have streams capable DAG API]) |
| 861 | LIBS="$LIBS -ldag" |
| 862 | LDFLAGS="$LDFLAGS -L$dag_lib_dir" |
| 863 | |
| 864 | AC_CHECK_LIB([vdag],[vdag_set_device_info], [ac_dag_have_vdag="1"], [ac_dag_have_vdag="0"]) |
| 865 | if test "$ac_dag_have_vdag" = 1; then |
| 866 | AC_DEFINE(HAVE_DAG_VDAG, 1, [define if you have vdag_set_device_info()]) |
| 867 | LIBS="$LIBS -lpthread" |
| 868 | fi |
| 869 | fi |
| 870 | |
| 871 | AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) |
| 872 | else |
| 873 | AC_MSG_RESULT(no) |
| 874 | |
| 875 | if test "$V_PCAP" = dag; then |
| 876 | # User requested "dag" capture type but we couldn't |
| 877 | # find the DAG API support. |
| 878 | AC_MSG_ERROR([DAG support requested with --with-pcap=dag, but the DAG headers weren't found at $dag_include_dir: make sure the DAG support is installed, specify a different path or paths if necessary, or don't request DAG support]) |
| 879 | fi |
| 880 | |
| 881 | if test "$want_dag" = yes; then |
| 882 | # User wanted DAG support but we couldn't find it. |
| 883 | AC_MSG_ERROR([DAG support requested with --with-dag, but the DAG headers weren't found at $dag_include_dir: make sure the DAG support is installed, specify a different path or paths if necessary, or don't request DAG support]) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 884 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 885 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 886 | fi |
| 887 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 888 | AC_ARG_WITH(septel, |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 889 | AC_HELP_STRING([--with-septel@<:@=DIR@:>@],[include Septel support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]), |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 890 | [ |
| 891 | if test "$withval" = no |
| 892 | then |
| 893 | want_septel=no |
| 894 | elif test "$withval" = yes |
| 895 | then |
| 896 | want_septel=yes |
| 897 | septel_root= |
| 898 | else |
| 899 | want_septel=yes |
| 900 | septel_root=$withval |
| 901 | fi |
| 902 | ],[ |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 903 | if test "$V_PCAP" = septel; then |
| 904 | # User requested Septel-only libpcap, so we'd better have |
| 905 | # the Septel API. |
| 906 | want_septel=yes |
| 907 | elif test "xxx_only" = yes; then |
| 908 | # User requested something-else-only pcap, so they don't |
| 909 | # want Septel support. |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 910 | want_septel=no |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 911 | else |
| 912 | # |
| 913 | # Use Septel API if present, otherwise don't |
| 914 | # |
| 915 | want_septel=ifpresent |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 916 | fi |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 917 | ]) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 918 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 919 | ac_cv_lbl_septel_api=no |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 920 | if test "$with_septel" != no; then |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 921 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 922 | AC_MSG_CHECKING([whether we have Septel API headers]) |
| 923 | |
| 924 | # If necessary, set default paths for Septel API headers and libraries. |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 925 | if test -z "$septel_root"; then |
| 926 | septel_root=$srcdir/../septel |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 927 | fi |
| 928 | |
| 929 | septel_tools_dir="$septel_root" |
| 930 | septel_include_dir="$septel_root/INC" |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 931 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 932 | if test -r "$septel_include_dir/msg.h"; then |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 933 | ac_cv_lbl_septel_api=yes |
| 934 | fi |
| 935 | |
| 936 | if test "$ac_cv_lbl_septel_api" = yes; then |
| 937 | AC_MSG_RESULT([yes ($septel_include_dir)]) |
| 938 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 939 | V_INCLS="$V_INCLS -I$septel_include_dir" |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 940 | ADDLOBJS="$ADDLOBJS $septel_tools_dir/asciibin.o $septel_tools_dir/bit2byte.o $septel_tools_dir/confirm.o $septel_tools_dir/fmtmsg.o $septel_tools_dir/gct_unix.o $septel_tools_dir/hqueue.o $septel_tools_dir/ident.o $septel_tools_dir/mem.o $septel_tools_dir/pack.o $septel_tools_dir/parse.o $septel_tools_dir/pool.o $septel_tools_dir/sdlsig.o $septel_tools_dir/strtonum.o $septel_tools_dir/timer.o $septel_tools_dir/trace.o" |
| 941 | ADDLARCHIVEOBJS="$ADDLARCHIVEOBJS $septel_tools_dir/asciibin.o $septel_tools_dir/bit2byte.o $septel_tools_dir/confirm.o $septel_tools_dir/fmtmsg.o $septel_tools_dir/gct_unix.o $septel_tools_dir/hqueue.o $septel_tools_dir/ident.o $septel_tools_dir/mem.o $septel_tools_dir/pack.o $septel_tools_dir/parse.o $septel_tools_dir/pool.o $septel_tools_dir/sdlsig.o $septel_tools_dir/strtonum.o $septel_tools_dir/timer.o $septel_tools_dir/trace.o" |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 942 | |
| 943 | if test "$V_PCAP" != septel ; then |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 944 | SSRC="$SSRC pcap-septel.c" |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 945 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 946 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 947 | AC_DEFINE(HAVE_SEPTEL_API, 1, [define if you have the Septel API]) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 948 | else |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 949 | AC_MSG_RESULT(no) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 950 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 951 | if test "$V_PCAP" = septel; then |
| 952 | # User requested "septel" capture type but |
| 953 | # we couldn't find the Septel API support. |
| 954 | AC_MSG_ERROR([Septel support requested with --with-pcap=septel, but the Septel headers weren't found at $septel_include_dir: make sure the Septel support is installed, specify a different path or paths if necessary, or don't request Septel support]) |
| 955 | fi |
| 956 | |
| 957 | if test "$want_septel" = yes; then |
| 958 | # User wanted Septel support but we couldn't find it. |
| 959 | AC_MSG_ERROR([Septel support requested with --with-septel, but the Septel headers weren't found at $septel_include_dir: make sure the Septel support is installed, specify a different path or paths if necessary, or don't request Septel support]) |
| 960 | fi |
| 961 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 962 | fi |
| 963 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 964 | # Check for Myricom SNF support. |
| 965 | AC_ARG_WITH([snf], |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 966 | AC_HELP_STRING([--with-snf@<:@=DIR@:>@],[include Myricom SNF support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]), |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 967 | [ |
| 968 | if test "$withval" = no |
| 969 | then |
| 970 | # User explicitly doesn't want SNF |
| 971 | want_snf=no |
| 972 | elif test "$withval" = yes |
| 973 | then |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 974 | # User wants SNF support but hasn't specified a directory. |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 975 | want_snf=yes |
| 976 | else |
| 977 | # User wants SNF support with a specified directory. |
| 978 | want_snf=yes |
| 979 | snf_root=$withval |
| 980 | fi |
| 981 | ],[ |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 982 | if test "$V_PCAP" = snf; then |
| 983 | # User requested Sniffer-only libpcap, so we'd better have |
| 984 | # the Sniffer API. |
| 985 | want_snf=yes |
| 986 | elif test "xxx_only" = yes; then |
| 987 | # User requested something-else-only pcap, so they don't |
| 988 | # want SNF support. |
| 989 | want_snf=no |
| 990 | else |
| 991 | # |
| 992 | # Use Sniffer API if present, otherwise don't |
| 993 | # |
| 994 | want_snf=ifpresent |
| 995 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 996 | ]) |
| 997 | |
| 998 | AC_ARG_WITH([snf-includes], |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 999 | AC_HELP_STRING([--with-snf-includes=IDIR],[Myricom SNF include directory, if not DIR/include]), |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1000 | [ |
| 1001 | # User wants SNF with specific header directory |
| 1002 | want_snf=yes |
| 1003 | snf_include_dir=$withval |
| 1004 | ],[]) |
| 1005 | |
| 1006 | AC_ARG_WITH([snf-libraries], |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1007 | AC_HELP_STRING([--with-snf-libraries=LDIR],[Myricom SNF library directory, if not DIR/lib]), |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1008 | [ |
| 1009 | # User wants SNF with specific lib directory |
| 1010 | want_snf=yes |
| 1011 | snf_lib_dir=$withval |
| 1012 | ],[]) |
| 1013 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1014 | ac_cv_lbl_snf_api=no |
| 1015 | if test "$with_snf" != no; then |
| 1016 | |
| 1017 | AC_MSG_CHECKING(whether we have Myricom Sniffer API) |
| 1018 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1019 | # If necessary, set default paths for Sniffer headers and libraries. |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1020 | if test -z "$snf_root"; then |
| 1021 | snf_root=/opt/snf |
| 1022 | fi |
| 1023 | |
| 1024 | if test -z "$snf_include_dir"; then |
| 1025 | snf_include_dir="$snf_root/include" |
| 1026 | fi |
| 1027 | |
| 1028 | if test -z "$snf_lib_dir"; then |
| 1029 | snf_lib_dir="$snf_root/lib" |
| 1030 | fi |
| 1031 | |
| 1032 | if test -f "$snf_include_dir/snf.h"; then |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1033 | # We found a header; make sure we can link with the library |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1034 | saved_ldflags=$LDFLAGS |
| 1035 | LDFLAGS="$LDFLAGS -L$snf_lib_dir" |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1036 | AC_CHECK_LIB([snf], [snf_init], [ac_cv_lbl_snf_api="yes"]) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1037 | LDFLAGS="$saved_ldflags" |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1038 | if test "$ac_cv_lbl_snf_api" = no; then |
| 1039 | AC_MSG_ERROR(SNF API cannot correctly be linked; check config.log) |
| 1040 | fi |
| 1041 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1042 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1043 | if test "$ac_cv_lbl_snf_api" = yes; then |
| 1044 | AC_MSG_RESULT([yes ($snf_root)]) |
| 1045 | |
| 1046 | V_INCLS="$V_INCLS -I$snf_include_dir" |
| 1047 | LIBS="$LIBS -lsnf" |
| 1048 | LDFLAGS="$LDFLAGS -L$snf_lib_dir" |
| 1049 | |
| 1050 | if test "$V_PCAP" != snf ; then |
| 1051 | SSRC="$SSRC pcap-snf.c" |
| 1052 | fi |
| 1053 | |
| 1054 | AC_DEFINE(HAVE_SNF_API, 1, [define if you have the Myricom SNF API]) |
| 1055 | else |
| 1056 | AC_MSG_RESULT(no) |
| 1057 | |
| 1058 | if test "$want_snf" = yes; then |
| 1059 | # User requested "snf" capture type but |
| 1060 | # we couldn't find the Sniffer API support. |
| 1061 | AC_MSG_ERROR([Myricom Sniffer support requested with --with-pcap=snf, but the Sniffer headers weren't found at $snf_include_dir: make sure the Sniffer support is installed, specify a different path or paths if necessary, or don't request Sniffer support]) |
| 1062 | fi |
| 1063 | |
| 1064 | if test "$want_snf" = yes; then |
| 1065 | AC_MSG_ERROR([Myricom Sniffer support requested with --with-snf, but the Sniffer headers weren't found at $snf_include_dir: make sure the Sniffer support is installed, specify a different path or paths if necessary, or don't request Sniffer support]) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1066 | fi |
| 1067 | fi |
| 1068 | fi |
| 1069 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1070 | # Check for Riverbed TurboCap support. |
| 1071 | AC_ARG_WITH([turbocap], |
| 1072 | AC_HELP_STRING([--with-turbocap@<:@=DIR@:>@],[include Riverbed TurboCap support (located in directory DIR, if supplied). @<:@default=yes, if present@:>@]), |
| 1073 | [ |
| 1074 | if test "$withval" = no |
| 1075 | then |
| 1076 | # User explicitly doesn't want TurboCap |
| 1077 | want_turbocap=no |
| 1078 | elif test "$withval" = yes |
| 1079 | then |
| 1080 | # User wants TurboCap support but hasn't specified a directory. |
| 1081 | want_turbocap=yes |
| 1082 | else |
| 1083 | # User wants TurboCap support with a specified directory. |
| 1084 | want_turbocap=yes |
| 1085 | turbocap_root=$withval |
| 1086 | fi |
| 1087 | ],[ |
| 1088 | if test "xxx_only" = yes; then |
| 1089 | # User requested something-else-only pcap, so they don't |
| 1090 | # want TurboCap support. |
| 1091 | want_turbocap=no |
| 1092 | else |
| 1093 | # |
| 1094 | # Use TurboCap API if present, otherwise don't |
| 1095 | # |
| 1096 | want_turbocap=ifpresent |
| 1097 | fi |
| 1098 | ]) |
| 1099 | |
| 1100 | ac_cv_lbl_turbocap_api=no |
| 1101 | if test "$want_turbocap" != no; then |
| 1102 | |
| 1103 | AC_MSG_CHECKING(whether TurboCap is supported) |
| 1104 | |
| 1105 | save_CFLAGS="$CFLAGS" |
| 1106 | save_LIBS="$LIBS" |
| 1107 | if test ! -z "$turbocap_root"; then |
| 1108 | TURBOCAP_CFLAGS="-I$turbocap_root/include" |
| 1109 | TURBOCAP_LIBS="-L$turbocap_root/lib" |
| 1110 | CFLAGS="$CFLAGS $TURBOCAP_CFLAGS" |
| 1111 | fi |
| 1112 | |
| 1113 | AC_TRY_COMPILE( |
| 1114 | [ |
| 1115 | #include <TcApi.h> |
| 1116 | ], |
| 1117 | [ |
| 1118 | TC_INSTANCE a; TC_PORT b; TC_BOARD c; |
| 1119 | TC_INSTANCE i; |
| 1120 | (void)TcInstanceCreateByName("foo", &i); |
| 1121 | ], |
| 1122 | ac_cv_lbl_turbocap_api=yes) |
| 1123 | |
| 1124 | CFLAGS="$save_CFLAGS" |
| 1125 | if test $ac_cv_lbl_turbocap_api = yes; then |
| 1126 | AC_MSG_RESULT(yes) |
| 1127 | |
| 1128 | SSRC="$SSRC pcap-tc.c" |
| 1129 | V_INCLS="$V_INCLS $TURBOCAP_CFLAGS" |
| 1130 | LIBS="$LIBS $TURBOCAP_LIBS -lTcApi -lpthread -lstdc++" |
| 1131 | |
| 1132 | AC_DEFINE(HAVE_TC_API, 1, [define if you have the TurboCap API]) |
| 1133 | else |
| 1134 | AC_MSG_RESULT(no) |
| 1135 | |
| 1136 | if test "$want_turbocap" = yes; then |
| 1137 | # User wanted Turbo support but we couldn't find it. |
| 1138 | AC_MSG_ERROR([TurboCap support requested with --with-turbocap, but the TurboCap headers weren't found: make sure the TurboCap support is installed or don't request TurboCap support]) |
| 1139 | fi |
| 1140 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1141 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1142 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1143 | # |
| 1144 | # Look for {f}lex. |
| 1145 | # |
| 1146 | AC_PROG_LEX |
| 1147 | if test "$LEX" = ":"; then |
| 1148 | AC_MSG_ERROR([Neither flex nor lex was found.]) |
| 1149 | fi |
| 1150 | |
| 1151 | # |
| 1152 | # Make sure {f}lex supports the -P, --header-file, and --nounput flags |
| 1153 | # and supports processing our scanner.l. |
| 1154 | # |
| 1155 | AC_CACHE_CHECK([for capable lex], tcpdump_cv_capable_lex, |
| 1156 | if $LEX -P pcap_ --header-file=/dev/null --nounput -t $srcdir/scanner.l > /dev/null 2>&1; then |
| 1157 | tcpdump_cv_capable_lex=yes |
| 1158 | else |
| 1159 | tcpdump_cv_capable_lex=insufficient |
| 1160 | fi) |
| 1161 | if test $tcpdump_cv_capable_lex = insufficient ; then |
| 1162 | AC_MSG_ERROR([$LEX is insufficient to compile libpcap. |
| 1163 | libpcap requires Flex 2.5.31 or later, or a compatible version of lex.]) |
| 1164 | fi |
| 1165 | |
| 1166 | # |
| 1167 | # Look for yacc/bison/byacc. |
| 1168 | # |
| 1169 | AC_PROG_YACC |
| 1170 | |
| 1171 | # |
| 1172 | # Make sure it supports the -p flag and supports processing our |
| 1173 | # grammar.y. |
| 1174 | # |
| 1175 | AC_CACHE_CHECK([for capable yacc/bison], tcpdump_cv_capable_yacc, |
| 1176 | if $YACC -p pcap_ -o /dev/null $srcdir/grammar.y >/dev/null 2>&1; then |
| 1177 | tcpdump_cv_capable_yacc=yes |
| 1178 | else |
| 1179 | tcpdump_cv_capable_yacc=insufficient |
| 1180 | fi) |
| 1181 | if test $tcpdump_cv_capable_yacc = insufficient ; then |
| 1182 | AC_MSG_ERROR([$YACC is insufficient to compile libpcap. |
| 1183 | libpcap requires Bison, Berkeley YACC, or another YACC compatible with them.]) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1184 | fi |
| 1185 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1186 | # |
| 1187 | # Assume, by default, no support for shared libraries and V7/BSD convention |
| 1188 | # for man pages (file formats in section 5, miscellaneous info in section 7). |
| 1189 | # Individual cases can override this. |
| 1190 | # |
| 1191 | DYEXT="none" |
| 1192 | MAN_FILE_FORMATS=5 |
| 1193 | MAN_MISC_INFO=7 |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1194 | case "$host_os" in |
| 1195 | |
| 1196 | aix*) |
| 1197 | dnl Workaround to enable certain features |
| 1198 | AC_DEFINE(_SUN,1,[define on AIX to get certain functions]) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1199 | |
| 1200 | # |
| 1201 | # AIX makes it fun to build shared and static libraries, |
| 1202 | # because they're *both* ".a" archive libraries. We |
| 1203 | # build the static library for the benefit of the traditional |
| 1204 | # scheme of building libpcap and tcpdump in subdirectories of |
| 1205 | # the same directory, with tcpdump statically linked with the |
| 1206 | # libpcap in question, but we also build a shared library as |
| 1207 | # "libpcap.shareda" and install *it*, rather than the static |
| 1208 | # library, as "libpcap.a". |
| 1209 | # |
| 1210 | DYEXT="shareda" |
| 1211 | |
| 1212 | case "$V_PCAP" in |
| 1213 | |
| 1214 | dlpi) |
| 1215 | # |
| 1216 | # If we're using DLPI, applications will need to |
| 1217 | # use /lib/pse.exp if present, as we use the |
| 1218 | # STREAMS routines. |
| 1219 | # |
| 1220 | pseexe="/lib/pse.exp" |
| 1221 | AC_MSG_CHECKING(for $pseexe) |
| 1222 | if test -f $pseexe ; then |
| 1223 | AC_MSG_RESULT(yes) |
| 1224 | LIBS="-I:$pseexe" |
| 1225 | fi |
| 1226 | ;; |
| 1227 | |
| 1228 | bpf) |
| 1229 | # |
| 1230 | # If we're using BPF, we need "-lodm" and "-lcfg", as |
| 1231 | # we use them to load the BPF module. |
| 1232 | # |
| 1233 | LIBS="-lodm -lcfg" |
| 1234 | ;; |
| 1235 | esac |
| 1236 | ;; |
| 1237 | |
| 1238 | darwin*) |
| 1239 | DYEXT="dylib" |
| 1240 | V_CCOPT="$V_CCOPT -fno-common" |
| 1241 | AC_ARG_ENABLE(universal, |
| 1242 | AC_HELP_STRING([--disable-universal],[don't build universal on OS X])) |
| 1243 | if test "$enable_universal" != "no"; then |
| 1244 | case "$host_os" in |
| 1245 | |
| 1246 | darwin[0-7].*) |
| 1247 | # |
| 1248 | # Pre-Tiger. Build only for 32-bit PowerPC; no |
| 1249 | # need for any special compiler or linker flags. |
| 1250 | # |
| 1251 | ;; |
| 1252 | |
| 1253 | darwin8.[0123]*) |
| 1254 | # |
| 1255 | # Tiger, prior to Intel support. Build for 32-bit |
| 1256 | # PowerPC and 64-bit PowerPC, with 32-bit PowerPC |
| 1257 | # first. (I'm guessing that's what Apple does.) |
| 1258 | # |
| 1259 | V_CCOPT="$V_CCOPT -arch ppc -arch ppc64" |
| 1260 | LDFLAGS="$LDFLAGS -arch ppc -arch ppc64" |
| 1261 | ;; |
| 1262 | |
| 1263 | darwin8.[456]*) |
| 1264 | # |
| 1265 | # Tiger, subsequent to Intel support but prior to |
| 1266 | # x86-64 support. Build for 32-bit PowerPC, 64-bit |
| 1267 | # PowerPC, and x86, with 32-bit PowerPC first. |
| 1268 | # (I'm guessing that's what Apple does.) |
| 1269 | # |
| 1270 | V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386" |
| 1271 | LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386" |
| 1272 | ;; |
| 1273 | |
| 1274 | darwin8.*) |
| 1275 | # |
| 1276 | # All other Tiger, so subsequent to x86-64 |
| 1277 | # support. Build for 32-bit PowerPC, 64-bit |
| 1278 | # PowerPC, x86, and x86-64, and with 32-bit PowerPC |
| 1279 | # first. (I'm guessing that's what Apple does.) |
| 1280 | # |
| 1281 | V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64" |
| 1282 | LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64" |
| 1283 | ;; |
| 1284 | |
| 1285 | darwin9.*) |
| 1286 | # |
| 1287 | # Leopard. Build for 32-bit PowerPC, 64-bit |
| 1288 | # PowerPC, x86, and x86-64, with 32-bit PowerPC |
| 1289 | # first. (That's what Apple does.) |
| 1290 | # |
| 1291 | V_CCOPT="$V_CCOPT -arch ppc -arch ppc64 -arch i386 -arch x86_64" |
| 1292 | LDFLAGS="$LDFLAGS -arch ppc -arch ppc64 -arch i386 -arch x86_64" |
| 1293 | ;; |
| 1294 | |
| 1295 | darwin10.*) |
| 1296 | # |
| 1297 | # Snow Leopard. Build for x86-64, x86, and |
| 1298 | # 32-bit PowerPC, with x86-64 first. (That's |
| 1299 | # what Apple does, even though Snow Leopard |
| 1300 | # doesn't run on PPC, so PPC libpcap runs under |
| 1301 | # Rosetta, and Rosetta doesn't support BPF |
| 1302 | # ioctls, so PPC programs can't do live |
| 1303 | # captures.) |
| 1304 | # |
| 1305 | V_CCOPT="$V_CCOPT -arch x86_64 -arch i386 -arch ppc" |
| 1306 | LDFLAGS="$LDFLAGS -arch x86_64 -arch i386 -arch ppc" |
| 1307 | ;; |
| 1308 | |
| 1309 | darwin*) |
| 1310 | # |
| 1311 | # Post-Snow Leopard. Build for x86-64 and |
| 1312 | # x86, with x86-64 first. (That's probably what |
| 1313 | # Apple does, given that Rosetta is gone.) |
| 1314 | # XXX - update if and when Apple drops support |
| 1315 | # for 32-bit x86 code. |
| 1316 | # |
| 1317 | V_CCOPT="$V_CCOPT -arch x86_64 -arch i386" |
| 1318 | LDFLAGS="$LDFLAGS -arch x86_64 -arch i386" |
| 1319 | ;; |
| 1320 | esac |
| 1321 | fi |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1322 | ;; |
| 1323 | |
| 1324 | hpux9*) |
| 1325 | AC_DEFINE(HAVE_HPUX9,1,[on HP-UX 9.x]) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1326 | |
| 1327 | # |
| 1328 | # Use System V conventions for man pages. |
| 1329 | # |
| 1330 | MAN_FILE_FORMATS=4 |
| 1331 | MAN_MISC_INFO=5 |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1332 | ;; |
| 1333 | |
| 1334 | hpux10.0*) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1335 | |
| 1336 | # |
| 1337 | # Use System V conventions for man pages. |
| 1338 | # |
| 1339 | MAN_FILE_FORMATS=4 |
| 1340 | MAN_MISC_INFO=5 |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1341 | ;; |
| 1342 | |
| 1343 | hpux10.1*) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1344 | |
| 1345 | # |
| 1346 | # Use System V conventions for man pages. |
| 1347 | # |
| 1348 | MAN_FILE_FORMATS=4 |
| 1349 | MAN_MISC_INFO=5 |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1350 | ;; |
| 1351 | |
| 1352 | hpux*) |
| 1353 | dnl HPUX 10.20 and above is similar to HPUX 9, but |
| 1354 | dnl not the same.... |
| 1355 | dnl |
| 1356 | dnl XXX - DYEXT should be set to "sl" if this is building |
| 1357 | dnl for 32-bit PA-RISC, but should be left as "so" for |
| 1358 | dnl 64-bit PA-RISC or, I suspect, IA-64. |
| 1359 | AC_DEFINE(HAVE_HPUX10_20_OR_LATER,1,[on HP-UX 10.20 or later]) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1360 | if test "`uname -m`" = "ia64"; then |
| 1361 | DYEXT="so" |
| 1362 | else |
| 1363 | DYEXT="sl" |
| 1364 | fi |
| 1365 | |
| 1366 | # |
| 1367 | # "-b" builds a shared library; "+h" sets the soname. |
| 1368 | # |
| 1369 | SHLIB_OPT="-b" |
| 1370 | SONAME_OPT="+h" |
| 1371 | |
| 1372 | # |
| 1373 | # Use System V conventions for man pages. |
| 1374 | # |
| 1375 | MAN_FILE_FORMATS=4 |
| 1376 | MAN_MISC_INFO=5 |
| 1377 | ;; |
| 1378 | |
| 1379 | irix*) |
| 1380 | # |
| 1381 | # Use System V conventions for man pages. |
| 1382 | # |
| 1383 | MAN_FILE_FORMATS=4 |
| 1384 | MAN_MISC_INFO=5 |
| 1385 | ;; |
| 1386 | |
| 1387 | linux*|freebsd*|netbsd*|openbsd*|dragonfly*|kfreebsd*|gnu*) |
| 1388 | DYEXT="so" |
| 1389 | |
| 1390 | # |
| 1391 | # Compiler assumed to be GCC; run-time linker may require a -R |
| 1392 | # flag. |
| 1393 | # |
| 1394 | if test "$libdir" != "/usr/lib"; then |
| 1395 | V_RFLAGS=-Wl,-R$libdir |
| 1396 | fi |
| 1397 | ;; |
| 1398 | |
| 1399 | osf*) |
| 1400 | DYEXT="so" |
| 1401 | |
| 1402 | # |
| 1403 | # Use System V conventions for man pages. |
| 1404 | # |
| 1405 | MAN_FILE_FORMATS=4 |
| 1406 | MAN_MISC_INFO=5 |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1407 | ;; |
| 1408 | |
| 1409 | sinix*) |
| 1410 | AC_MSG_CHECKING(if SINIX compiler defines sinix) |
| 1411 | AC_CACHE_VAL(ac_cv_cc_sinix_defined, |
| 1412 | AC_TRY_COMPILE( |
| 1413 | [], |
| 1414 | [int i = sinix;], |
| 1415 | ac_cv_cc_sinix_defined=yes, |
| 1416 | ac_cv_cc_sinix_defined=no)) |
| 1417 | AC_MSG_RESULT($ac_cv_cc_sinix_defined) |
| 1418 | if test $ac_cv_cc_sinix_defined = no ; then |
| 1419 | AC_DEFINE(sinix,1,[on sinix]) |
| 1420 | fi |
| 1421 | ;; |
| 1422 | |
| 1423 | solaris*) |
| 1424 | AC_DEFINE(HAVE_SOLARIS,1,[On solaris]) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1425 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1426 | DYEXT="so" |
| 1427 | # |
| 1428 | # Use System V conventions for man pages. |
| 1429 | # |
| 1430 | MAN_FILE_FORMATS=4 |
| 1431 | MAN_MISC_INFO=5 |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1432 | ;; |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1433 | esac |
| 1434 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1435 | AC_ARG_ENABLE(shared, |
| 1436 | AC_HELP_STRING([--enable-shared],[build shared libraries @<:@default=yes, if support available@:>@])) |
| 1437 | test "x$enable_shared" = "xno" && DYEXT="none" |
| 1438 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1439 | AC_PROG_RANLIB |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1440 | AC_CHECK_TOOL([AR], [ar]) |
| 1441 | |
| 1442 | AC_PROG_LN_S |
| 1443 | AC_SUBST(LN_S) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1444 | |
| 1445 | AC_LBL_DEVEL(V_CCOPT) |
| 1446 | |
| 1447 | AC_LBL_SOCKADDR_SA_LEN |
| 1448 | |
| 1449 | AC_LBL_SOCKADDR_STORAGE |
| 1450 | |
| 1451 | AC_LBL_HP_PPA_INFO_T_DL_MODULE_ID_1 |
| 1452 | |
| 1453 | AC_LBL_UNALIGNED_ACCESS |
| 1454 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1455 | rm -f net |
| 1456 | ln -s ${srcdir}/bpf/net net |
| 1457 | |
| 1458 | AC_SUBST(V_CCOPT) |
| 1459 | AC_SUBST(V_DEFS) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1460 | AC_SUBST(V_FINDALLDEVS) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1461 | AC_SUBST(V_INCLS) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1462 | AC_SUBST(V_LEX) |
| 1463 | AC_SUBST(V_PCAP) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1464 | AC_SUBST(V_SHLIB_CMD) |
| 1465 | AC_SUBST(V_SHLIB_OPT) |
| 1466 | AC_SUBST(V_SONAME_OPT) |
| 1467 | AC_SUBST(V_RPATH_OPT) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1468 | AC_SUBST(V_YACC) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1469 | AC_SUBST(ADDLOBJS) |
| 1470 | AC_SUBST(ADDLARCHIVEOBJS) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1471 | AC_SUBST(SSRC) |
| 1472 | AC_SUBST(DYEXT) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1473 | AC_SUBST(MAN_FILE_FORMATS) |
| 1474 | AC_SUBST(MAN_MISC_INFO) |
| 1475 | |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1476 | AC_ARG_ENABLE([usb], |
| 1477 | [AC_HELP_STRING([--enable-usb],[enable nusb support @<:@default=yes, if support available@:>@])], |
| 1478 | [], |
| 1479 | [enable_usb=yes]) |
| 1480 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1481 | if test "xxx_only" = yes; then |
| 1482 | # User requested something-else-only pcap, so they don't |
| 1483 | # want USB support. |
| 1484 | enable_usb=no |
| 1485 | fi |
| 1486 | |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1487 | if test "x$enable_usb" != "xno" ; then |
| 1488 | dnl check for USB sniffing support |
| 1489 | AC_MSG_CHECKING(for USB sniffing support) |
| 1490 | case "$host_os" in |
| 1491 | linux*) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1492 | AC_DEFINE(PCAP_SUPPORT_USB, 1, [target host supports USB sniffing]) |
| 1493 | USB_SRC=pcap-usb-linux.c |
| 1494 | AC_MSG_RESULT(yes) |
| 1495 | ac_usb_dev_name=`udevinfo -q name -p /sys/class/usb_device/usbmon 2>/dev/null` |
| 1496 | if test $? -ne 0 ; then |
| 1497 | ac_usb_dev_name="usbmon" |
| 1498 | fi |
| 1499 | AC_DEFINE_UNQUOTED(LINUX_USB_MON_DEV, "/dev/$ac_usb_dev_name", [path for device for USB sniffing]) |
| 1500 | AC_MSG_NOTICE(Device for USB sniffing is /dev/$ac_usb_dev_name) |
| 1501 | # |
| 1502 | # Do we have a version of <linux/compiler.h> available? |
| 1503 | # If so, we might need it for <linux/usbdevice_fs.h>. |
| 1504 | # |
| 1505 | AC_CHECK_HEADERS(linux/compiler.h) |
| 1506 | if test "$ac_cv_header_linux_compiler_h" = yes; then |
| 1507 | # |
| 1508 | # Yes - include it when testing for <linux/usbdevice_fs.h>. |
| 1509 | # |
| 1510 | AC_CHECK_HEADERS(linux/usbdevice_fs.h,,,[#include <linux/compiler.h>]) |
| 1511 | else |
| 1512 | AC_CHECK_HEADERS(linux/usbdevice_fs.h) |
| 1513 | fi |
| 1514 | if test "$ac_cv_header_linux_usbdevice_fs_h" = yes; then |
| 1515 | # |
| 1516 | # OK, does it define bRequestType? Older versions of the kernel |
| 1517 | # define fields with names like "requesttype, "request", and |
| 1518 | # "value", rather than "bRequestType", "bRequest", and |
| 1519 | # "wValue". |
| 1520 | # |
| 1521 | AC_MSG_CHECKING(if usbdevfs_ctrltransfer struct has bRequestType member) |
| 1522 | AC_CACHE_VAL(ac_cv_usbdevfs_ctrltransfer_has_bRequestType, |
| 1523 | AC_TRY_COMPILE([ |
| 1524 | AC_INCLUDES_DEFAULT |
| 1525 | #ifdef HAVE_SYS_BITYPES_H |
| 1526 | #include <sys/bitypes.h> |
| 1527 | #endif |
| 1528 | #ifdef HAVE_LINUX_COMPILER_H |
| 1529 | #include <linux/compiler.h> |
| 1530 | #endif |
| 1531 | #include <linux/usbdevice_fs.h>], |
| 1532 | [u_int i = sizeof(((struct usbdevfs_ctrltransfer *)0)->bRequestType)], |
| 1533 | ac_cv_usbdevfs_ctrltransfer_has_bRequestType=yes, |
| 1534 | ac_cv_usbdevfs_ctrltransfer_has_bRequestType=no)) |
| 1535 | AC_MSG_RESULT($ac_cv_usbdevfs_ctrltransfer_has_bRequestType) |
| 1536 | if test $ac_cv_usbdevfs_ctrltransfer_has_bRequestType = yes ; then |
| 1537 | AC_DEFINE(HAVE_USBDEVFS_CTRLTRANSFER_BREQUESTTYPE,1, |
| 1538 | [if struct usbdevfs_ctrltransfer has bRequestType]) |
| 1539 | fi |
| 1540 | fi |
| 1541 | ;; |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1542 | freebsd*) |
| 1543 | # |
| 1544 | # This just uses BPF in FreeBSD 8.4 and later; we don't need |
| 1545 | # to check for anything special for capturing. |
| 1546 | # |
| 1547 | AC_MSG_RESULT([yes, in FreeBSD 8.4 and later]) |
| 1548 | ;; |
| 1549 | |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1550 | *) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1551 | AC_MSG_RESULT(no) |
| 1552 | ;; |
| 1553 | esac |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1554 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1555 | AC_SUBST(PCAP_SUPPORT_USB) |
| 1556 | AC_SUBST(USB_SRC) |
| 1557 | |
| 1558 | dnl check for netfilter sniffing support |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1559 | if test "xxx_only" != yes; then |
| 1560 | AC_MSG_CHECKING(whether the platform could support netfilter sniffing) |
| 1561 | case "$host_os" in |
| 1562 | linux*) |
| 1563 | AC_MSG_RESULT(yes) |
| 1564 | # |
| 1565 | # Life's too short to deal with trying to get this to compile |
| 1566 | # if you don't get the right types defined with |
| 1567 | # __KERNEL_STRICT_NAMES getting defined by some other include. |
| 1568 | # |
| 1569 | # Check whether the includes Just Work. If not, don't turn on |
| 1570 | # netfilter support. |
| 1571 | # |
| 1572 | AC_MSG_CHECKING(whether we can compile the netfilter support) |
| 1573 | AC_CACHE_VAL(ac_cv_netfilter_can_compile, |
| 1574 | AC_TRY_COMPILE([ |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1575 | AC_INCLUDES_DEFAULT |
| 1576 | #include <sys/socket.h> |
| 1577 | #include <netinet/in.h> |
| 1578 | #include <linux/types.h> |
| 1579 | |
| 1580 | #include <linux/netlink.h> |
| 1581 | #include <linux/netfilter.h> |
| 1582 | #include <linux/netfilter/nfnetlink.h> |
| 1583 | #include <linux/netfilter/nfnetlink_log.h> |
| 1584 | #include <linux/netfilter/nfnetlink_queue.h>], |
| 1585 | [], |
| 1586 | ac_cv_netfilter_can_compile=yes, |
| 1587 | ac_cv_netfilter_can_compile=no)) |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1588 | AC_MSG_RESULT($ac_cv_netfilter_can_compile) |
| 1589 | if test $ac_cv_netfilter_can_compile = yes ; then |
| 1590 | AC_DEFINE(PCAP_SUPPORT_NETFILTER, 1, |
| 1591 | [target host supports netfilter sniffing]) |
| 1592 | NETFILTER_SRC=pcap-netfilter-linux.c |
| 1593 | fi |
| 1594 | ;; |
| 1595 | *) |
| 1596 | AC_MSG_RESULT(no) |
| 1597 | ;; |
| 1598 | esac |
| 1599 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1600 | AC_SUBST(PCAP_SUPPORT_NETFILTER) |
| 1601 | AC_SUBST(NETFILTER_SRC) |
| 1602 | |
| 1603 | AC_ARG_ENABLE([bluetooth], |
| 1604 | [AC_HELP_STRING([--enable-bluetooth],[enable Bluetooth support @<:@default=yes, if support available@:>@])], |
| 1605 | [], |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1606 | [enable_bluetooth=ifsupportavailable]) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1607 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1608 | if test "xxx_only" = yes; then |
| 1609 | # User requested something-else-only pcap, so they don't |
| 1610 | # want Bluetooth support. |
| 1611 | enable_bluetooth=no |
| 1612 | fi |
| 1613 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1614 | if test "x$enable_bluetooth" != "xno" ; then |
| 1615 | dnl check for Bluetooth sniffing support |
| 1616 | case "$host_os" in |
| 1617 | linux*) |
| 1618 | AC_CHECK_HEADER(bluetooth/bluetooth.h, |
| 1619 | [ |
| 1620 | AC_DEFINE(PCAP_SUPPORT_BT, 1, [target host supports Bluetooth sniffing]) |
| 1621 | BT_SRC=pcap-bt-linux.c |
| 1622 | AC_MSG_NOTICE(Bluetooth sniffing is supported) |
| 1623 | |
| 1624 | # |
| 1625 | # OK, does struct sockaddr_hci have an hci_channel |
| 1626 | # member? |
| 1627 | # |
| 1628 | AC_MSG_CHECKING(if struct sockaddr_hci has hci_channel member) |
| 1629 | AC_CACHE_VAL(ac_cv_lbl_sockaddr_hci_has_hci_channel, |
| 1630 | AC_TRY_COMPILE( |
| 1631 | [ |
| 1632 | #include <bluetooth/bluetooth.h> |
| 1633 | #include <bluetooth/hci.h> |
| 1634 | ], |
| 1635 | [u_int i = sizeof(((struct sockaddr_hci *)0)->hci_channel)], |
| 1636 | ac_cv_lbl_sockaddr_hci_has_hci_channel=yes, |
| 1637 | ac_cv_lbl_sockaddr_hci_has_hci_channel=no)) |
| 1638 | AC_MSG_RESULT($ac_cv_lbl_sockaddr_hci_has_hci_channel) |
| 1639 | if test $ac_cv_lbl_sockaddr_hci_has_hci_channel = yes ; then |
| 1640 | AC_DEFINE(SOCKADDR_HCI_HAS_HCI_CHANNEL,, |
| 1641 | [if struct sockaddr_hci has hci_channel member]) |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1642 | |
| 1643 | # |
| 1644 | # OK, is HCI_CHANNEL_MONITOR defined? |
| 1645 | # |
| 1646 | AC_MSG_CHECKING(if HCI_CHANNEL_MONITOR is defined) |
| 1647 | AC_CACHE_VAL(ac_cv_lbl_hci_channel_monitor_is_defined, |
| 1648 | AC_TRY_COMPILE( |
| 1649 | [ |
| 1650 | #include <bluetooth/bluetooth.h> |
| 1651 | #include <bluetooth/hci.h> |
| 1652 | ], |
| 1653 | [u_int i = HCI_CHANNEL_MONITOR], |
| 1654 | ac_cv_lbl_hci_channel_monitor_is_defined=yes, |
| 1655 | ac_cv_lbl_hci_channel_monitor_is_defined=no)) |
| 1656 | AC_MSG_RESULT($ac_cv_lbl_hci_channel_monitor_is_defined) |
| 1657 | if test $ac_cv_lbl_hci_channel_monitor_is_defined = yes ; then |
| 1658 | AC_DEFINE(PCAP_SUPPORT_BT_MONITOR,, |
| 1659 | [target host supports Bluetooth Monitor]) |
| 1660 | BT_MONITOR_SRC=pcap-bt-monitor-linux.c |
| 1661 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1662 | fi |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1663 | ac_lbl_bluetooth_available=yes |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1664 | ], |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1665 | ac_lbl_bluetooth_available=no |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1666 | ) |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1667 | if test "x$ac_lbl_bluetooth_available" == "xno" ; then |
| 1668 | if test "x$enable_bluetooth" = "xyes" ; then |
| 1669 | AC_MSG_ERROR(Bluetooth sniffing is not supported; install bluez-lib devel to enable it) |
| 1670 | else |
| 1671 | AC_MSG_NOTICE(Bluetooth sniffing is not supported; install bluez-lib devel to enable it) |
| 1672 | fi |
| 1673 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1674 | ;; |
| 1675 | *) |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1676 | if test "x$enable_bluetooth" = "xyes" ; then |
| 1677 | AC_MSG_ERROR(no Bluetooth sniffing support implemented for $host_os) |
| 1678 | else |
| 1679 | AC_MSG_NOTICE(no Bluetooth sniffing support implemented for $host_os) |
| 1680 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1681 | ;; |
| 1682 | esac |
| 1683 | AC_SUBST(PCAP_SUPPORT_BT) |
| 1684 | AC_SUBST(BT_SRC) |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1685 | AC_SUBST(BT_MONITOR_SRC) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1686 | fi |
| 1687 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1688 | AC_ARG_ENABLE([dbus], |
| 1689 | [AC_HELP_STRING([--enable-dbus],[enable D-Bus capture support @<:@default=yes, if support available@:>@])], |
| 1690 | [], |
| 1691 | [enable_dbus=ifavailable]) |
| 1692 | |
Elliott Hughes | 965a4b5 | 2017-05-15 10:37:39 -0700 | [diff] [blame] | 1693 | if test "xxx_only" = yes; then |
| 1694 | # User requested something-else-only pcap, so they don't |
| 1695 | # want D-Bus support. |
| 1696 | enable_dbus=no |
| 1697 | fi |
| 1698 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1699 | if test "x$enable_dbus" != "xno"; then |
| 1700 | if test "x$enable_dbus" = "xyes"; then |
| 1701 | case "$host_os" in |
| 1702 | |
| 1703 | darwin*) |
| 1704 | # |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1705 | # We don't support D-Bus sniffing on OS X; see |
| 1706 | # |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1707 | # https://bugs.freedesktop.org/show_bug.cgi?id=74029 |
| 1708 | # |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1709 | # The user requested it, so fail. |
| 1710 | # |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1711 | AC_MSG_ERROR([Due to freedesktop.org bug 74029, D-Bus capture support is not available on OS X]) |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1712 | esac |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1713 | else |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1714 | case "$host_os" in |
| 1715 | |
| 1716 | darwin*) |
| 1717 | # |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1718 | # We don't support D-Bus sniffing on OS X; see |
| 1719 | # |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1720 | # https://bugs.freedesktop.org/show_bug.cgi?id=74029 |
| 1721 | # |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1722 | # The user dind't explicitly request it, so just |
| 1723 | # silently refuse to enable it. |
| 1724 | # |
| 1725 | enable_dbus="no" |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1726 | ;; |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1727 | esac |
| 1728 | fi |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1729 | fi |
| 1730 | |
| 1731 | if test "x$enable_dbus" != "xno"; then |
| 1732 | AC_CHECK_PROG([PKGCONFIG], [pkg-config], [pkg-config], [no]) |
| 1733 | if test "x$PKGCONFIG" != "xno"; then |
| 1734 | AC_MSG_CHECKING([for D-Bus]) |
| 1735 | if "$PKGCONFIG" dbus-1; then |
| 1736 | AC_MSG_RESULT([yes]) |
| 1737 | DBUS_CFLAGS=`"$PKGCONFIG" --cflags dbus-1` |
| 1738 | DBUS_LIBS=`"$PKGCONFIG" --libs dbus-1` |
| 1739 | save_CFLAGS="$CFLAGS" |
| 1740 | save_LIBS="$LIBS" |
| 1741 | CFLAGS="$CFLAGS $DBUS_CFLAGS" |
| 1742 | LIBS="$LIBS $DBUS_LIBS" |
| 1743 | AC_MSG_CHECKING(whether the D-Bus library defines dbus_connection_read_write) |
| 1744 | AC_TRY_LINK( |
| 1745 | [#include <string.h> |
| 1746 | |
| 1747 | #include <time.h> |
| 1748 | #include <sys/time.h> |
| 1749 | |
| 1750 | #include <dbus/dbus.h>], |
| 1751 | [return dbus_connection_read_write(NULL, 0);], |
| 1752 | [ |
| 1753 | AC_MSG_RESULT([yes]) |
| 1754 | AC_DEFINE(PCAP_SUPPORT_DBUS, 1, [support D-Bus sniffing]) |
| 1755 | DBUS_SRC=pcap-dbus.c |
| 1756 | V_INCLS="$V_INCLS $DBUS_CFLAGS" |
| 1757 | ], |
| 1758 | [ |
| 1759 | AC_MSG_RESULT([no]) |
| 1760 | if test "x$enable_dbus" = "xyes"; then |
| 1761 | AC_MSG_ERROR([--enable-dbus was given, but the D-Bus library doesn't define dbus_connection_read_write()]) |
| 1762 | fi |
| 1763 | LIBS="$save_LIBS" |
| 1764 | ]) |
| 1765 | CFLAGS="$save_CFLAGS" |
| 1766 | else |
| 1767 | AC_MSG_RESULT([no]) |
| 1768 | if test "x$enable_dbus" = "xyes"; then |
| 1769 | AC_MSG_ERROR([--enable-dbus was given, but the dbus-1 package is not installed]) |
| 1770 | fi |
| 1771 | fi |
| 1772 | fi |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1773 | AC_SUBST(PCAP_SUPPORT_DBUS) |
| 1774 | AC_SUBST(DBUS_SRC) |
| 1775 | fi |
| 1776 | |
| 1777 | dnl check for hardware timestamp support |
| 1778 | case "$host_os" in |
| 1779 | linux*) |
| 1780 | AC_CHECK_HEADERS([linux/net_tstamp.h]) |
| 1781 | ;; |
| 1782 | *) |
| 1783 | AC_MSG_NOTICE(no hardware timestamp support implemented for $host_os) |
| 1784 | ;; |
| 1785 | esac |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1786 | |
Elliott Hughes | d8845d7 | 2015-10-19 18:07:04 -0700 | [diff] [blame] | 1787 | dnl The packet ring capture facility of Linux, described in |
| 1788 | dnl Documentation/networking/packet_mmap.txt, is not 32/64-bit compatible before |
| 1789 | dnl version 2.6.27. A 32-bit kernel requires a 32-bit userland, and likewise for |
| 1790 | dnl 64-bit. The effect of this is that a 32-bit libpcap binary will not run |
| 1791 | dnl correctly on a 64-bit kernel (the binary will use the wrong offsets into a |
| 1792 | dnl kernel struct). This problem was solved in Linux 2.6.27. Use |
| 1793 | dnl --disable-packet-ring whenever a 32-bit application must run on a 64-bit |
| 1794 | dnl target host, and either the build host or the target host run Linux 2.6.26 |
| 1795 | dnl or earlier. |
| 1796 | AC_ARG_ENABLE([packet-ring], |
| 1797 | [AC_HELP_STRING([--enable-packet-ring],[enable Linux packet ring support @<:@default=yes@:>@])], |
| 1798 | ,enable_packet_ring=yes) |
| 1799 | |
| 1800 | if test "x$enable_packet_ring" != "xno" ; then |
| 1801 | AC_DEFINE(PCAP_SUPPORT_PACKET_RING, 1, [use Linux packet ring capture if available]) |
| 1802 | AC_SUBST(PCAP_SUPPORT_PACKET_RING) |
| 1803 | fi |
| 1804 | |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1805 | AC_PROG_INSTALL |
| 1806 | |
| 1807 | AC_CONFIG_HEADER(config.h) |
| 1808 | |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1809 | AC_OUTPUT_COMMANDS([if test -f .devel; then |
| 1810 | echo timestamp > stamp-h |
| 1811 | cat Makefile-devel-adds >> Makefile |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1812 | make depend |
JP Abgrall | 511eca3 | 2014-02-12 13:46:45 -0800 | [diff] [blame] | 1813 | fi]) |
| 1814 | AC_OUTPUT(Makefile pcap-filter.manmisc pcap-linktype.manmisc |
| 1815 | pcap-tstamp.manmisc pcap-savefile.manfile pcap.3pcap |
| 1816 | pcap_compile.3pcap pcap_datalink.3pcap pcap_dump_open.3pcap |
| 1817 | pcap_get_tstamp_precision.3pcap pcap_list_datalinks.3pcap |
| 1818 | pcap_list_tstamp_types.3pcap pcap_open_dead.3pcap |
| 1819 | pcap_open_offline.3pcap pcap_set_tstamp_precision.3pcap |
| 1820 | pcap_set_tstamp_type.3pcap) |
The Android Open Source Project | 478ab6c | 2009-03-03 19:30:05 -0800 | [diff] [blame] | 1821 | exit 0 |