configure.ac 59 KB

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