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