configure.in 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. dnl $Id: configure.in 1519 2006-07-18 02:51: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. AC_PROG_LIBTOOL
  9. dnl Set version info here!
  10. MAJOR_VERSION=3
  11. MINOR_VERSION=0
  12. MICRO_VERSION=beta9
  13. TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
  14. dnl Release is only used for the RPM spec file
  15. TCPREPLAY_RELEASE=1
  16. AC_DEFINE(PACKAGE, [tcpreplay], [This is our package name])
  17. AC_DEFINE_UNQUOTED(VERSION, "$TCPREPLAY_VERSION", [What is our version?])
  18. AC_SUBST(TCPREPLAY_VERSION)
  19. AC_SUBST(TCPREPLAY_RELEASE)
  20. CFLAGS="$CFLAGS -Wall -O2 -funroll-loops -std=gnu99" # -std=c99 -Wno-variadic-macros"
  21. dnl Determine OS
  22. AC_CANONICAL_BUILD
  23. AC_CANONICAL_HOST
  24. AC_CANONICAL_TARGET
  25. AC_SUBST(host)
  26. AC_SUBST(build)
  27. AC_SUBST(target)
  28. AM_INIT_AUTOMAKE(tcpreplay, $TCPREPLAY_VERSION, nodefine)
  29. dnl Checks for programs.
  30. AC_PROG_INSTALL
  31. AC_PROG_LIBTOOL
  32. AC_PROG_CC
  33. AC_PROG_CC_STDC
  34. AC_PROG_CXX
  35. AC_PROG_CPP
  36. AC_PROG_LN_S
  37. AC_PROG_RANLIB
  38. AC_PROG_AWK
  39. AC_PROG_MAKE_SET
  40. AC_EXEEXT
  41. AC_PATH_PROG(PRINTF, printf)
  42. AC_PATH_PROG(FIG2DEV, fig2dev)
  43. dnl Look for lyx in the normal locations
  44. dnl The OS X installer puts Lyx at /Applications/Lyx.app/Contents/MacOS/LyX
  45. AC_ARG_WITH(lyx,
  46. AC_HELP_STRING([--with-lyx=FILE], [Path to Lyx binary]),
  47. [ AC_MSG_CHECKING(for lyx)
  48. if test -x $withval ; then
  49. td=$withval
  50. AC_MSG_RESULT($td)
  51. else
  52. AC_MSG_RESULT([Error: $withval does not exist or is not executable])
  53. fi ],
  54. [
  55. case $host in
  56. powerpc-apple-darwin*)
  57. lyx=/Applications/Lyx.app/Contents/MacOS/LyX
  58. if test -x $lyx ; then
  59. AC_MSG_CHECKING(for lyx)
  60. AC_SUBST(LYX, $lyx)
  61. AC_MSG_RESULT($lyx)
  62. else
  63. AC_PATH_PROG(LYX, lyx)
  64. fi
  65. ;;
  66. *)
  67. AC_PATH_PROG(LYX, lyx)
  68. ;;
  69. esac
  70. ])
  71. AC_PATH_PROG(DVIPS, dvips)
  72. AC_PATH_PROG(TEXI2DVI, texi2dvi)
  73. AC_PATH_PROG(LATEX2HTML, latex2html)
  74. AC_PATH_PROG(DVIPDFM, dvipdfm)
  75. AC_PATH_PROG(AUTOGEN, autogen)
  76. AC_HEADER_STDC
  77. AC_HEADER_MAJOR
  78. dnl Checks for typedefs, structures, and compiler characteristics.
  79. AC_TYPE_SIZE_T
  80. AC_HEADER_TIME
  81. AC_C_CONST
  82. AC_C_INLINE
  83. AC_SYS_LARGEFILE
  84. dnl Check for functions
  85. AC_FUNC_FSEEKO
  86. dnl Check for types.
  87. AC_CHECK_TYPE(u_int8_t, uint8_t)
  88. AC_CHECK_TYPE(u_int16_t, uint16_t)
  89. AC_CHECK_TYPE(u_int32_t, uint32_t)
  90. AC_CHECK_TYPE(u_int64_t, uint64_t)
  91. dnl Check for other header files
  92. 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 sys/select.h netinet/in.h poll.h sys/poll.h unistd.h])
  93. dnl Checks for libraries.
  94. AC_CHECK_LIB(socket, socket)
  95. AC_CHECK_LIB(nsl, gethostbyname)
  96. AC_CHECK_LIB(rt, nanosleep)
  97. dnl Checks for library functions.
  98. AC_FUNC_MALLOC
  99. AC_FUNC_MEMCMP
  100. AC_TYPE_SIGNAL
  101. AC_FUNC_VPRINTF
  102. AC_CHECK_FUNCS([gettimeofday ctime memset regcomp strdup strerror strtol strncpy strtoull poll ntohll mmap])
  103. dnl Look for strlcpy since some BSD's have it
  104. AC_CHECK_FUNCS([strlcpy],have_strlcpy=true,have_strlcpy=false)
  105. AM_CONDITIONAL(SYSTEM_STRLCPY, [test x$have_strlcpy = xtrue])
  106. AC_CHECK_MEMBERS([struct timeval.tv_sec])
  107. AC_C_BIGENDIAN
  108. doctools=no
  109. if test -n "$FIG2DEV" -a -n "$LYX" -a -n "$DVIPS" -a -n "$TEXI2DVI" \
  110. -a -n "$LATEX2HTML" -a -n "$DVIPDFM" ; then
  111. doctools=yes
  112. fi
  113. AM_CONDITIONAL(HAVE_DOCTOOLS, test $doctools = yes)
  114. dnl Enable debugging in code/compiler options
  115. debug=no
  116. AC_ARG_ENABLE(debug,
  117. AC_HELP_STRING([--enable-debug], [Enable debugging code and support for the -d option]),
  118. [ if test x$enableval = xyes; then
  119. debug=yes
  120. CFLAGS="-ggdb -std=gnu99 -Wall -Wextra -Wfatal-errors -Wno-variadic-macros"
  121. # -Wformat-security -Wswitch-default -Wunused-paramter -Wpadded"
  122. AC_SUBST(debug_flag)
  123. AC_DEFINE([DEBUG], [], [Enable debuggin code and support for the -d option])
  124. fi])
  125. AC_ARG_ENABLE(pedantic,
  126. AC_HELP_STRING([--enable-pedantic], [Enable gcc's -pedantic option]),
  127. [ if test x$enableval = xyes; then
  128. CFLAGS="$CFLAGS -pedantic"
  129. fi ])
  130. dnl Enable Efense
  131. AC_ARG_ENABLE(efence,
  132. AC_HELP_STRING([--enable-efence], [Enable Electric Fence memory debugger]),
  133. [ if test x$enableval = xyes; then
  134. CFLAGS="$CFLAGS -lefence"
  135. AC_DEFINE([EFENCE], [], [Enable Electric Fence memory debugger])
  136. fi])
  137. dnl Enable Gprof
  138. AC_ARG_ENABLE(gprof,
  139. AC_HELP_STRING([--enable-gprof], [Enable GNU Profiler]),
  140. [ if test x$enableval = xyes; then
  141. if test $debug = yes; then
  142. CFLAGS="$CFLAGS -pg"
  143. else
  144. # GPROF requires gdb
  145. CFLAGS="$CFLAGS -ggdb -pg -fprofile-arcs"
  146. fi
  147. AC_DEFINE([GPROF], [], [Enable GNU Profiler])
  148. fi])
  149. dnl Use 64bits for packet counters
  150. AC_ARG_ENABLE(64bits,
  151. AC_HELP_STRING([--enable-64bits], [Use 64bit packet counters]),
  152. [ if test x$enableval = xyes; then
  153. AC_DEFINE([ENABLE_64BITS], [], [Use 64bit packet counters])
  154. AC_MSG_NOTICE([Using u_int64_t for packet counters])
  155. else
  156. AC_MSG_NOTICE([Using u_int32_t for packet counters])
  157. fi
  158. ])
  159. dnl Dynamic link libraries
  160. dynamic_link=no
  161. AC_ARG_ENABLE(dynamic-link,
  162. AC_HELP_STRING([--enable-dynamic-link], [Dynamically link libraries]),
  163. [ if test x$enableval = xyes; then
  164. AC_DEFINE([ENABLE_DYNAMIC_LINK], [], [Enable dynamically linking libs])
  165. dynamic_link=yes
  166. fi
  167. ])
  168. dnl Check for inet_aton and inet_pton
  169. AC_CHECK_FUNC(inet_aton,
  170. AC_DEFINE([HAVE_INET_ATON], [], [Do we have inet_aton?])
  171. inet_aton=yes,
  172. inet_aton=no)
  173. AC_CHECK_FUNC(inet_pton,
  174. AC_DEFINE([HAVE_INET_PTON], [], [Do we have inet_pton?])
  175. inet_pton=yes,
  176. inet_pton=no)
  177. AC_CHECK_FUNC(inet_ntop,
  178. AC_DEFINE([HAVE_INET_NTOP], [], [Do we have inet_ntop?])
  179. inet_ntop=yes,
  180. inet_ntop=no)
  181. if test "$inet_ntop" = "no" -a "$inet_pton" = "no" ; then
  182. AC_MSG_ERROR([We need either inet_ntop or inet_pton])
  183. fi
  184. if test "$inet_aton" = "no" ; then
  185. AC_MSG_ERROR([We need inet_aton])
  186. fi
  187. AC_CHECK_FUNC(inet_addr,
  188. AC_DEFINE([HAVE_INET_ADDR], [], [Do we have inet_addr?])
  189. inet_addr=yes,
  190. inet_addr=no)
  191. if test x$inet_addr = no ; then
  192. AC_MSG_ERROR([We need inet_addr. See bug 26])
  193. fi
  194. dnl ##################################################
  195. dnl Checks for libnet (shamelessly horked from dsniff)
  196. dnl ##################################################
  197. foundnet=no
  198. trynetdir=/usr/local
  199. AC_MSG_CHECKING(for libnet)
  200. AC_ARG_WITH(libnet,
  201. AC_HELP_STRING([--with-libnet=DIR], [Use libnet in DIR]),
  202. [trynetdir=$withval])
  203. for testdir in $trynetdir /usr/local /usr ; do
  204. if test -f "${testdir}/include/libnet.h" -a $foundnet = no ; then
  205. LNETINC="${testdir}/include/libnet.h"
  206. LNETINCDIR="$testdir/include"
  207. if test $dynamic_link = yes; then
  208. LNETLIB="-L${testdir}/lib -lnet"
  209. elif test -f "${testdir}/lib64/libnet.a" ; then
  210. LNETLIB="${testdir}/lib64/libnet.a"
  211. else
  212. LNETLIB="${testdir}/lib/libnet.a"
  213. fi
  214. foundnet=$testdir
  215. fi
  216. done
  217. if test $foundnet = no ; then
  218. AC_MSG_RESULT(no)
  219. AC_ERROR(libnet not found)
  220. else
  221. AC_MSG_RESULT($foundnet)
  222. fi
  223. AC_SUBST(LNETINC)
  224. AC_SUBST(LNETLIB)
  225. OLDLIBS="$LIBS"
  226. OLDCFLAGS="$CFLAGS"
  227. LIBS="$LNETLIB"
  228. CFLAGS="$CFLAGS -I$LNETINCDIR"
  229. dnl Check to see what version of libnet
  230. dnl this code has been reduced a lot, but probably still could be
  231. dnl reduced quite a bit more if we chose too
  232. AC_MSG_CHECKING(for libnet version)
  233. AC_TRY_RUN([
  234. #include <string.h>
  235. #define LIBNET_LIL_ENDIAN 1
  236. #include "$LNETINC"
  237. #define LIB_TEST "1.0"
  238. /*
  239. * simple proggy to test the version of libnet
  240. * returns zero if it's 1.0.x
  241. * or one otherwise
  242. */
  243. int
  244. main (int argc, char *argv[])
  245. {
  246. if (strncmp(LIB_TEST, LIBNET_VERSION, 3) == 0)
  247. exit(0);
  248. exit(1);
  249. }],
  250. libnet_ver_10=yes
  251. AC_MSG_RESULT(1.0.x),
  252. libnet_ver_10=no,
  253. libnet_ver_10=no
  254. )
  255. AC_TRY_RUN([
  256. #include <string.h>
  257. #include "$LNETINC"
  258. #define LIB_TEST "1.1"
  259. /*
  260. * simple proggy to test the version of libnet
  261. * returns zero if it's 1.0.x
  262. * or one otherwise
  263. */
  264. int
  265. main (int argc, char *argv[])
  266. {
  267. if (strncmp(LIB_TEST, LIBNET_VERSION, 3) == 0)
  268. exit(0);
  269. exit(1);
  270. }],
  271. libnet_ver_11=yes
  272. AC_MSG_RESULT(1.1.x),
  273. libnet_ver_11=no,
  274. libnet_ver_11=no
  275. )
  276. if test $libnet_ver_10 = no -a $libnet_ver_11 = no ; then
  277. AC_MSG_RESULT(unknown)
  278. AC_MSG_ERROR(Unable to determine version of libnet)
  279. fi
  280. if test $libnet_ver_10 = yes ; then
  281. AC_MSG_ERROR(Libnet version 1.0.x is no longer supported.
  282. Please upgrade to 1.1.0 or better)
  283. fi
  284. AC_MSG_CHECKING([for working libnet_checksum()])
  285. AC_TRY_RUN([
  286. #include <string.h>
  287. #include "$LNETINC"
  288. #define LIB_TEST "1.1.3"
  289. /*
  290. * simple proggy to test the version of libnet
  291. * returns zero if it's < 1.1.3 which has the checksum fix
  292. * or one otherwise
  293. */
  294. int
  295. main (int argc, char *argv[])
  296. {
  297. if (strncmp(LIB_TEST, LIBNET_VERSION, 5) <= 0)
  298. exit(0);
  299. exit(1);
  300. }],
  301. libnet_ver_113=yes,
  302. libnet_ver_113=no,
  303. libnet_ver_113=no
  304. )
  305. if test $libnet_ver_113 = no ; then
  306. AC_MSG_RESULT(no)
  307. AC_MSG_WARN([You should upgrade to libnet 1.1.3 or better if you
  308. want to modify packets])
  309. else
  310. AC_MSG_RESULT(yes)
  311. fi
  312. dnl restore LIBS & CFLAGS
  313. LIBS="$OLDLIBS"
  314. CFLAGS="$OLDCFLAGS"
  315. dnl #####################################################
  316. dnl Checks for libpcap
  317. dnl #####################################################
  318. foundpcap=no
  319. trypcapdir=/usr/local
  320. AC_MSG_CHECKING(for libpcap)
  321. AC_ARG_WITH(libpcap,
  322. AC_HELP_STRING([--with-libpcap=DIR], [Use libpcap in DIR]),
  323. [trypcapdir=$withval])
  324. for testdir in $trypcapdir /usr/local /usr ; do
  325. if test -f "${testdir}/include/pcap.h" -a $foundpcap = no ; then
  326. LPCAPINC="${testdir}/include/pcap.h"
  327. LPCAPINCDIR="${testdir}/include"
  328. if test $dynamic_link = yes; then
  329. LPCAPLIB="-L${testdir}/lib -lpcap"
  330. elif test -f "${testdir}/lib64/libpcap.a" ; then
  331. LPCAPLIB="${testdir}/lib64/libpcap.a"
  332. else
  333. LPCAPLIB="${testdir}/lib/libpcap.a"
  334. fi
  335. foundpcap=$testdir
  336. fi
  337. done
  338. if test $foundpcap = no ; then
  339. AC_MSG_RESULT(no)
  340. AC_ERROR(libpcap not found)
  341. else
  342. AC_MSG_RESULT($foundpcap)
  343. fi
  344. AC_SUBST(LPCAPINC)
  345. AC_SUBST(LPCAPLIB)
  346. dnl Checks to see what version of libpcap we've got
  347. OLDLIBS="$LIBS"
  348. OLDCFLAGS="$CFLAGS"
  349. LIBS="$LPCAPLIB"
  350. CFLAGS="$CFLAGS -I$LPCAPINCDIR"
  351. dnl Check to see what version of libpcap
  352. dnl this code has been reduced a lot, but probably still could be
  353. dnl reduced quite a bit more if we chose too
  354. AC_MSG_CHECKING(for libpcap version)
  355. AC_TRY_RUN([
  356. #include <string.h>
  357. #include <stdlib.h>
  358. #include <stdio.h>
  359. #include "$LPCAPINC"
  360. #define PCAP_TEST "0.5"
  361. /*
  362. * simple proggy to test the version of libpcap
  363. * returns zero if version >= 0.5
  364. * or one otherwise
  365. */
  366. extern char pcap_version[];
  367. int
  368. main (int argc, char *argv[])
  369. {
  370. if (strncmp(pcap_version, PCAP_TEST, 3) >= 0)
  371. exit(0);
  372. exit(1);
  373. }],
  374. libpcap_ver=yes
  375. AC_MSG_RESULT(>= 0.5),
  376. libpcap_ver=no
  377. AC_MSG_RESULT(< 0.5),
  378. libpcap_ver=no
  379. )
  380. if test $libpcap_ver = no ; then
  381. AC_MSG_ERROR(Libpcap versions < 0.5 are not supported.
  382. Please upgrade to version 0.5 or better)
  383. fi
  384. dnl Check to see if we've got pcap_datalink_val_to_name()
  385. AC_MSG_CHECKING(for pcap_datalink_val_to_description)
  386. AC_TRY_RUN([
  387. #include <stdio.h>
  388. #include <stdlib.h>
  389. #include <string.h>
  390. #include "$LPCAPINC"
  391. int
  392. main(int argc, char *argv[]) {
  393. pcap_datalink_val_to_description(1);
  394. exit(0);
  395. }
  396. ],
  397. have_dlt_to_desc=yes
  398. AC_MSG_RESULT(yes),
  399. have_dlt_to_desc=no
  400. AC_MSG_RESULT(no),
  401. have_dlt_to_desc=no
  402. )
  403. if test $have_dlt_to_desc = yes ; then
  404. AC_DEFINE([HAVE_DLT_VAL_TO_DESC], [],
  405. [Does libpcap have dlt_val_to_desc?])
  406. fi
  407. dnl Older versions of libpcap are missing some DLT types
  408. dnl If doesn't exist, we'll define them in src/common/fakepcap.h
  409. AC_MSG_CHECKING(for DLT_LINUX_SLL in libpcap)
  410. AC_TRY_COMPILE([#include "$LPCAPINC"],
  411. [ int foo;
  412. foo = DLT_LINUX_SLL ],
  413. [ AC_DEFINE([HAVE_DLT_LINUX_SLL],
  414. [], [Does pcap.h include a header with DLT_LINUX_SLL?])
  415. AC_MSG_RESULT(yes)
  416. ],
  417. AC_MSG_RESULT(no)
  418. )
  419. AC_MSG_CHECKING(for DLT_C_HDLC in libpcap)
  420. AC_TRY_COMPILE([#include "$LPCAPINC"],
  421. [ int foo;
  422. foo = DLT_C_HDLC ],
  423. [ AC_DEFINE([HAVE_DLT_C_HDLC],
  424. [], [Does pcap.h include a header with DLT_C_HDLC?])
  425. AC_MSG_RESULT(yes)
  426. ],
  427. AC_MSG_RESULT(no)
  428. )
  429. PCAP_BPF_H_FILE="$LPCAPINCDIR/pcap-bpf.h"
  430. AC_MSG_CHECKING(for $PCAP_BPF_H_FILE)
  431. AC_TRY_COMPILE([#include <sys/types.h>
  432. #include <sys/time.h>
  433. #include "$PCAP_BPF_H_FILE"],
  434. [ int foo;
  435. foo = BPF_MAJOR_VERSION; ],
  436. [ AC_DEFINE([INCLUDE_PCAP_BPF_HEADER], [],
  437. [What is the path (if any) to the pcap-bpf.h
  438. header?])
  439. AC_MSG_RESULT(yes)
  440. AC_SUBST(PCAP_BPF_H_FILE)
  441. ],
  442. AC_MSG_RESULT(no)
  443. )
  444. dnl restore LIBS & CFLAGS
  445. LIBS="$OLDLIBS"
  446. CFLAGS="$OLDCFLAGS"
  447. dnl ##################################################
  448. dnl # Check for pcapnav
  449. dnl ##################################################
  450. pcapnav_ver=no
  451. pcncfg=no
  452. AC_ARG_WITH(pcapnav-config,
  453. AC_HELP_STRING([--with-pcapnav-config=FILE], [Use given pcapnav-config]),
  454. [ AC_MSG_CHECKING(for pcapnav-config)
  455. if test -x $withval ; then
  456. pcncfg=$withval
  457. AC_MSG_RESULT($pcncfg)
  458. else
  459. AC_MSG_RESULT([Can't find pcapnav-config: disabling offset jump feature])
  460. fi ],
  461. [ AC_PATH_PROG(pcncfg,[pcapnav-config], [no] ) ]
  462. )
  463. if test $pcncfg != no ; then
  464. LNAVLIB=`$pcncfg --libs`
  465. LNAV_CFLAGS=`$pcncfg --cflags`
  466. PCAPNAV_VERSION=`$pcncfg --version`
  467. AC_SUBST(LNAVLIB)
  468. AC_SUBST(LNAV_CFLAGS)
  469. AC_DEFINE_UNQUOTED(PCAPNAV_VERSION, "$PCAPNAV_VERSION",
  470. [libpcapnav's version?])
  471. dnl Check to see what version of libpcapnav
  472. dnl this code has been reduced a lot, but probably still could be
  473. dnl reduced quite a bit more if we chose too
  474. AC_MSG_CHECKING(for libpcapnav version)
  475. AC_TRY_RUN([
  476. #include <string.h>
  477. #define PCAPNAV_TEST "0.4"
  478. /*
  479. * simple proggy to test the version of libpcapnav
  480. * returns zero if version >= 0.4
  481. * or one otherwise
  482. */
  483. int
  484. main (int argc, char *argv[])
  485. {
  486. if (strncmp(PCAPNAV_VERSION, PCAPNAV_TEST, 3) >= 0)
  487. exit(0);
  488. exit(1);
  489. }],
  490. libpcapnav_ver=yes
  491. AC_MSG_RESULT(>= 0.4),
  492. libpcapnav_ver=no
  493. AC_MSG_RESULT(< 0.4),
  494. libpcapnav_ver=no
  495. )
  496. if test x$libpcapnav_ver = xno ; then
  497. AC_MSG_WARN([Libpcapnav versions < 0.4 are not supported.
  498. Please upgrade to version 0.4 or better.
  499. Disabling offset jump feature.])
  500. else
  501. AC_DEFINE([HAVE_PCAPNAV], [], [Do we have libpcapnav?])
  502. fi
  503. fi # checking pcapnav version
  504. dnl #####################################################
  505. dnl Checks for libnids
  506. dnl #####################################################
  507. foundnids=no
  508. trynidsdir=/usr/local
  509. AC_MSG_CHECKING(for libnids)
  510. AC_ARG_WITH(libnids,
  511. AC_HELP_STRING([--with-libnids=DIR], [Use libnids in DIR]),
  512. [trynidsdir=$withval])
  513. for testdir in $trynidsdir /usr/local /usr ; do
  514. if test -f "${testdir}/include/nids.h" -a $foundnids = no ; then
  515. LNIDSINC="${testdir}/include/nids.h"
  516. LNIDSINCDIR="${testdir}/include"
  517. dnl Libnids by default doesn't build a dynamic library and due to a
  518. dnl bug, won't build one for OS X, so we link to the static
  519. dnl LNIDSLIB="${testdir}/lib -lnids"
  520. LNIDSLIB="${testdir}/lib/libnids.a"
  521. foundnids=$testdir
  522. fi
  523. done
  524. if test $foundnids = no ; then
  525. AC_MSG_RESULT(no)
  526. AC_MSG_WARN(libnids not found. We won't build flowreplay.)
  527. else
  528. AC_MSG_RESULT($foundnids)
  529. AC_DEFINE([HAVE_LIBNIDS], [], [Do we have libnids?])
  530. fi
  531. AC_SUBST(LNIDSINC)
  532. AC_SUBST(LNIDSLIB)
  533. AM_CONDITIONAL([HAVE_LIBNIDS], [ test ${foundnids} != no ])
  534. dnl (shamelessly ripped off from libpcap)
  535. dnl Checks to see if unaligned memory accesses fail
  536. dnl
  537. dnl FORCE_ALIGN (DEFINED)
  538. dnl
  539. AC_MSG_CHECKING(for requires strict byte alignment)
  540. AC_CACHE_VAL(unaligned_fail,
  541. [case "$host_cpu" in
  542. # XXX: should also check that they don't do weird things (like on arm)
  543. alpha*|arm*|hp*|mips*|sparc*|ia64)
  544. unaligned_fail=yes
  545. ;;
  546. *)
  547. cat >conftest.c <<EOF
  548. #include <sys/types.h>
  549. #include <sys/wait.h>
  550. #include <stdio.h>
  551. unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
  552. main() {
  553. unsigned int i;
  554. pid_t pid;
  555. int status;
  556. /* avoid "core dumped" message */
  557. pid = fork();
  558. if (pid < 0)
  559. exit(2);
  560. if (pid > 0) {
  561. /* parent */
  562. pid = waitpid(pid, &status, 0);
  563. if (pid < 0)
  564. exit(3);
  565. exit(!WIFEXITED(status));
  566. }
  567. /* child */
  568. i = *(unsigned int *)&a[[1]];
  569. printf("%d\n", i);
  570. exit(0);
  571. }
  572. EOF
  573. ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
  574. conftest.c $LIBS >/dev/null 2>&1
  575. if test ! -x conftest ; then
  576. dnl failed to compile for some reason
  577. unaligned_fail=yes
  578. else
  579. ./conftest >conftest.out
  580. if test ! -s conftest.out ; then
  581. unaligned_fail=yes
  582. else
  583. unaligned_fail=no
  584. fi
  585. fi
  586. rm -f conftest* core core.conftest
  587. ;;
  588. esac])
  589. AC_MSG_RESULT($unaligned_fail)
  590. if test $unaligned_fail = yes ; then
  591. AC_DEFINE([FORCE_ALIGN],1,[Are we strictly aligned?])
  592. fi
  593. dnl ##################################################
  594. dnl # Check for tcpdump.
  595. dnl ##################################################
  596. td=no
  597. AC_ARG_WITH(tcpdump,
  598. AC_HELP_STRING([--with-tcpdump=FILE], [Path to tcpdump binary]),
  599. [ if test -x $withval ; then
  600. td=$withval
  601. AC_MSG_RESULT([Using tcpdump in $td])
  602. else
  603. AC_MSG_RESULT([Error: $withval does not exist or is not executable])
  604. fi ],
  605. [ AC_PATH_PROG(td, tcpdump, "no", [$PATH:/usr/sbin:/sbin:/usr/local/sbin]) ])
  606. if test "$td" = "no"; then
  607. AC_MSG_WARN([Unable to find tcpdump. Please specify --with-tcpdump.
  608. Disabling verbose reporting.])
  609. else
  610. AC_DEFINE([HAVE_TCPDUMP], [], [Do we have tcpdump?])
  611. AC_DEFINE_UNQUOTED(TCPDUMP_BINARY, "$td", [The tcpdump binary initially used])
  612. fi
  613. dnl No 'make test' when cross compile
  614. AC_MSG_CHECKING( for 'make test' profile)
  615. if test "$host" != "$build" ; then
  616. AC_MSG_WARN(Unable to do tests when cross-compiling)
  617. fi
  618. dnl Allows user to choose which nic to use for testing purposes
  619. AC_ARG_WITH(testnic,
  620. AC_HELP_STRING([--with-testnic=NIC], [Select which network card to use for testing]),
  621. [ nic1=$withval
  622. nic2=$withval
  623. AC_MSG_RESULT([Using --with-testnic=$withval])],
  624. [
  625. dnl these need to be dynamic based on OS
  626. case $host in
  627. *-*-linux*)
  628. nic1=eth0
  629. nic2=eth0
  630. AC_MSG_RESULT(Linux)
  631. ;;
  632. *-*-solaris*)
  633. nic1=hme0
  634. nic2=hme0
  635. AC_MSG_RESULT(Solaris)
  636. ;;
  637. *-*-sunos*)
  638. nic1=hme0
  639. nic2=hme0
  640. AC_MSG_RESULT(SunOS)
  641. ;;
  642. powerpc-apple-darwin*)
  643. nic1=en0
  644. nic2=en0
  645. AC_MSG_RESULT(Apple OS X)
  646. ;;
  647. *-*-openbsd*)
  648. nic1=xl0
  649. nic2=xl0
  650. AC_MSG_RESULT(OpenBSD)
  651. ;;
  652. *)
  653. AC_MSG_RESULT([$host is unknown!
  654. Please use --with-nictest to select an interface for 'make test'])
  655. ;;
  656. esac])
  657. AC_ARG_WITH(testnic2,
  658. AC_HELP_STRING([--with-testnic2=NIC2], [Select an optional 2nd network card to use for testing]),
  659. [ nic2=$withval ])
  660. AC_MSG_NOTICE([Using $nic1 for 1st test network interface card])
  661. AC_MSG_NOTICE([Using $nic2 for 2nd test network interface card])
  662. AC_SUBST(nic1)
  663. AC_SUBST(nic2)
  664. LIBOPTS_CHECK
  665. AC_OUTPUT([Makefile
  666. doxygen.cfg
  667. lib/Makefile
  668. docs/Makefile
  669. src/Makefile
  670. src/common/Makefile
  671. src/tcpedit/Makefile
  672. src/flow/Makefile
  673. src/defines.h
  674. test/Makefile
  675. test/config
  676. scripts/Makefile
  677. tcpreplay.spec])
  678. if test $doctools = no; then
  679. AC_MSG_NOTICE([One or more tool for creating documentation is unavailable.])
  680. AC_MSG_NOTICE([This is only an issue for developers, so don't worry.])
  681. fi