configure.ac 34 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214
  1. dnl $Id: configure.ac 2196 2009-02-04 21:18:09Z aturner $
  2. AC_INIT(tcpreplay)
  3. AC_CONFIG_SRCDIR(src/tcpreplay.c)
  4. AM_CONFIG_HEADER(src/config.h)
  5. AC_CONFIG_AUX_DIR(config)
  6. AM_MAINTAINER_MODE
  7. AM_WITH_DMALLOC
  8. dnl People building from SVN need the same version of Autogen as I'm using
  9. dnl or specify --disable-local-libopts
  10. MAINTAINER_AUTOGEN_VERSION=5.9.7
  11. AC_CONFIG_MACRO_DIR([m4])
  12. dnl Set version info here!
  13. MAJOR_VERSION=3
  14. MINOR_VERSION=4
  15. MICRO_VERSION=1
  16. TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
  17. dnl Release is only used for the RPM spec file
  18. TCPREPLAY_RELEASE=1
  19. AC_DEFINE(PACKAGE, [tcpreplay], [This is our package name])
  20. AC_DEFINE_UNQUOTED(VERSION, "$TCPREPLAY_VERSION", [What is our version?])
  21. AC_SUBST(TCPREPLAY_VERSION)
  22. AC_SUBST(TCPREPLAY_RELEASE)
  23. USER_CFLAGS=$CFLAGS
  24. CFLAGS="${CFLAGS} -Wall -O3 -std=gnu99"
  25. dnl Determine OS
  26. AC_CANONICAL_BUILD
  27. AC_CANONICAL_HOST
  28. AC_CANONICAL_TARGET
  29. AC_SUBST(host)
  30. AC_SUBST(build)
  31. AC_SUBST(target)
  32. have_cygwin=no
  33. AC_MSG_CHECKING([for cygwin development environment])
  34. if test `echo $target | grep -c cygwin` -gt 0 ; then
  35. AC_DEFINE([HAVE_WIN32], [1], [Windows/Cygwin])
  36. AC_MSG_RESULT(yes)
  37. have_cygwin=yes
  38. else
  39. AC_MSG_RESULT(no)
  40. fi
  41. AM_INIT_AUTOMAKE(tcpreplay, $TCPREPLAY_VERSION, nodefine)
  42. dnl Checks for programs.
  43. AC_PROG_INSTALL
  44. AC_PROG_LIBTOOL
  45. AM_PROG_CC_C_O
  46. AC_PROG_CC_STDC
  47. AC_PROG_CXX
  48. AC_PROG_CPP
  49. AC_PROG_LN_S
  50. LT_INIT
  51. AC_PROG_AWK
  52. AC_PROG_SED
  53. AC_PROG_MAKE_SET
  54. AC_EXEEXT
  55. AC_PATH_PROG(PRINTF, printf)
  56. AC_PATH_PROG(ECHO, echo)
  57. AC_PATH_PROG(CUT, cut)
  58. AC_PATH_PROG(AUTOGEN, autogen)
  59. AC_PATH_PROG(GROFF, groff)
  60. dnl check autogen version
  61. AUTOGEN_VERSION=unknown
  62. if test -n "${AUTOGEN}" ; then
  63. AC_MSG_CHECKING(for autogen version >= 5.9.x)
  64. ${AUTOGEN} -v >autogen.version
  65. AUTOGEN_VERSION=`cat autogen.version | ${SED} 's|.*\([[0-9\.]]\{5,\}\).*|\1|'`
  66. AUTOGEN_MAJOR=`echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 1`
  67. AUTOGEN_MINOR=`echo ${AUTOGEN_VERSION} | ${CUT} -d '.' -f 2`
  68. if ( test ${AUTOGEN_MAJOR} -eq 5 && test ${AUTOGEN_MINOR} -lt 9 ) || test ${AUTOGEN_MAJOR} -lt 5 ; then
  69. AC_MSG_RESULT(no)
  70. AC_MSG_WARN([${AUTOGEN} is too old (${AUTOGEN_VERSION}) for building from SVN. Please upgrade to 5.9.x)])
  71. else
  72. AC_MSG_RESULT(yes)
  73. fi
  74. rm -f autogen.version
  75. dnl Compare the installed version with the maintainer version if building from SVN and not using system libopts
  76. if test ! -f src/tcpreplay_opts.c && test "x$enable_local_libopts" = "xyes" ; then
  77. if test $MAINTAINER_AUTOGEN_VERSION != $AUTOGEN_VERSION ; then
  78. AC_MSG_ERROR([Your version of autogen ($AUTOGEN_VERSION) != libopts tear off ($MAINTAINER_AUTOGEN_VERSION) Either install the correct version or specify --disable-local-libopts])
  79. fi
  80. fi
  81. else
  82. if test ! -f src/tcpreplay_opts.c ; then
  83. AC_MSG_ERROR([Please install GNU autogen >= 5.9.x if you are building from SVN])
  84. fi
  85. fi
  86. AC_DEFINE([AUTOGEN_VERSION], [${AUTOGEN_VERSION}], [What version of autogen is installed on this system])
  87. if test "x$enable_local_libopts" = "xyes" ; then
  88. AC_MSG_NOTICE([Using included libopts tearoff])
  89. else
  90. AC_MSG_NOTICE([Using system libopts])
  91. fi
  92. AC_HEADER_STDC
  93. AC_HEADER_MAJOR
  94. dnl Checks for typedefs, structures, and compiler characteristics.
  95. AC_TYPE_SIZE_T
  96. AC_HEADER_TIME
  97. AC_C_CONST
  98. AC_C_INLINE
  99. AC_SYS_LARGEFILE
  100. dnl Check for functions
  101. AC_FUNC_FSEEKO
  102. dnl Check for types.
  103. AC_CHECK_TYPE(u_int8_t, uint8_t)
  104. AC_CHECK_TYPE(u_int16_t, uint16_t)
  105. AC_CHECK_TYPE(u_int32_t, uint32_t)
  106. AC_CHECK_TYPE(u_int64_t, uint64_t)
  107. dnl Older versions of GCC don't support these options
  108. AC_MSG_CHECKING(for $CC -Wextra support)
  109. OLD_CFLAGS=$CFLAGS
  110. CFLAGS="$CFLAGS -Wextra"
  111. wextra=""
  112. AC_COMPILE_IFELSE([#include <stdlib.h>
  113. int main(int argc, char *argv[]) { return(0); }],
  114. [ AC_MSG_RESULT(yes)
  115. wextra="-Wextra" ],
  116. [ AC_MSG_RESULT(no) ])
  117. CFLAGS="$OLD_CFLAGS $wextra"
  118. AC_MSG_CHECKING(for $CC -Wno-variadic-macros support)
  119. OLD_CFLAGS=$CFLAGS
  120. CFLAGS="$CFLAGS -Wno-variadic-macros"
  121. wno_variadic_macros=""
  122. AC_COMPILE_IFELSE([#include <stdlib.h>
  123. int main(int argc, char *argv[]) { return(0); }],
  124. [ AC_MSG_RESULT(yes)
  125. wno_variadic_macros="-Wno-variadic-macros" ],
  126. [ AC_MSG_RESULT(no) ])
  127. CFLAGS="$OLD_CFLAGS $wno_variadic_macros"
  128. AC_MSG_CHECKING(for $CC -Wfatal-errors support)
  129. OLD_CFLAGS=$CFLAGS
  130. CFLAGS="$CFLAGS -Wfatal-errors"
  131. wfatal_errors=""
  132. AC_COMPILE_IFELSE([#include <stdlib.h>
  133. int main(int argc, char *argv[]) { return(0); }],
  134. [ AC_MSG_RESULT(yes)
  135. wfatal_errors="-Wfatal-errors" ],
  136. [ AC_MSG_RESULT(no) ])
  137. CFLAGS="$OLD_CFLAGS $wfatal_errors"
  138. dnl Check for other header files
  139. AC_CHECK_HEADERS([fcntl.h stddef.h sys/socket.h arpa/inet.h sys/time.h signal.h string.h strings.h sys/types.h stdint.h sys/select.h netinet/in.h poll.h sys/poll.h unistd.h sys/param.h])
  140. dnl OpenBSD has special requirements
  141. AC_CHECK_HEADERS([sys/sysctl.h net/route.h], [], [], [
  142. [#if HAVE_SYS_PARAM_H
  143. #include <sys/param.h>
  144. #endif
  145. #if HAVE_SYS_TYPES_H
  146. #include <sys/types.h>
  147. #endif
  148. #if HAVE_SYS_SOCKET_H
  149. #include <sys/socket.h>
  150. #endif
  151. ]])
  152. dnl Checks for libraries.
  153. AC_CHECK_LIB(socket, socket)
  154. AC_CHECK_LIB(nsl, gethostbyname)
  155. AC_CHECK_LIB(rt, nanosleep)
  156. AC_CHECK_LIB(resolv, resolv)
  157. dnl Checks for library functions.
  158. AC_FUNC_MALLOC
  159. AC_FUNC_MEMCMP
  160. AC_TYPE_SIGNAL
  161. AC_FUNC_VPRINTF
  162. AC_CHECK_MEMBERS([struct timeval.tv_sec])
  163. AC_CHECK_FUNCS([gettimeofday ctime memset regcomp strdup strchr strerror strtol strncpy strtoull poll ntohll mmap snprintf vsnprintf strsignal])
  164. dnl Look for strlcpy since some BSD's have it
  165. AC_CHECK_FUNCS([strlcpy],have_strlcpy=true,have_strlcpy=false)
  166. AM_CONDITIONAL(SYSTEM_STRLCPY, [test x$have_strlcpy = xtrue])
  167. AC_C_BIGENDIAN
  168. AM_CONDITIONAL([WORDS_BIGENDIAN], [ test x$ac_cv_c_bigendian = xyes ])
  169. dnl Enable debugging in code/compiler options
  170. debug=no
  171. AC_ARG_ENABLE(debug,
  172. AC_HELP_STRING([--enable-debug], [Enable debugging code and support for the -d option]),
  173. [ if test x$enableval = xyes; then
  174. debug=yes
  175. CFLAGS="${USER_CFLAGS} -ggdb -std=gnu99 -Wall $wextra $wfatal_errors $wno_variadic_macros"
  176. # We may also want to add:
  177. # -Wformat-security -Wswitch-default -Wunused-paramter -Wpadded"
  178. AC_SUBST(debug_flag)
  179. AC_DEFINE([DEBUG], [1], [Enable debuging code and support for the -d option])
  180. fi])
  181. AC_ARG_ENABLE(dmalloc,
  182. AC_HELP_STRING([--enable-dmalloc], [Enable linking to dmalloc for better memory debugging]),
  183. [ if test x$enableval = xyes ; then
  184. dmalloc=yes
  185. AC_DEFINE([ENABLE_DMALLOC], [1], [Enable dmalloc])
  186. AC_DEFINE([DMALLOC_FUNC_CHECK], [1], [Enable dmalloc function arg checking])
  187. CFLAGS="${CFLAGS} -I/opt/local/include"
  188. DMALLOC_LIB="/opt/local/lib/libdmalloc.a"
  189. AC_SUBST(DMALLOC_LIB)
  190. fi])
  191. AC_ARG_ENABLE(pedantic,
  192. AC_HELP_STRING([--enable-pedantic], [Enable gcc's -pedantic option]),
  193. [ if test x$enableval = xyes; then
  194. CFLAGS="$CFLAGS -pedantic"
  195. fi ])
  196. dnl Enable Efense
  197. AC_ARG_ENABLE(efence,
  198. AC_HELP_STRING([--enable-efence], [Enable Electric Fence memory debugger]),
  199. [ if test x$enableval = xyes; then
  200. CFLAGS="$CFLAGS -lefence"
  201. AC_DEFINE([EFENCE], [1], [Enable Electric Fence memory debugger])
  202. fi])
  203. dnl Enable Gprof
  204. AC_ARG_ENABLE(gprof,
  205. AC_HELP_STRING([--enable-gprof], [Enable GNU Profiler]),
  206. [ if test x$enableval = xyes; then
  207. if test $debug = yes; then
  208. CFLAGS="$CFLAGS -pg"
  209. else
  210. # GPROF requires gdb
  211. CFLAGS="$CFLAGS -ggdb -pg -fprofile-arcs"
  212. fi
  213. AC_DEFINE([GPROF], [1], [Enable GNU Profiler])
  214. fi])
  215. dnl Use 64bits for packet counters
  216. use64bit_counters=yes
  217. AC_ARG_ENABLE(64bits,
  218. AC_HELP_STRING([--disable-64bits], [Do not use 64bit packet counters]),
  219. [
  220. AC_MSG_NOTICE([Using u_int32_t for packet counters])
  221. ],
  222. [
  223. AC_DEFINE([ENABLE_64BITS], [1], [Use 64bit packet counters])
  224. AC_MSG_NOTICE([Using u_int64_t for packet counters])
  225. ])
  226. # If we're running gcc add '-D_U_="__attribute__((unused))"' to CFLAGS as well,
  227. # so we can use _U_ to flag unused function arguments and not get warnings
  228. # about them. Otherwise, add '-D_U_=""', so that _U_ used to flag an unused
  229. # function argument will compile with non-GCC compilers.
  230. #
  231. if test "x$GCC" = "xyes" ; then
  232. CFLAGS="-D_U_=\"__attribute__((unused))\" $CFLAGS"
  233. else
  234. CFLAGS="-D_U_=\"\" $CFLAGS"
  235. fi
  236. AC_ARG_ENABLE(force-bpf,
  237. AC_HELP_STRING([--enable-force-bpf], [Force using BPF for sending packets]),
  238. [ AC_DEFINE([FORCE_INJECT_BPF], [1], [Force using BPF for sending packet])])
  239. AC_ARG_ENABLE(force-pf,
  240. AC_HELP_STRING([--enable-force-pf], [Force using Linux's PF_PACKET for sending packets]),
  241. [ AC_DEFINE([FORCE_INJECT_PF], [1], [Force using Linux's PF_PACKET for sending packets])])
  242. AC_ARG_ENABLE(force-libdnet,
  243. AC_HELP_STRING([--enable-force-libdnet], [Force using libdnet for sending packets]),
  244. [ AC_DEFINE([FORCE_INJECT_LIBDNET], [1], [Force using libdnet for sending packets])])
  245. AC_ARG_ENABLE(force-inject,
  246. AC_HELP_STRING([--enable-force-inject], [Force using libpcap's pcap_inject() for sending packets]),
  247. [ AC_DEFINE([FORCE_INJECT_PCAP_INJECT],[1], [Force using libpcap's pcap_inject() for sending packets])])
  248. AC_ARG_ENABLE(force-sendpacket,
  249. AC_HELP_STRING([--enable-force-sendpacket], [Force using libpcap's pcap_sendpacket() for sending packets]),
  250. [ AC_DEFINE([FORCE_INJECT_PCAP_SENDPACKET], [1], [Force using libpcap's pcap_sendpacket() for sending packets])])
  251. dnl Dynamic link libraries
  252. dynamic_link=no
  253. AC_ARG_ENABLE(dynamic-link,
  254. AC_HELP_STRING([--enable-dynamic-link], [Dynamically link libraries]),
  255. [ if test x$enableval = xyes; then
  256. AC_DEFINE([ENABLE_DYNAMIC_LINK], [1], [Enable dynamically linking libs])
  257. dynamic_link=yes
  258. fi
  259. ])
  260. dnl Check for inet_aton and inet_pton
  261. AC_CHECK_FUNC(inet_aton,
  262. AC_DEFINE([HAVE_INET_ATON], [1], [Do we have inet_aton?])
  263. inet_aton=yes,
  264. inet_aton=no)
  265. AC_CHECK_FUNC(inet_pton,
  266. AC_DEFINE([HAVE_INET_PTON], [1], [Do we have inet_pton?])
  267. inet_pton=yes,
  268. inet_pton=no)
  269. AC_CHECK_FUNC(inet_ntop,
  270. AC_DEFINE([HAVE_INET_NTOP], [1], [Do we have inet_ntop?])
  271. inet_ntop=yes,
  272. inet_ntop=no)
  273. if test "$inet_ntop" = "no" -a "$inet_pton" = "no" ; then
  274. AC_MSG_ERROR([We need either inet_ntop or inet_pton])
  275. fi
  276. AC_CHECK_FUNC(inet_addr,
  277. AC_DEFINE([HAVE_INET_ADDR], [1], [Do we have inet_addr?])
  278. inet_addr=yes,
  279. inet_addr=no)
  280. if test x$inet_addr = no ; then
  281. AC_MSG_ERROR([We need inet_addr. See bug 26])
  282. fi
  283. dnl #####################################################
  284. dnl Checks for libpcap
  285. dnl #####################################################
  286. foundpcap=no
  287. trypcapdir=/usr/local
  288. AC_MSG_CHECKING(for libpcap)
  289. AC_ARG_WITH(libpcap,
  290. AC_HELP_STRING([--with-libpcap=DIR], [Use libpcap in DIR]),
  291. [trypcapdir=$withval])
  292. for testdir in $trypcapdir /usr/local /opt/local /usr /wpdpack ; do
  293. if test -f "${testdir}/include/pcap.h" -a $foundpcap = no ; then
  294. LPCAPINC="${testdir}/include/pcap.h"
  295. LPCAPINCDIR="${testdir}/include"
  296. if test $dynamic_link = yes; then
  297. if test -f "${testdir}/lib64/libpcap${shrext_cmds}" ; then
  298. LPCAPLIB="-L${testdir}/lib64 -lpcap"
  299. elif test -f "${testdir}/lib/libpcap${shrext_cmds}" ; then
  300. LPCAPLIB="-L${testdir}/lib -lpcap"
  301. else
  302. AC_ERROR([Unable to find libpcap in ${testdir}])
  303. fi
  304. elif test -f "${testdir}/lib64/libpcap.${libext}" ; then
  305. LPCAPLIB="${testdir}/lib64/libpcap.${libext}"
  306. elif test -f "${testdir}/lib/libpcap.${libext}" ; then
  307. LPCAPLIB="${testdir}/lib/libpcap.${libext}"
  308. elif test -f "${testdir}/lib/libwpcap.${libext}" ; then
  309. LPCAPLIB="${testdir}/lib/libwpcap.${libext}"
  310. AC_DEFINE([HAVE_WINPCAP], [1], [Do we have WinPcap?])
  311. else
  312. AC_ERROR([Unable to find matching library for header file in ${testdir}])
  313. fi
  314. foundpcap=$testdir
  315. fi
  316. done
  317. if test $foundpcap = no ; then
  318. AC_MSG_RESULT(no)
  319. AC_ERROR(libpcap not found)
  320. else
  321. AC_MSG_RESULT($foundpcap)
  322. fi
  323. AC_SUBST(LPCAPINC)
  324. AC_SUBST(LPCAPLIB)
  325. dnl Checks to see what version of libpcap we've got
  326. OLDLIBS="$LIBS"
  327. OLDCFLAGS="$CFLAGS -I$LPCAPINCDIR"
  328. LIBS="$LPCAPLIB"
  329. CFLAGS="$CFLAGS -I$LPCAPINCDIR"
  330. dnl Check to see what version of libpcap
  331. dnl this code has been reduced a lot, but probably still could be
  332. dnl reduced quite a bit more if we chose too
  333. AC_MSG_CHECKING(for libpcap version)
  334. dnl 0.9.6 (which is still thinks it is 0.9.5 due to a bug) introduces an important
  335. dnl fix for OSX. See: http://tcpreplay.synfin.net/trac/ticket/167
  336. libpcap_version_096=no
  337. AC_RUN_IFELSE(AC_LANG_PROGRAM([[
  338. #include <string.h>
  339. #include <stdlib.h>
  340. #include <stdio.h>
  341. #include "$LPCAPINC"
  342. #define PCAP_TEST "0.9.6"
  343. ]], [[
  344. /*
  345. * simple proggy to test the version of libpcap
  346. * returns zero if version >= 0.9.6
  347. * or one otherwise
  348. */
  349. if (strncmp(pcap_lib_version(), PCAP_TEST, 5) >= 0)
  350. exit(0);
  351. exit(1);
  352. ]]), [
  353. libpcap_version_096=yes
  354. ])
  355. AC_RUN_IFELSE(AC_LANG_PROGRAM([[
  356. #include <string.h>
  357. #include <stdlib.h>
  358. #include <stdio.h>
  359. #include "$LPCAPINC"
  360. #define PCAP_TEST "0.8"
  361. ]], [[
  362. /*
  363. * simple proggy to test the version of libpcap
  364. * returns zero if version >= 0.8.0
  365. * or one otherwise
  366. */
  367. if (strncmp(pcap_lib_version(), PCAP_TEST, 3) >= 0)
  368. exit(0);
  369. /* winpcap? */
  370. if (strncmp(pcap_lib_version(), "WinPcap", 7) == 0)
  371. exit(0);
  372. exit(1);
  373. ]]), [
  374. libpcap_ver8=yes
  375. ], [
  376. libpcap_ver8=no
  377. ])
  378. AC_RUN_IFELSE(AC_LANG_PROGRAM([[
  379. #include <string.h>
  380. #include <stdlib.h>
  381. #include <stdio.h>
  382. #include "$LPCAPINC"
  383. #define PCAP_TEST "0.7.2"
  384. extern const char pcap_version[[]]; /* double up since autoconf escapes things */
  385. ]], [[
  386. /*
  387. * simple proggy to test the version of libpcap
  388. * returns zero if version >= 0.7.2
  389. * or one otherwise
  390. */
  391. if (strncmp(pcap_version, PCAP_TEST, 5) >= 0)
  392. exit(0);
  393. exit(1);
  394. ]]), [
  395. libpcap_ver7=yes
  396. ], [
  397. libpcap_ver7=no
  398. ])
  399. if test $libpcap_ver8 = yes ; then
  400. AC_MSG_RESULT(>= 0.8.0)
  401. elif test $libpcap_ver7 = yes ; then
  402. AC_MSG_RESULT(>= 0.7.2)
  403. else
  404. AC_MSG_ERROR([Libpcap versions < 0.7.2 are not supported
  405. Please upgrade to version 0.7.2 or better])
  406. fi
  407. libpcap_version=unknown
  408. if test $libpcap_version_096 = yes ; then
  409. libpcap_version=">= 0.9.6"
  410. elif test $libpcap_ver8 = yes ; then
  411. libpcap_version=">= 0.8.0"
  412. elif test $libcap_ver7 = yes ; then
  413. libpcap_version=">= 0.7.0"
  414. fi
  415. dnl Check for pcap_setnonblock()
  416. AC_MSG_CHECKING(for pcap_setnonblock)
  417. AC_LINK_IFELSE(AC_LANG_PROGRAM([[
  418. #include <stdio.h>
  419. #include <stdlib.h>
  420. #include <string.h>
  421. #include "$LPCAPINC"
  422. ]],[[
  423. pcap_t *p;
  424. char *errbuf;
  425. pcap_setnonblock(p, 1, errbuf);
  426. exit(0);
  427. ]]), [
  428. have_pcap_setnonblock=yes
  429. AC_MSG_RESULT(yes)
  430. ], [
  431. have_pcap_setnonblock=no
  432. AC_MSG_RESULT(no)
  433. ])
  434. if test $have_pcap_setnonblock = yes ; then
  435. AC_DEFINE([HAVE_PCAP_SETNONBLOCK], [1],
  436. [Does libpcap have pcap_setnonblock?])
  437. fi
  438. dnl Check to see if we've got pcap_datalink_val_to_name()
  439. AC_MSG_CHECKING(for pcap_datalink_val_to_description)
  440. AC_LINK_IFELSE(AC_LANG_PROGRAM([[
  441. #include <stdio.h>
  442. #include <stdlib.h>
  443. #include <string.h>
  444. #include "$LPCAPINC"
  445. ]],[[
  446. if (strcmp(pcap_datalink_val_to_description(1), "Ethernet (10Mb)") == 0)
  447. exit(0);
  448. exit(1);
  449. ]]),[
  450. have_dlt_to_desc=yes
  451. AC_MSG_RESULT(yes)
  452. ], [
  453. have_dlt_to_desc=no
  454. AC_MSG_RESULT(no)
  455. ])
  456. if test $have_dlt_to_desc = yes ; then
  457. AC_DEFINE([HAVE_DLT_VAL_TO_DESC], [1],
  458. [Does libpcap have pcap_datalink_val_to_description?])
  459. fi
  460. dnl Check for pcap_get_selectable_fd()
  461. AC_MSG_CHECKING(for pcap_get_selectable_fd)
  462. AC_LINK_IFELSE(AC_LANG_PROGRAM([[
  463. #include <stdio.h>
  464. #include <stdlib.h>
  465. #include <string.h>
  466. #include "$LPCAPINC"
  467. ]], [[
  468. int f;
  469. pcap_t *p;
  470. f = pcap_get_selectable_fd(p);
  471. exit(0);
  472. ]]), [
  473. have_pcap_get_selectable_fd=yes
  474. AC_MSG_RESULT(yes)
  475. ], [
  476. have_pcap_get_selectable_fd=no
  477. AC_MSG_RESULT(no)
  478. ])
  479. if test x$have_pcap_get_selectable_fd = xyes ; then
  480. AC_DEFINE([HAVE_PCAP_GET_SELECTABLE_FD], [1],
  481. [Does libpcap have pcap_get_selectable_fd?])
  482. fi
  483. dnl Important: winpcap apparently defines functions in it's header files
  484. dnl which aren't actually in the library. Totally fucked up. Hence, we
  485. dnl must actually LINK the code, not just compile it.
  486. dnl Check to see if we've got pcap_dump_fopen()
  487. AC_MSG_CHECKING(for pcap_dump_fopen)
  488. AC_LINK_IFELSE(AC_LANG_PROGRAM([[
  489. #include <stdio.h>
  490. #include <stdlib.h>
  491. #include <string.h>
  492. #include "$LPCAPINC"
  493. ]],[[
  494. pcap_dumper_t *dump;
  495. pcap_t *pcap;
  496. FILE *foo;
  497. dump = pcap_dump_fopen(pcap, foo);
  498. ]]),[
  499. have_pcap_dump_fopen=yes
  500. AC_MSG_RESULT(yes)
  501. ], [
  502. have_pcap_dump_fopen=no
  503. AC_MSG_RESULT(no)
  504. ])
  505. if test $have_pcap_dump_fopen = yes ; then
  506. AC_DEFINE([HAVE_PCAP_DUMP_FOPEN], [1],
  507. [Does libpcap have pcap_dump_fopen?])
  508. else
  509. AC_MSG_NOTICE([--verbose mode requires libpcap >= 0.9.0])
  510. fi
  511. have_pcap_inject=no
  512. dnl Check to see if we've got pcap_inject()
  513. AC_MSG_CHECKING(for pcap_inject sending support)
  514. AC_LINK_IFELSE(AC_LANG_PROGRAM([[
  515. #include <stdio.h>
  516. #include <stdlib.h>
  517. #include <string.h>
  518. #include "$LPCAPINC"
  519. ]],[[
  520. pcap_t *pcap;
  521. char *buf;
  522. pcap_inject(pcap, (void *)buf, 0);
  523. ]]),[
  524. have_pcap_inject=yes
  525. AC_MSG_RESULT(yes)
  526. ], [
  527. have_pcap_inject=no
  528. AC_MSG_RESULT(no)
  529. ])
  530. if test $have_pcap_inject = yes ; then
  531. AC_DEFINE([HAVE_PCAP_INJECT], [1], [Does libpcap have pcap_inject?])
  532. fi
  533. have_pcap_sendpacket=no
  534. dnl Check to see if we've got pcap_sendpacket()
  535. AC_MSG_CHECKING(for pcap_sendpacket sending support)
  536. AC_LINK_IFELSE(AC_LANG_PROGRAM([[
  537. #include <stdio.h>
  538. #include <stdlib.h>
  539. #include <string.h>
  540. #include "$LPCAPINC"
  541. ]],[[
  542. pcap_t *pcap;
  543. u_char *buf;
  544. pcap_sendpacket(pcap, buf, 0);
  545. ]]),[
  546. have_pcap_sendpacket=yes
  547. AC_MSG_RESULT(yes)
  548. ], [
  549. have_pcap_sendpacket=no
  550. AC_MSG_RESULT(no)
  551. ])
  552. if test $have_pcap_sendpacket = yes ; then
  553. AC_DEFINE([HAVE_PCAP_SENDPACKET], [1], [Does libpcap have pcap_sendpacket?])
  554. fi
  555. have_pcap_breakloop=no
  556. AC_MSG_CHECKING(for pcap_breakloop)
  557. AC_LINK_IFELSE(AC_LANG_PROGRAM([[
  558. #include <stdio.h>
  559. #include <stdlib.h>
  560. #include <string.h>
  561. #include "$LPCAPINC"
  562. ]],[[
  563. pcap_t *pcap;
  564. pcap_sendpacket(pcap);
  565. ]]),[
  566. have_pcap_breakloop=yes
  567. AC_MSG_RESULT(yes)
  568. ], [
  569. have_pcap_breakloop=no
  570. AC_MSG_RESULT(no)
  571. ])
  572. if test $have_pcap_breakloop = yes ; then
  573. AC_DEFINE([HAVE_PCAP_BREAKLOOP], [1], [Does libpcap have pcap_breakloop?])
  574. fi
  575. have_pcap_version=no
  576. dnl Check to see if we have pcap_version[]
  577. AC_MSG_CHECKING(for pcap_version[])
  578. AC_TRY_COMPILE([
  579. #include <stdio.h>
  580. #include <stdlib.h>
  581. #include <string.h>
  582. #include "$LPCAPINC"
  583. extern char pcap_version[];
  584. ],[
  585. printf("%s", pcap_version);
  586. ],[
  587. AC_DEFINE([HAVE_PCAP_VERSION],[1], [Does libpcap have pcap_version[]])
  588. AC_MSG_RESULT(yes)
  589. ],[
  590. AC_MSG_RESULT(no)
  591. ])
  592. # Tcpbridge requires libpcap and pcap_sendpacket()
  593. enable_tcpbridge=no
  594. if test x$foundpcap != xno -a x$have_pcap_sendpacket = xyes ; then
  595. # if we have pcap_sendpacket() then we can build tcpbridge on non-BPF systems
  596. if test x$have_bpf = xno; then
  597. AC_DEFINE(ENABLE_TCPBRIDGE, [1], [Compile tcpbridge])
  598. enable_tcpbridge=yes
  599. AC_MSG_NOTICE([Building tcpbridge])
  600. # BPF systems need to also have pcap_setnonblock()
  601. elif test x$have_pcap_setnonblock = xyes ; then
  602. AC_DEFINE(ENABLE_TCPBRIDGE, [1], [Compile tcpbridge])
  603. enable_tcpbridge=yes
  604. AC_MSG_NOTICE([Building tcpbridge])
  605. else
  606. AC_MSG_WARN([Unable to build tcpbridge. Try installing latest libpcap!])
  607. fi
  608. fi
  609. AM_CONDITIONAL(COMPILE_TCPBRIDGE, [test x$enable_tcpbridge = xyes ])
  610. have_pf=no
  611. dnl Check for linux PF_PACKET support
  612. AC_MSG_CHECKING(for PF_PACKET socket sending support)
  613. AC_TRY_COMPILE([
  614. #include <sys/socket.h>
  615. #include <netpacket/packet.h>
  616. #include <net/ethernet.h> /* the L2 protocols */
  617. #include <netinet/in.h> /* htons */
  618. ],[
  619. int pf_socket;
  620. pf_socket = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL));
  621. ],[
  622. AC_DEFINE([HAVE_PF_PACKET], [1],
  623. [Do we have Linux PF_PACKET socket support?])
  624. AC_MSG_RESULT(yes)
  625. have_pf=yes
  626. ],[
  627. AC_MSG_RESULT(no)
  628. ])
  629. have_bpf=no
  630. dnl Check for BSD's BPF
  631. AC_MSG_CHECKING(for BPF device sending support)
  632. AC_TRY_RUN([
  633. #include <stdio.h>
  634. #include <stdlib.h>
  635. #include <sys/types.h>
  636. #include <sys/socket.h>
  637. #include <fcntl.h>
  638. #include <sys/time.h>
  639. #include <sys/ioctl.h>
  640. #include <stdint.h>
  641. #include <net/bpf.h>
  642. #include <errno.h>
  643. int
  644. main(int argc, char *argv[]) {
  645. int fd;
  646. fd = open("/dev/bpf0", O_RDONLY, 0);
  647. /* if we opened it, we're good */
  648. if (fd > 1)
  649. exit(0);
  650. /* if we got EBUSY or permission denied it exists, so we're good */
  651. if (fd < 0 && (errno == EBUSY || errno == 13))
  652. exit(0);
  653. /* else suck, no good */
  654. exit(-1);
  655. }],
  656. [
  657. AC_DEFINE([HAVE_BPF], [1],
  658. [Do we have BPF device support?])
  659. AC_MSG_RESULT(yes)
  660. have_bpf=yes
  661. ],[
  662. AC_MSG_RESULT(no)
  663. ])
  664. dnl ##################################################
  665. dnl # Check for libdnet, but only if not Cygwin!
  666. dnl ##################################################
  667. founddnet=no
  668. have_libdnet=no
  669. libdnet_version=
  670. enable_fragroute=no
  671. trydnetdir=/usr/local
  672. if test $have_cygwin == no ; then
  673. AC_MSG_CHECKING(for libdnet)
  674. AC_ARG_WITH(libdnet,
  675. AC_HELP_STRING([--with-libdnet=DIR], [Use libdnet in DIR]),
  676. [trydnetdir=$withval])
  677. for testdir in $trydnetdir /usr/local /opt/local /usr ; do
  678. if test -x ${testdir}/bin/dnet-config -a $founddnet = no ; then
  679. LDNETINC="`$testdir/bin/dnet-config --cflags`"
  680. LDNETLIB="`$testdir/bin/dnet-config --libs`"
  681. libdnet_version="`$testdir/bin/dnet-config --version`"
  682. founddnet=$testdir
  683. fi
  684. done
  685. if test $founddnet = no ; then
  686. AC_MSG_RESULT(no)
  687. AC_MSG_WARN([libdnet not found, disabling fragroute feature])
  688. else
  689. AC_MSG_RESULT($founddnet)
  690. enable_fragroute=yes
  691. have_libdnet=yes
  692. AC_DEFINE([HAVE_LIBDNET], [1], [Do we have libdnet?])
  693. fi
  694. else
  695. AC_MSG_NOTICE([Skipping libdnet check under Cygwin for compatibility reasons])
  696. fi
  697. AC_SUBST(LDNETINC)
  698. AC_SUBST(LDNETLIB)
  699. AC_DEFINE_UNQUOTED([LIBDNET_VERSION], "$libdnet_version", [Version of libdnet])
  700. AM_CONDITIONAL(COMPILE_FRAGROUTE, [test x$founddnet != xno])
  701. if test x$founddnet != xno ; then
  702. AC_DEFINE(ENABLE_FRAGROUTE, [1], [Enable fragroute module])
  703. fi
  704. dnl Make sure we have a valid packet injection mechanisim
  705. if test $have_bpf = no -a $have_pcap_inject = no -a $have_pcap_sendpacket = no \
  706. -a $have_libdnet = no -a $have_pf = no ; then
  707. AC_MSG_ERROR([Unable to find a supported method to send packets. Please upgrade your libpcap or enable libdnet])
  708. fi
  709. dnl Older versions of libpcap are missing some DLT types
  710. dnl If doesn't exist, we'll define them in src/common/fakepcap.h
  711. AC_MSG_CHECKING(for DLT_LINUX_SLL in libpcap)
  712. AC_TRY_COMPILE([#include "$LPCAPINC"],
  713. [ int foo;
  714. foo = DLT_LINUX_SLL ],
  715. [ AC_DEFINE([HAVE_DLT_LINUX_SLL], [1],
  716. [Does pcap.h include a header with DLT_LINUX_SLL?])
  717. AC_MSG_RESULT(yes)
  718. ],
  719. AC_MSG_RESULT(no)
  720. )
  721. AC_MSG_CHECKING(for DLT_C_HDLC in libpcap)
  722. AC_TRY_COMPILE([#include "$LPCAPINC"],
  723. [ int foo;
  724. foo = DLT_C_HDLC ],
  725. [ AC_DEFINE([HAVE_DLT_C_HDLC], [1],
  726. [Does pcap.h include a header with DLT_C_HDLC?])
  727. AC_MSG_RESULT(yes)
  728. ],
  729. AC_MSG_RESULT(no)
  730. )
  731. PCAP_BPF_H_FILE="$LPCAPINCDIR/pcap-bpf.h"
  732. AC_MSG_CHECKING(for $PCAP_BPF_H_FILE)
  733. AC_TRY_COMPILE([#include <sys/types.h>
  734. #include <sys/time.h>
  735. #include <stdint.h>
  736. #include "$PCAP_BPF_H_FILE"],
  737. [ int foo;
  738. foo = BPF_MAJOR_VERSION; ],
  739. [ AC_DEFINE([INCLUDE_PCAP_BPF_HEADER], [1],
  740. [What is the path (if any) to the pcap-bpf.h
  741. header?])
  742. AC_MSG_RESULT(yes)
  743. AC_SUBST(PCAP_BPF_H_FILE)
  744. ],
  745. AC_MSG_RESULT(no)
  746. )
  747. foundbpfheader=no
  748. AC_MSG_CHECKING(for libpcap bpf header)
  749. for testfile in $LPCAPINCDIR/pcap/bpf.h $LPCAPINCDIR/pcap-bpf.h ; do
  750. if test -f "${testfile}" -a $foundbpfheader = no ; then
  751. AC_TRY_COMPILE([
  752. #include <sys/types.h>
  753. #include <sys/time.h>
  754. #include <stdint.h>
  755. #include "$testfile"],
  756. [
  757. int foo;
  758. foo = BPF_MAJOR_VERSION;
  759. ],
  760. [
  761. foundbpfheader=yes
  762. PCAP_BPF_H_FILE=$testfile
  763. AC_SUBST(PCAP_BPF_H_FILE)
  764. AC_DEFINE([INCLUDE_PCAP_BPF_HEADER], [1],
  765. [What is the path (if any) to the libpcap bpf header file?])
  766. AC_MSG_RESULT($testfile)
  767. ],
  768. AC_MSG_RESULT(no)
  769. )
  770. fi
  771. done
  772. dnl restore LIBS & CFLAGS
  773. LIBS="$OLDLIBS"
  774. CFLAGS="$OLDCFLAGS"
  775. dnl ##################################################
  776. dnl # Check for pcapnav
  777. dnl ##################################################
  778. pcapnav_ver=no
  779. pcncfg=no
  780. AC_ARG_WITH(pcapnav-config,
  781. AC_HELP_STRING([--with-pcapnav-config=FILE], [Use given pcapnav-config]),
  782. [ AC_MSG_CHECKING(for pcapnav-config)
  783. if test -x $withval ; then
  784. pcncfg=$withval
  785. AC_MSG_RESULT($pcncfg)
  786. elif test x$withval = xno ; then
  787. AC_MSG_RESULT(no)
  788. else
  789. AC_MSG_RESULT([Can't find pcapnav-config: disabling offset jump feature])
  790. fi ],
  791. [ AC_PATH_PROG(pcncfg,[pcapnav-config], [no] ) ]
  792. )
  793. if test $pcncfg != no ; then
  794. LNAVLIB=`$pcncfg --libs`
  795. LNAV_CFLAGS=`$pcncfg --cflags`
  796. PCAPNAV_VERSION=`$pcncfg --version`
  797. AC_SUBST(LNAVLIB)
  798. AC_SUBST(LNAV_CFLAGS)
  799. AC_DEFINE_UNQUOTED(PCAPNAV_VERSION, "$PCAPNAV_VERSION",
  800. [libpcapnav's version?])
  801. dnl Check to see what version of libpcapnav
  802. dnl this code has been reduced a lot, but probably still could be
  803. dnl reduced quite a bit more if we chose too
  804. AC_MSG_CHECKING(for libpcapnav version)
  805. AC_TRY_RUN([
  806. #include <string.h>
  807. #define PCAPNAV_TEST "0.4"
  808. /*
  809. * simple proggy to test the version of libpcapnav
  810. * returns zero if version >= 0.4
  811. * or one otherwise
  812. */
  813. int
  814. main (int argc, char *argv[])
  815. {
  816. if (strncmp(PCAPNAV_VERSION, PCAPNAV_TEST, 3) >= 0)
  817. exit(0);
  818. exit(1);
  819. }],
  820. libpcapnav_ver=yes
  821. AC_MSG_RESULT(>= 0.4),
  822. libpcapnav_ver=no
  823. AC_MSG_RESULT(< 0.4),
  824. libpcapnav_ver=no
  825. )
  826. if test x$libpcapnav_ver = xno ; then
  827. AC_MSG_WARN([Libpcapnav versions < 0.4 are not supported.
  828. Please upgrade to version 0.4 or better.
  829. Disabling offset jump feature.])
  830. else
  831. AC_DEFINE([HAVE_PCAPNAV], [1], [Do we have libpcapnav?])
  832. fi
  833. fi # checking pcapnav version
  834. dnl (shamelessly ripped off from libpcap)
  835. dnl Checks to see if unaligned memory accesses fail
  836. dnl
  837. dnl FORCE_ALIGN (DEFINED)
  838. dnl
  839. AC_MSG_CHECKING(for requires strict byte alignment)
  840. AC_CACHE_VAL(unaligned_cv_fail,
  841. [case "$host_cpu" in
  842. # XXX: should also check that they don't do weird things (like on arm)
  843. alpha*|arm*|hp*|mips*|sparc*|ia64)
  844. unaligned_cv_fail=yes
  845. ;;
  846. *)
  847. cat >conftest.c <<EOF
  848. #include <sys/types.h>
  849. #include <sys/wait.h>
  850. #include <stdio.h>
  851. unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
  852. main() {
  853. unsigned int i;
  854. pid_t pid;
  855. int status;
  856. /* avoid "core dumped" message */
  857. pid = fork();
  858. if (pid < 0)
  859. exit(2);
  860. if (pid > 0) {
  861. /* parent */
  862. pid = waitpid(pid, &status, 0);
  863. if (pid < 0)
  864. exit(3);
  865. exit(!WIFEXITED(status));
  866. }
  867. /* child */
  868. i = *(unsigned int *)&a[[1]];
  869. printf("%d\n", i);
  870. exit(0);
  871. }
  872. EOF
  873. ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
  874. conftest.c $LIBS >/dev/null 2>&1
  875. if test ! -x conftest ; then
  876. dnl failed to compile for some reason
  877. unaligned_cv_fail=yes
  878. else
  879. ./conftest >conftest.out
  880. if test ! -s conftest.out ; then
  881. unaligned_cv_fail=yes
  882. else
  883. unaligned_cv_fail=no
  884. fi
  885. fi
  886. rm -f conftest* core core.conftest
  887. ;;
  888. esac])
  889. AC_MSG_RESULT($unaligned_cv_fail)
  890. if test $unaligned_cv_fail = yes ; then
  891. AC_DEFINE([FORCE_ALIGN], [1], [Are we strictly aligned?])
  892. fi
  893. dnl ##################################################
  894. dnl # Check for tcpdump.
  895. dnl ##################################################
  896. tcpdump_path=no
  897. AC_ARG_WITH(tcpdump,
  898. AC_HELP_STRING([--with-tcpdump=FILE], [Path to tcpdump binary]),
  899. [ if test -x $withval ; then
  900. tcpdump_path=$withval
  901. AC_MSG_RESULT([Using tcpdump in $tcpdump_path])
  902. else
  903. AC_MSG_RESULT([Error: $withval does not exist or is not executable])
  904. fi ],
  905. [ AC_PATH_PROG(tcpdump_path, tcpdump, "no", [$PATH:/usr/sbin:/sbin:/usr/local/sbin]) ])
  906. if test "$tcpdump_path" = "no"; then
  907. AC_MSG_WARN([Unable to find tcpdump. Please specify --with-tcpdump.
  908. Disabling --verbose])
  909. else
  910. AC_DEFINE([HAVE_TCPDUMP], [1], [Do we have tcpdump?])
  911. AC_DEFINE_UNQUOTED(TCPDUMP_BINARY, "$tcpdump_path", [The tcpdump binary initially used])
  912. fi
  913. AM_CONDITIONAL([ENABLE_TCPDUMP], test "$tcpdump_path" != "no" -a x$have_pcap_dump_fopen = xyes)
  914. if test x$tcpdump_path != xno -a x$have_pcap_dump_fopen = xyes ; then
  915. AC_DEFINE([ENABLE_VERBOSE], [1], [Do we have tcpdump and pcap_dump_fopen()?])
  916. else
  917. AC_MSG_WARN([Your version of libpcap is too old for --verbose support])
  918. fi
  919. dnl No 'make test' when cross compile
  920. AC_MSG_CHECKING(for 'make test' profile)
  921. if test "$host" != "$build" ; then
  922. AC_MSG_WARN(Unable to do tests when cross-compiling)
  923. fi
  924. dnl Allows user to choose which nic to use for testing purposes
  925. AC_ARG_WITH(testnic,
  926. AC_HELP_STRING([--with-testnic=NIC], [Select which network card to use for testing]),
  927. [ nic1=$withval
  928. nic2=$withval
  929. AC_MSG_RESULT([Using --with-testnic=$withval])],
  930. [
  931. dnl There's a bug in OS X which causes pcap_findalldevs() to make the wifi NIC to disassociate
  932. dnl so under OSX we disable the interface list feature
  933. disable_pcap_findalldevs=no
  934. osx_frameworks=no
  935. dnl these need to be dynamic based on OS
  936. case $host in
  937. *-*-linux*)
  938. nic1=eth0
  939. nic2=eth0
  940. AC_MSG_RESULT(Linux)
  941. ;;
  942. *-*-solaris*)
  943. nic1=hme0
  944. nic2=hme0
  945. AC_MSG_RESULT(Solaris)
  946. ;;
  947. *-*-sunos*)
  948. nic1=hme0
  949. nic2=hme0
  950. AC_MSG_RESULT(SunOS)
  951. ;;
  952. *-apple-darwin*)
  953. nic1=en0
  954. nic2=en0
  955. if test x$libpcap_version_096 = xno ; then
  956. disable_pcap_findalldevs=yes
  957. fi
  958. AC_DEFINE([HAVE_ABSOLUTE_TIME], [1], [Have OS X UpTime()/AbsoluteTime high-precision timing])
  959. osx_frameworks=yes
  960. AC_DEFINE([HAVE_DARWIN], [1], [Building Apple/Darwin])
  961. AC_MSG_RESULT(Apple OS X)
  962. ;;
  963. *-*-openbsd*)
  964. nic1=xl0
  965. nic2=xl0
  966. AC_MSG_RESULT(OpenBSD)
  967. ;;
  968. *-*-cygwin)
  969. AC_MSG_RESULT(Win32/Cygwin)
  970. nic1=%0
  971. nic2=%0
  972. ;;
  973. *)
  974. AC_MSG_RESULT([$host is unknown! Using first non-loopback interface])
  975. nic1=%0
  976. nic2=%0
  977. ;;
  978. esac])
  979. AM_CONDITIONAL([ENABLE_OSX_FRAMEWORKS], test "$osx_frameworks" == "yes")
  980. AC_ARG_WITH(testnic2,
  981. AC_HELP_STRING([--with-testnic2=NIC2], [Select an optional 2nd network card to use for testing]),
  982. [ nic2=$withval ])
  983. AC_MSG_NOTICE([Using $nic1 for 1st test network interface card])
  984. AC_MSG_NOTICE([Using $nic2 for 2nd test network interface card])
  985. AC_SUBST(nic1)
  986. AC_SUBST(nic2)
  987. AC_MSG_CHECKING([if it's ok to use pcap_findalldevs()])
  988. if test x$disable_pcap_findalldevs = xno ; then
  989. AC_DEFINE([ENABLE_PCAP_FINDALLDEVS], [1], [Enable use of pcap_findalldevs()])
  990. AC_MSG_RESULT(yes)
  991. else
  992. AC_MSG_RESULT(no)
  993. fi
  994. dnl tcpreplay has (so far) been relying on leading-edge autogen.
  995. dnl Therefore, by default:
  996. dnl - use the version we ship with
  997. dnl - do not install it
  998. dnl - build a static copy (AC_DISABLE_SHARED - implicitly done earlier)
  999. case "${enable_local_libopts+set}" in
  1000. set) ;;
  1001. *) enable_local_libopts=yes ;;
  1002. esac
  1003. case "${enable_libopts_install+set}" in
  1004. set) ;;
  1005. *) enable_libopts_install=no ;;
  1006. esac
  1007. LIBOPTS_CHECK(libopts)
  1008. AC_OUTPUT([Makefile
  1009. doxygen.cfg
  1010. lib/Makefile
  1011. docs/Makefile
  1012. src/Makefile
  1013. src/common/Makefile
  1014. src/tcpedit/Makefile
  1015. src/fragroute/Makefile
  1016. src/defines.h
  1017. test/Makefile
  1018. test/config
  1019. scripts/Makefile])
  1020. # Configuration results
  1021. AC_MSG_RESULT(
  1022. ##########################################################################
  1023. TCPREPLAY Suite Configuration Results (${TCPREPLAY_VERSION})
  1024. ##########################################################################
  1025. libpcap: ${foundpcap} (${libpcap_version})
  1026. libdnet: ${founddnet} (${libdnet_version})
  1027. autogen: ${AUTOGEN} (${AUTOGEN_VERSION})
  1028. Use libopts tearoff: ${enable_local_libopts}
  1029. 64bit counter support: ${use64bit_counters}
  1030. tcpdump binary path: ${tcpdump_path}
  1031. tcpreplay edit support: ${tcpreplay_edit}
  1032. fragroute support: ${enable_fragroute}
  1033. tcpbridge support: ${enable_tcpbridge}
  1034. Supported Packet Injection Methods (*):
  1035. Linux PF_PACKET: ${have_pf}
  1036. BSD BPF: ${have_bpf}
  1037. libdnet: ${have_libdnet}
  1038. pcap_inject: ${have_pcap_inject}
  1039. pcap_sendpacket: ${have_pcap_sendpacket} **
  1040. * In order of preference; see configure --help to override
  1041. ** Required for tcpbridge
  1042. )
  1043. case $host in
  1044. *-apple-darwin*)
  1045. AC_MSG_WARN([Apple OS X versions prior to 10.5 (Leopard) has a serious problem!
  1046. Please see: http://tcpreplay.synfin.net/trac/ticket/142 for more details])
  1047. ;;
  1048. *-*-cygwin)
  1049. AC_MSG_WARN([Windows/Cygwin support is still somewhat experimental.
  1050. Please report any bugs! http://tcpreplay.synfin.net/trac/newticket])
  1051. ;;
  1052. esac