You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

configure.ac 35KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243
  1. dnl Process this file with autoconf to produce a configure script.
  2. dnl configuration file for pmacct
  3. AC_INIT([pmacct], [1.7.0], [paolo@pmacct.net])
  4. AM_INIT_AUTOMAKE([foreign])
  5. AC_CONFIG_MACRO_DIR([m4])
  6. LT_INIT
  7. AC_PREFIX_DEFAULT([/usr/local])
  8. m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES(yes)])
  9. COMPILE_ARGS="${ac_configure_args}"
  10. dnl Checks for programs.
  11. AC_PROG_CC
  12. dnl pkg-config stuff
  13. PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/usr/local/lib/pkgconfig
  14. export PKG_CONFIG_PATH
  15. PKG_PROG_PKG_CONFIG
  16. AC_CANONICAL_HOST
  17. AC_MSG_CHECKING(OS)
  18. AC_MSG_RESULT($host_os)
  19. AC_MSG_CHECKING(hardware)
  20. AC_MSG_RESULT($host_cpu)
  21. dnl initial checks; tweakings to CFLAGS and LDFLAGS
  22. dnl see final checks for tweakings to LIBS
  23. if test "x$ac_cv_prog_gcc" = xyes ; then
  24. CFLAGS="-O2 ${CFLAGS}"
  25. fi
  26. dnl set debug level
  27. AC_MSG_CHECKING([whether to enable debugging compiler options])
  28. AC_ARG_ENABLE(debug,
  29. [ --enable-debug Enable debugging compiler options (default: no)],
  30. [
  31. if test x$enableval = x"yes" ; then
  32. AC_MSG_RESULT(yes)
  33. tmp_CFLAGS=`echo $CFLAGS | sed 's/O2/O0/g'`
  34. CFLAGS="$tmp_CFLAGS"
  35. CFLAGS="$CFLAGS -g -W -Wall"
  36. else
  37. AC_MSG_RESULT(no)
  38. fi
  39. ],
  40. [
  41. AC_MSG_RESULT(no)
  42. ]
  43. )
  44. dnl set relax level
  45. AC_MSG_CHECKING([whether to relax compiler optimizations])
  46. AC_ARG_ENABLE(relax,
  47. [ --enable-relax Relax compiler optimization (default: no)],
  48. [
  49. if test x$enableval = x"yes" ; then
  50. AC_MSG_RESULT(yes)
  51. tmp_CFLAGS=`echo $CFLAGS | sed 's/O2/O0/g'`
  52. CFLAGS="$tmp_CFLAGS"
  53. else
  54. AC_MSG_RESULT(no)
  55. fi
  56. ],
  57. [
  58. AC_MSG_RESULT(no)
  59. ]
  60. )
  61. dnl: shared object handling
  62. AC_MSG_CHECKING([whether to disable linking against shared objects])
  63. AC_ARG_ENABLE(so,
  64. [ --disable-so Disable linking against shared objects (default: no)],
  65. [
  66. if test x$enableval = x"yes" ; then
  67. AC_MSG_RESULT(no)
  68. AC_CHECK_FUNC(dlopen, [ USING_DLOPEN="yes" ], [])
  69. AC_CHECK_LIB(dl, dlopen,
  70. [ USING_DLOPEN="yes"
  71. LIBS="${LIBS} -ldl" ],
  72. [])
  73. if test x"$USING_DLOPEN" != x"yes"; then
  74. AC_MSG_ERROR(Unable to find dlopen(). Try with --disable-so)
  75. fi
  76. else
  77. AC_MSG_RESULT(yes)
  78. if test "x$ac_cv_prog_gcc" = xyes ; then
  79. LDFLAGS="-static ${LDFLAGS}"
  80. fi
  81. fi
  82. ],
  83. [
  84. AC_MSG_RESULT(no)
  85. AC_CHECK_FUNC(dlopen, [ USING_DLOPEN="yes" ], [])
  86. AC_CHECK_LIB(dl, dlopen,
  87. [ USING_DLOPEN="yes"
  88. LIBS="${LIBS} -ldl" ],
  89. [])
  90. if test x"$USING_DLOPEN" != x"yes"; then
  91. AC_MSG_ERROR(Unable to find dlopen(). Try with --disable-so)
  92. fi
  93. ]
  94. )
  95. dnl finish: shared object handling
  96. dnl os specific flags
  97. case "$host_os" in
  98. Sun*)
  99. AC_DEFINE(SOLARIS, 1)
  100. LIBS="-lresolv -lsocket -lnsl ${LIBS}"
  101. ;;
  102. *BSD)
  103. AC_DEFINE(BSD, 1)
  104. ;;
  105. linux*)
  106. AC_DEFINE(LINUX, 1)
  107. ;;
  108. esac
  109. dnl cpu specific flags
  110. case "$host_cpu" in
  111. sun*)
  112. AC_DEFINE(CPU_sparc, 1)
  113. ;;
  114. esac
  115. AC_CHECK_PROG(MAKE, gmake, gmake)
  116. if test x"$MAKE" = x""; then
  117. AC_CHECK_PROG(MAKE, make, make)
  118. fi
  119. AC_SUBST(MAKE)
  120. AC_PROG_MAKE_SET
  121. dnl
  122. dnl some systems have __progname ; if this is the case and we play around argv
  123. dnl we need to enable a minor hack to make things work nicely.
  124. dnl
  125. AC_MSG_CHECKING(for __progname)
  126. AC_TRY_LINK([ extern char *__progname; ],
  127. [ __progname = "test"; ],
  128. [AC_MSG_RESULT(yes); AC_DEFINE(PROGNAME, 1)], [AC_MSG_RESULT(no)])
  129. dnl
  130. dnl Some checks to understand whether we need to instruct the linker for
  131. dnl exporting collector symbols to dynamically loaded classifiers.
  132. dnl
  133. dnl OS'es with ELF executables using the GNU linker (Linux and recent *BSD,
  134. dnl in rare cases Solaris) typically need '-Wl,-export-dynamic'; some SYSv4
  135. dnl systems instead need '-Wl,-Bexport'; AIX 4.x wants -Wl,-bexpall,-brtl'.
  136. dnl
  137. AC_MSG_CHECKING(for extra flags needed to export symbols)
  138. if test "x$ac_cv_prog_gcc" = xyes ; then
  139. save_ldflags="${LDFLAGS}"
  140. LDFLAGS="-Wl,--export-dynamic ${save_ldflags}"
  141. AC_TRY_LINK(,,
  142. [ AC_MSG_RESULT(--export-dynamic) ],
  143. [ LDFLAGS="-Wl,-Bexport ${save_ldflags}"
  144. AC_TRY_LINK(,,
  145. [ AC_MSG_RESULT(-Bexport) ],
  146. [ AC_MSG_RESULT(none)
  147. LDFLAGS="${save_ldflags}" ]
  148. )
  149. ]
  150. )
  151. else
  152. AC_MSG_RESULT(none)
  153. fi
  154. dnl
  155. dnl some C compilers (ex. MipsPRO) don't know how to parse the 'inline' keyword
  156. dnl
  157. AC_MSG_CHECKING(for static inline)
  158. AC_TRY_COMPILE([#include <stdio.h>]
  159. static inline func()
  160. {
  161. }
  162. ,
  163. [
  164. func();
  165. ],
  166. [AC_MSG_RESULT(yes)], [AC_MSG_RESULT(no); AC_DEFINE(NOINLINE, 1)])
  167. dnl
  168. dnl Check for architecture endianess: big | little
  169. dnl
  170. dnl XXX: switch to manually define this feature
  171. ac_cv_endianess="unknown"
  172. if test x"$ac_cv_endianess" = x"unknown"; then
  173. AC_MSG_CHECKING(endianess)
  174. AC_TRY_RUN([main () {
  175. union
  176. {
  177. long l;
  178. char c[sizeof (long)];
  179. } u;
  180. u.l = 1;
  181. exit (u.c[sizeof (long) - 1] == 1);
  182. }], ac_cv_endianess="little", ac_cv_endianess="big", ac_cv_endianess="little")
  183. AC_MSG_RESULT($ac_cv_endianess)
  184. fi
  185. if test x"$ac_cv_endianess" = x"big"; then
  186. AC_DEFINE(IM_BIG_ENDIAN, 1)
  187. fi
  188. if test x"$ac_cv_endianess" = x"little"; then
  189. AC_DEFINE(IM_LITTLE_ENDIAN, 1)
  190. fi
  191. dnl
  192. dnl Check for unaligned memory access; based entirely over
  193. dnl AC_LBL_UNALIGNED_ACCESS
  194. dnl
  195. dnl XXX: switch to manually define this feature;
  196. ac_cv_unaligned="unknown"
  197. case "$host_cpu" in
  198. alpha*|arm*|hp*|mips*|sh*|sparc*|ia64|nv1)
  199. ac_cv_unaligned="fail"
  200. AC_MSG_CHECKING(unaligned accesses)
  201. AC_MSG_RESULT($ac_cv_unaligned)
  202. ;;
  203. esac
  204. if test x"$ac_cv_unaligned" = x"unknown"; then
  205. AC_MSG_CHECKING(unaligned accesses)
  206. cat > conftest.c << EOF
  207. #include <sys/types.h>
  208. #include <sys/wait.h>
  209. #include <stdio.h>
  210. unsigned char a[[5]] = { 1, 2, 3, 4, 5 };
  211. main () {
  212. unsigned int i;
  213. pid_t pid;
  214. int status;
  215. /* avoid "core dumped" message */
  216. pid = fork();
  217. if (pid < 0) exit(2);
  218. if (pid > 0) {
  219. /* parent */
  220. pid = waitpid(pid, &status, 0);
  221. if (pid < 0) exit(3);
  222. exit(!WIFEXITED(status));
  223. }
  224. /* child */
  225. i = *(unsigned int *)&a[[1]];
  226. printf("%d\n", i);
  227. exit(0);
  228. }
  229. EOF
  230. ${CC-cc} -o conftest $CFLAGS $CPPFLAGS $LDFLAGS \
  231. conftest.c $LIBS >/dev/null 2>&1
  232. if test ! -x conftest ; then
  233. ac_cv_unaligned="fail"
  234. else
  235. ./conftest >conftest.out
  236. if test ! -s conftest.out ; then ac_cv_unaligned="fail"
  237. else ac_cv_unaligned="ok"
  238. fi
  239. fi
  240. rm -f conftest* core core.conftest
  241. AC_MSG_RESULT($ac_cv_unaligned)
  242. fi
  243. if test x"$ac_cv_unaligned" = x"fail"; then
  244. AC_DEFINE(NEED_ALIGN, 1)
  245. fi
  246. AC_MSG_CHECKING([whether to enable L2 features])
  247. AC_ARG_ENABLE(l2,
  248. [ --enable-l2 Enable Layer-2 features and support (default: yes)],
  249. [
  250. if test x$enableval = x"yes" ; then
  251. AC_MSG_RESULT(yes)
  252. AC_DEFINE(HAVE_L2, 1)
  253. else
  254. AC_MSG_RESULT(no)
  255. fi
  256. ],
  257. [
  258. AC_MSG_RESULT(yes)
  259. AC_DEFINE(HAVE_L2, 1)
  260. COMPILE_ARGS="${COMPILE_ARGS} '--enable-l2'"
  261. ]
  262. )
  263. AC_MSG_CHECKING([whether to enable IPv6 code])
  264. AC_ARG_ENABLE(ipv6,
  265. [ --enable-ipv6 Enable IPv6 code (default: yes)],
  266. [
  267. if test x$enableval = x"yes" ; then
  268. AC_MSG_RESULT(yes)
  269. AC_CHECK_FUNCS(inet_pton)
  270. if test x"$ac_cv_func_inet_pton" = x"no"; then
  271. AC_MSG_ERROR(ERROR: missing inet_pton(); disable IPv6 hooks !)
  272. fi
  273. AC_CHECK_FUNCS(inet_ntop)
  274. if test x"$ac_cv_func_inet_ntop" = x"no"; then
  275. AC_MSG_ERROR(ERROR: missing inet_ntop(); disable IPv6 hooks !)
  276. fi
  277. AC_DEFINE(ENABLE_IPV6, 1)
  278. ipv6support="yes"
  279. else
  280. AC_MSG_RESULT(no)
  281. ipv6support="no"
  282. fi
  283. ],
  284. [
  285. AC_MSG_RESULT(yes)
  286. AC_CHECK_FUNCS(inet_pton)
  287. if test x"$ac_cv_func_inet_pton" = x"no"; then
  288. AC_MSG_ERROR(ERROR: missing inet_pton(); disable IPv6 hooks !)
  289. fi
  290. AC_CHECK_FUNCS(inet_ntop)
  291. if test x"$ac_cv_func_inet_ntop" = x"no"; then
  292. AC_MSG_ERROR(ERROR: missing inet_ntop(); disable IPv6 hooks !)
  293. fi
  294. AC_DEFINE(ENABLE_IPV6, 1)
  295. ipv6support="yes"
  296. COMPILE_ARGS="${COMPILE_ARGS} '--enable-ipv6'"
  297. ]
  298. )
  299. AC_MSG_CHECKING([whether to enable IP prefix labels])
  300. AC_ARG_ENABLE(plabel,
  301. [ --enable-plabel Enable IP prefix labels (default: no)],
  302. [
  303. if test x$enableval = x"yes" ; then
  304. AC_MSG_RESULT(yes)
  305. AC_DEFINE(ENABLE_PLABEL, 1)
  306. else
  307. AC_MSG_RESULT(no)
  308. fi
  309. ],
  310. [
  311. AC_MSG_RESULT(no)
  312. ])
  313. AC_ARG_WITH(pcap-includes,
  314. [ --with-pcap-includes=DIR Search the specified directory for header files],
  315. [
  316. AC_LINEARIZE_PATH($withval, withval=$absdir)
  317. INCLUDES="${INCLUDES} -I$withval"
  318. PCAPINCLS=$withval
  319. PCAPINCLUDESFOUND=1
  320. ])
  321. if test x"$PCAPINCLS" != x""; then
  322. AC_MSG_CHECKING(your own pcap includes)
  323. if test -r $PCAPINCLS/pcap.h; then
  324. AC_MSG_RESULT(ok)
  325. AC_DEFINE(HAVE_PCAP_H, 1)
  326. else
  327. AC_MSG_RESULT(no)
  328. AC_MSG_ERROR(ERROR: missing pcap.h in $PCAPINCLS)
  329. fi
  330. fi
  331. if test x"$PCAPINCLUDESFOUND" = x""; then
  332. AC_MSG_CHECKING([default locations for pcap.h])
  333. if test -r /usr/include/pcap.h; then
  334. AC_MSG_RESULT([found in /usr/include])
  335. PCAPINCLUDESFOUND=1
  336. AC_DEFINE(HAVE_PCAP_H, 1)
  337. elif test -r /usr/include/pcap/pcap.h; then
  338. AC_MSG_RESULT([found in /usr/include])
  339. PCAPINCLUDESFOUND=1
  340. AC_DEFINE(HAVE_PCAP_PCAP_H, 1)
  341. elif test -r /usr/local/include/pcap.h; then
  342. AC_MSG_RESULT([found in /usr/local/include])
  343. INCLUDES="${INCLUDES} -I/usr/local/include"
  344. PCAPINCLUDESFOUND=1
  345. AC_DEFINE(HAVE_PCAP_H, 1)
  346. elif test -r /usr/local/include/pcap/pcap.h; then
  347. AC_MSG_RESULT([found in /usr/local/include])
  348. INCLUDES="${INCLUDES} -I/usr/local/include"
  349. PCAPINCLUDESFOUND=1
  350. AC_DEFINE(HAVE_PCAP_PCAP_H, 1)
  351. fi
  352. if test x"$PCAPINCLUDESFOUND" = x""; then
  353. AC_MSG_RESULT([not found])
  354. AC_MSG_ERROR(ERROR: missing pcap.h)
  355. fi
  356. fi
  357. AC_ARG_WITH(pcap-libs,
  358. [ --with-pcap-libs=DIR Search the specified directory for pcap library],
  359. [
  360. AC_LINEARIZE_PATH($withval, withval=$absdir)
  361. LIBS="${LIBS} -L$withval"
  362. PCAPLIB=$withval
  363. PCAPLIBFOUND=1
  364. ])
  365. if test x"$PCAPLIB" != x""; then
  366. AC_MSG_CHECKING(your own pcap libraries)
  367. if test -r $PCAPLIB/libpcap.a -o -r $PCAPLIB/libpcap.so; then
  368. AC_MSG_RESULT(ok)
  369. PCAP_LIB_FOUND=1
  370. AC_MSG_CHECKING(for PF_RING library)
  371. if test -r $PCAPLIB/libpfring.a -o -r $PCAPLIB/libpfring.so; then
  372. LIBS="${LIBS} -lpfring -lpcap"
  373. AC_MSG_RESULT(yes)
  374. PFRING_LIB_FOUND=1
  375. AC_DEFINE(PFRING_LIB_FOUND, 1)
  376. else
  377. AC_MSG_RESULT(no)
  378. fi
  379. else
  380. AC_MSG_RESULT(no)
  381. AC_MSG_ERROR(ERROR: unable to find pcap library in $PCAPLIB)
  382. fi
  383. fi
  384. if test x"$PCAPLIBFOUND" = x""; then
  385. AC_MSG_CHECKING([default locations for libpcap])
  386. if test -r /usr/local/lib/libpcap.a -o -r /usr/local/lib/libpcap.so; then
  387. LIBS="${LIBS} -L/usr/local/lib"
  388. AC_MSG_RESULT([found in /usr/local/lib])
  389. PCAPLIBFOUND=1
  390. AC_MSG_CHECKING(for PF_RING library)
  391. if test -r /usr/local/lib/libpfring.a -o -r /usr/local/lib/libpfring.so; then
  392. LIBS="${LIBS} -lpfring -lpcap"
  393. AC_MSG_RESULT(yes)
  394. PFRING_LIB_FOUND=1
  395. AC_DEFINE(PFRING_LIB_FOUND, 1)
  396. else
  397. AC_MSG_RESULT(no)
  398. fi
  399. else
  400. AC_MSG_RESULT(no)
  401. fi
  402. fi
  403. dnl Checks for libraries.
  404. dnl libpcap is checked only if PF_RING is not found
  405. if test x"$PFRING_LIB_FOUND" = x""; then
  406. AC_CHECK_LIB([pcap], [pcap_dispatch], [], [AC_MSG_ERROR([
  407. ERROR: missing pcap library. Refer to: http://www.tcpdump.org/
  408. ])])
  409. AC_CHECK_LIB([pcap], [pcap_set_protocol], [ AC_DEFINE(PCAP_SET_PROTOCOL, 1) ], [])
  410. AC_CHECK_LIB([pcap], [bpf_filter], [ AC_DEFINE(PCAP_NOBPF, 1) ], [])
  411. else
  412. dnl Unable to test: we should check for these libs
  413. #AC_CHECK_LIB([numa], [numa_bind], [], [AC_MSG_ERROR([
  414. # ERROR: missing libnuma devel. Requirement for building PF_RING.
  415. #])])
  416. #AC_CHECK_LIB([rt], [clock_gettime], [], [AC_MSG_ERROR([
  417. # ERROR: missing librt devel. Requirement for building PF_RING.
  418. #])])
  419. LIBS="${LIBS} -lrt -lnuma"
  420. fi
  421. dnl packet capture type check; taken from libpcap.
  422. AC_MSG_CHECKING(packet capture type)
  423. if test -r /dev/bpf0 ; then
  424. V_PCAP=bpf
  425. elif test -r /usr/include/net/pfilt.h ; then
  426. V_PCAP=pf
  427. elif test -r /dev/enet ; then
  428. V_PCAP=enet
  429. elif test -r /dev/nit ; then
  430. V_PCAP=snit
  431. elif test -r /usr/include/sys/net/nit.h ; then
  432. V_PCAP=nit
  433. elif test -r /usr/include/linux/socket.h ; then
  434. V_PCAP=linux
  435. elif test -r /usr/include/net/raw.h ; then
  436. V_PCAP=snoop
  437. elif test -r /usr/include/odmi.h ; then
  438. #
  439. # On AIX, the BPF devices might not yet be present - they're
  440. # created the first time libpcap runs after booting.
  441. # We check for odmi.h instead.
  442. #
  443. V_PCAP=bpf
  444. elif test -r /usr/include/sys/dlpi.h ; then
  445. V_PCAP=dlpi
  446. elif test -c /dev/bpf0 ; then # check again in case not readable
  447. V_PCAP=bpf
  448. elif test -c /dev/enet ; then # check again in case not readable
  449. V_PCAP=enet
  450. elif test -c /dev/nit ; then # check again in case not readable
  451. V_PCAP=snit
  452. else
  453. V_PCAP=null
  454. fi
  455. AC_MSG_RESULT($V_PCAP)
  456. AC_DEFINE_UNQUOTED(PCAP_TYPE_$V_PCAP, 1)
  457. dnl start: mysql handling
  458. AC_MSG_CHECKING(whether to enable MySQL support)
  459. AC_ARG_ENABLE(mysql,
  460. [ --enable-mysql Enable MySQL support (default: no)],
  461. [ case "$enableval" in
  462. yes)
  463. AC_MSG_RESULT(yes)
  464. dnl Unfortunately, no pkg-config support for MySQL
  465. AC_CHECK_PROG([MYSQL_CONFIG], [mysql_config], [mysql_config], [no])
  466. if test "x${MYSQL_CONFIG}" = "xno"; then
  467. AC_MSG_ERROR([ERROR: missing mysql_config program])
  468. fi
  469. AC_CHECK_LIB([mysqlclient], [mysql_init],
  470. [MYSQL_CFLAGS=`$MYSQL_CONFIG --cflags`
  471. MYSQL_LIBS=`$MYSQL_CONFIG --libs`],
  472. [AC_MSG_ERROR([ERROR: missing MySQL client library])],
  473. [`$MYSQL_CONFIG --libs`])
  474. dnl version check not enforced with a AC_MSG_ERROR for now
  475. AX_LIB_MYSQL(5.6.3)
  476. AC_SUBST(MYSQL_CFLAGS)
  477. AC_SUBST(MYSQL_LIBS)
  478. PLUGINS="${PLUGINS} mysql"
  479. USING_SQL="yes"
  480. USING_MYSQL="yes"
  481. PMACCT_CFLAGS="$PMACCT_CFLAGS $MYSQL_CFLAGS"
  482. AC_DEFINE(WITH_MYSQL, 1)
  483. ;;
  484. no)
  485. AC_MSG_RESULT(no)
  486. ;;
  487. esac ],
  488. [
  489. AC_MSG_RESULT(no)
  490. ]
  491. )
  492. dnl finish: mysql handling
  493. dnl start: pgsql handling
  494. AC_MSG_CHECKING(whether to enable PostgreSQL support)
  495. AC_ARG_ENABLE(pgsql,
  496. [ --enable-pgsql Enable PostgreSQL support (default: no)],
  497. [ case "$enableval" in
  498. yes)
  499. AC_MSG_RESULT(yes)
  500. PKG_CHECK_MODULES([PGSQL], [libpq],, [
  501. AC_MSG_CHECKING([default locations for libpq])
  502. if test -r /usr/lib/libpq.a -o -r /usr/lib/libpq.so; then
  503. PGSQL_LIBS="-L/usr/lib -lpq"
  504. AC_MSG_RESULT([found in /usr/lib])
  505. elif test -r /usr/lib64/libpq.a -o -r /usr/lib64/libpq.so; then
  506. PGSQL_LIBS="-L/usr/lib64 -lpq"
  507. AC_MSG_RESULT([found in /usr/lib64])
  508. elif test -r /usr/local/lib/libpq.a -o -r /usr/local/lib/libpq.so; then
  509. PGSQL_LIBS="-L/usr/local/lib -lpq"
  510. AC_MSG_RESULT([found in /usr/local/lib])
  511. elif test -r /usr/local/pgsql/lib/libpq.a -o -r /usr/local/pgsql/lib/libpq.so; then
  512. PGSQL_LIBS="-L/usr/local/pgsql/lib -lpq"
  513. AC_MSG_RESULT([found in /usr/local/pgsql/lib])
  514. else
  515. AC_MSG_RESULT([not found])
  516. _save_LIBS="$LIBS"
  517. LIBS="$LIBS $PGSQL_LIBS"
  518. AC_CHECK_LIB([pq], [PQconnectdb], [], [AC_MSG_ERROR([ERROR: missing PQ library. Refer to: http://www.postgresql.org/])])
  519. LIBS="$_save_LIBS"
  520. fi
  521. AC_MSG_CHECKING([default locations for libpq-fe.h])
  522. if test -r /usr/include/libpq-fe.h; then
  523. PGSQL_CFLAGS="-I/usr/include"
  524. AC_MSG_RESULT([found in /usr/include])
  525. elif test -r /usr/include/postgresql/libpq-fe.h; then
  526. PGSQL_CFLAGS="-I/usr/include/postgresql"
  527. AC_MSG_RESULT([found in /usr/include/postgresql])
  528. elif test -r /usr/local/include/libpq-fe.h; then
  529. PGSQL_CFLAGS="-I/usr/local/include"
  530. AC_MSG_RESULT([found in /usr/local/include])
  531. elif test -r /usr/local/pgsql/include/libpq-fe.h; then
  532. PGSQL_CFLAGS="-I/usr/local/pgsql/include"
  533. AC_MSG_RESULT([found in /usr/local/pgsql/include])
  534. else
  535. AC_MSG_RESULT([not found])
  536. _save_CFLAGS="$CFLAGS"
  537. CFLAGS="$CFLAGS $PGSQL_CFLAGS"
  538. AC_CHECK_HEADER([libpq-fe.h], [], [AC_MSG_ERROR(ERROR: missing PostgreSQL headers)])
  539. CFLAGS="$_save_CFLAGS"
  540. fi
  541. ])
  542. PLUGINS="${PLUGINS} pgsql"
  543. USING_SQL="yes"
  544. USING_PGSQL="yes"
  545. PMACCT_CFLAGS="$PMACCT_CFLAGS $PGSQL_CFLAGS"
  546. AC_DEFINE(WITH_PGSQL, 1)
  547. ;;
  548. no)
  549. AC_MSG_RESULT(no)
  550. ;;
  551. esac ],
  552. [
  553. AC_MSG_RESULT(no)
  554. ]
  555. )
  556. dnl finish: pgsql handling
  557. dnl start: mongodb handling
  558. AC_MSG_CHECKING(whether to enable MongoDB support)
  559. AC_ARG_ENABLE(mongodb,
  560. [ --enable-mongodb Enable MongoDB support (default: no)],
  561. [ case "$enableval" in
  562. yes)
  563. AC_MSG_RESULT(yes)
  564. PKG_CHECK_MODULES([MONGODB], [libmongoc],, [
  565. AC_MSG_CHECKING([default locations for libmongoc])
  566. if test -r /usr/lib/libmongoc.a -o -r /usr/lib/libmongoc.so; then
  567. MONGODB_LIBS="-L/usr/lib -lmongoc"
  568. AC_MSG_RESULT([found in /usr/lib])
  569. elif test -r /usr/lib64/libmongoc.a -o -r /usr/lib64/libmongoc.so; then
  570. MONGODB_LIBS="-L/usr/lib64 -lmongoc"
  571. AC_MSG_RESULT([found in /usr/lib64])
  572. elif test -r /usr/local/lib/libmongoc.a -o -r /usr/local/lib/libmongoc.so; then
  573. MONGODB_LIBS="-L/usr/local/lib -lmongoc"
  574. AC_MSG_RESULT([found in /usr/local/lib])
  575. else
  576. AC_MSG_RESULT([not found])
  577. _save_LIBS="$LIBS"
  578. LIBS="$LIBS $MONGODB_LIBS"
  579. AC_CHECK_LIB([mongoc], [mongo_connect], [], [AC_MSG_ERROR([
  580. ERROR: missing MongoDB library (0.8 version). Refer to: https://github.com/mongodb/mongo-c-driver-legacy
  581. ])])
  582. LIBS="$_save_LIBS"
  583. fi
  584. AC_MSG_CHECKING([default locations for mongo.h])
  585. if test -r /usr/include/mongo.h; then
  586. MONGODB_CFLAGS="-I/usr/include"
  587. AC_MSG_RESULT([found in /usr/include])
  588. elif test -r /usr/local/include/mongo.h; then
  589. MONGODB_CFLAGS="-I/usr/local/include"
  590. AC_MSG_RESULT([found in /usr/local/include])
  591. else
  592. AC_MSG_RESULT([not found])
  593. _save_CFLAGS="$CFLAGS"
  594. CFLAGS="$CFLAGS $MONGODB_CFLAGS"
  595. AC_CHECK_HEADER([mongo.h], [], [AC_MSG_ERROR(ERROR: missing MongoDB headers)])
  596. CFLAGS="$_save_CFLAGS"
  597. fi
  598. ])
  599. PLUGINS="${PLUGINS} mongodb"
  600. USING_MONGODB="yes"
  601. PMACCT_CFLAGS="$PMACCT_CFLAGS $MONGODB_CFLAGS"
  602. AC_DEFINE(WITH_MONGODB, 1)
  603. ;;
  604. no)
  605. AC_MSG_RESULT(no)
  606. ;;
  607. esac ],
  608. [
  609. AC_MSG_RESULT(no)
  610. ]
  611. )
  612. dnl finish: mongodb handling
  613. dnl start: sqlite3 handling
  614. AC_MSG_CHECKING(whether to enable SQLite3 support)
  615. AC_ARG_ENABLE(sqlite3,
  616. [ --enable-sqlite3 Enable SQLite3 support (default: no)],
  617. [ case "$enableval" in
  618. yes)
  619. AC_MSG_RESULT(yes)
  620. dnl reasonably old libsqlite3 already support pkg-config
  621. PKG_CHECK_MODULES([SQLITE3], [sqlite3])
  622. PLUGINS="${PLUGINS} sqlite3"
  623. USING_SQL="yes"
  624. USING_SQLITE3="yes"
  625. PMACCT_CFLAGS="$PMACCT_CFLAGS $SQLITE3_CFLAGS"
  626. AC_DEFINE(WITH_SQLITE3, 1)
  627. ;;
  628. no)
  629. AC_MSG_RESULT(no)
  630. ;;
  631. esac ],
  632. [
  633. AC_MSG_RESULT(no)
  634. ]
  635. )
  636. dnl finish: sqlite3 handling
  637. dnl start: RabbitMQ/AMQP handling
  638. AC_MSG_CHECKING(whether to enable RabbitMQ/AMQP support)
  639. AC_ARG_ENABLE(rabbitmq,
  640. [ --enable-rabbitmq Enable RabbitMQ/AMQP support (default: no)],
  641. [ case "$enableval" in
  642. yes)
  643. AC_MSG_RESULT(yes)
  644. dnl reasonably old librabbitmq already support pkg-config
  645. PKG_CHECK_MODULES([RABBITMQ], [librabbitmq >= 0.8.0])
  646. PLUGINS="${PLUGINS} rabbitmq"
  647. USING_RABBITMQ="yes"
  648. PMACCT_CFLAGS="$PMACCT_CFLAGS $RABBITMQ_CFLAGS"
  649. AC_DEFINE(WITH_RABBITMQ, 1)
  650. ;;
  651. no)
  652. AC_MSG_RESULT(no)
  653. ;;
  654. esac ],
  655. [
  656. AC_MSG_RESULT(no)
  657. ]
  658. )
  659. dnl finish: RabbitMQ/AMQP handling
  660. dnl start: ZMQ/AMQP handling
  661. AC_MSG_CHECKING(whether to enable ZMQ/AMQP support)
  662. AC_ARG_ENABLE(zmq,
  663. [ --enable-zmq Enable ZMQ/AMQP support (default: no)],
  664. [ case "$enableval" in
  665. yes)
  666. AC_MSG_RESULT(yes)
  667. PKG_CHECK_MODULES([ZMQ], [libzmq >= 4.2.0])
  668. SUPPORTS="${SUPPORTS} zmq"
  669. USING_ZMQ="yes"
  670. PMACCT_CFLAGS="$PMACCT_CFLAGS $ZMQ_CFLAGS"
  671. AC_DEFINE(WITH_ZMQ, 1)
  672. ;;
  673. no)
  674. AC_MSG_RESULT(no)
  675. ;;
  676. esac ],
  677. [
  678. AC_MSG_RESULT(no)
  679. ]
  680. )
  681. dnl finish: ZMQ/AMQP handling
  682. dnl start: Kafka handling
  683. AC_MSG_CHECKING(whether to enable Kafka support)
  684. AC_ARG_ENABLE(kafka,
  685. [ --enable-kafka Enable Kafka support (default: no)],
  686. [ case "$enableval" in
  687. yes)
  688. AC_MSG_RESULT(yes)
  689. PKG_CHECK_MODULES([KAFKA], [rdkafka >= 0.9.2],, [
  690. AC_MSG_CHECKING([default locations for librdkafka])
  691. if test -r /usr/lib/librdkafka.a -o -r /usr/lib/librdkafka.so; then
  692. KAFKA_LIBS="-L/usr/lib -lrdkafka"
  693. AC_MSG_RESULT([found in /usr/lib])
  694. elif test -r /usr/lib64/librdkafka.a -o -r /usr/lib64/librdkafka.so; then
  695. KAFKA_LIBS="-L/usr/lib64 -lrdkafka"
  696. AC_MSG_RESULT([found in /usr/lib64])
  697. elif test -r /usr/local/lib/librdkafka.a -o -r /usr/local/lib/librdkafka.so; then
  698. KAFKA_LIBS="-L/usr/local/lib -lrdkafka"
  699. AC_MSG_RESULT([found in /usr/local/lib])
  700. else
  701. AC_MSG_RESULT([not found])
  702. _save_LIBS="$LIBS"
  703. LIBS="$LIBS $KAFKA_LIBS"
  704. AC_CHECK_LIB([rdkafka], [rd_kafka_new], [], [AC_MSG_ERROR([
  705. ERROR: missing Kafka library. Refer to: https://github.com/edenhill/librdkafka/
  706. ])])
  707. LIBS="$_save_LIBS"
  708. fi
  709. AC_MSG_CHECKING([default locations for rdkafka.h])
  710. if test -r /usr/include/librdkafka/rdkafka.h; then
  711. KAFKA_CFLAGS="-I/usr/include"
  712. AC_MSG_RESULT([found in /usr/include])
  713. elif test -r /usr/local/include/librdkafka/rdkafka.h; then
  714. KAFKA_CFLAGS="-I/usr/local/include"
  715. AC_MSG_RESULT([found in /usr/local/include])
  716. else
  717. AC_MSG_RESULT([not found])
  718. _save_CFLAGS="$CFLAGS"
  719. CFLAGS="$CFLAGS $KAFKA_CFLAGS"
  720. AC_CHECK_HEADER([rdkafka.h], [], [AC_MSG_ERROR(ERROR: missing Kafka headers)])
  721. CFLAGS="$_save_CFLAGS"
  722. fi
  723. ])
  724. PLUGINS="${PLUGINS} kafka"
  725. USING_KAFKA="yes"
  726. PMACCT_CFLAGS="$PMACCT_CFLAGS $KAFKA_CFLAGS"
  727. AC_DEFINE(WITH_KAFKA, 1)
  728. ;;
  729. no)
  730. AC_MSG_RESULT(no)
  731. ;;
  732. esac ],
  733. [
  734. AC_MSG_RESULT(no)
  735. ]
  736. )
  737. dnl finish: Kafka handling
  738. dnl start: geoip handling
  739. AC_MSG_CHECKING(whether to enable GeoIP support)
  740. AC_ARG_ENABLE(geoip,
  741. [ --enable-geoip Enable GeoIP support (default: no)],
  742. [ case "$enableval" in
  743. yes)
  744. AC_MSG_RESULT(yes)
  745. dnl reasonably old Maxmind GeoIP v1 already support pkg-config
  746. PKG_CHECK_MODULES([GEOIP], [geoip >= 1.0.0])
  747. SUPPORTS="${SUPPORTS} geoip"
  748. USING_MMGEOIP="yes"
  749. PMACCT_CFLAGS="$PMACCT_CFLAGS $GEOIP_CFLAGS"
  750. AC_DEFINE(WITH_GEOIP, 1)
  751. ;;
  752. no)
  753. AC_MSG_RESULT(no)
  754. ;;
  755. esac ],
  756. [
  757. AC_MSG_RESULT(no)
  758. ]
  759. )
  760. AC_MSG_CHECKING(whether to enable GeoIPv2 (libmaxminddb) support)
  761. AC_ARG_ENABLE(geoipv2,
  762. [ --enable-geoipv2 Enable GeoIPv2 (libmaxminddb) support (default: no)],
  763. [ case "$enableval" in
  764. yes)
  765. AC_MSG_RESULT(yes)
  766. PKG_CHECK_MODULES([GEOIPV2], [libmaxminddb >= 1.2.0],, [
  767. AC_MSG_CHECKING([default locations for libmaxminddb])
  768. if test -r /usr/lib/libmaxminddb.a -o -r /usr/lib/libmaxminddb.so; then
  769. GEOIPV2_LIBS="-L/usr/lib -lmaxminddb"
  770. AC_MSG_RESULT([found in /usr/lib])
  771. elif test -r /usr/lib64/libmaxminddb.a -o -r /usr/lib64/libmaxminddb.so; then
  772. GEOIPV2_LIBS="-L/usr/lib64 -lmaxminddb"
  773. AC_MSG_RESULT([found in /usr/lib64])
  774. elif test -r /usr/local/lib/libmaxminddb.a -o -r /usr/local/lib/libmaxminddb.so; then
  775. GEOIPV2_LIBS="-L/usr/local/lib -lmaxminddb"
  776. AC_MSG_RESULT([found in /usr/local/lib])
  777. else
  778. AC_MSG_RESULT([not found])
  779. _save_LIBS="$LIBS"
  780. LIBS="$LIBS $GEOIPV2_LIBS"
  781. AC_CHECK_LIB([maxminddb], [MMDB_open], [], [AC_MSG_ERROR([
  782. ERROR: missing Maxmind libmaxminddb library. Refer to: http://www.maxmind.com/download/geoip/api/c/
  783. ])])
  784. LIBS="$_save_LIBS"
  785. fi
  786. AC_MSG_CHECKING([default locations for maxminddb.h])
  787. if test -r /usr/include/maxminddb.h; then
  788. GEOIPV2_CFLAGS="-I/usr/include"
  789. AC_MSG_RESULT([found in /usr/include])
  790. elif test -r /usr/local/include/maxminddb.h; then
  791. GEOIPV2_CFLAGS="-I/usr/local/include"
  792. AC_MSG_RESULT([found in /usr/local/include])
  793. else
  794. AC_MSG_RESULT([not found])
  795. _save_CFLAGS="$CFLAGS"
  796. CFLAGS="$CFLAGS $GEOIPV2_CFLAGS"
  797. AC_CHECK_HEADER([maxminddb.h], [], [AC_MSG_ERROR(ERROR: missing Maxmind libmaxminddb headers)])
  798. CFLAGS="$_save_CFLAGS"
  799. fi
  800. ])
  801. SUPPORTS="${SUPPORTS} geoipv2"
  802. USING_MMGEOIPV2="yes"
  803. PMACCT_CFLAGS="$PMACCT_CFLAGS $GEOIPV2_CFLAGS"
  804. AC_DEFINE(WITH_GEOIPV2, 1)
  805. ;;
  806. no)
  807. AC_MSG_RESULT(no)
  808. ;;
  809. esac ],
  810. [
  811. AC_MSG_RESULT(no)
  812. ]
  813. )
  814. dnl finish: GeoIP handling
  815. dnl start: Jansson handling
  816. AC_MSG_CHECKING(whether to enable Jansson support)
  817. AC_ARG_ENABLE(jansson,
  818. [ --enable-jansson Enable Jansson support (default: no)],
  819. [ case "$enableval" in
  820. yes)
  821. AC_MSG_RESULT(yes)
  822. dnl reasonably old Jansson already support pkg-config
  823. PKG_CHECK_MODULES([JANSSON], [jansson >= 2.5])
  824. SUPPORTS="${SUPPORTS} jansson"
  825. USING_JANSSON="yes"
  826. PMACCT_CFLAGS="$PMACCT_CFLAGS $JANSSON_CFLAGS"
  827. AC_DEFINE(WITH_JANSSON, 1)
  828. _save_LIBS="$LIBS"
  829. LIBS="$LIBS $JANSSON_LIBS"
  830. AC_CHECK_LIB(jansson, json_object, [], [])
  831. AC_CHECK_FUNCS([json_object_update_missing])
  832. LIBS="$_save_LIBS"
  833. ;;
  834. no)
  835. AC_MSG_RESULT(no)
  836. ;;
  837. esac ],
  838. [
  839. AC_MSG_RESULT(no)
  840. ]
  841. )
  842. dnl finish: Jansson handling
  843. dnl start: Avro handling
  844. AC_MSG_CHECKING(whether to enable Avro support)
  845. AC_ARG_ENABLE(avro,
  846. [ --enable-avro Enable Apache Avro support (default: no)],
  847. [ case "$enableval" in
  848. yes)
  849. AC_MSG_RESULT(yes)
  850. PKG_CHECK_MODULES([AVRO], [avro-c >= 1.8])
  851. SUPPORTS="${SUPPORTS} avro"
  852. USING_AVRO="yes"
  853. PMACCT_CFLAGS="$PMACCT_CFLAGS $AVRO_CFLAGS"
  854. AC_DEFINE(WITH_AVRO, 1)
  855. _save_LIBS="$LIBS"
  856. LIBS="$LIBS $AVRO_LIBS"
  857. AC_CHECK_LIB(avro, avro_record_get, [], [])
  858. LIBS="$_save_LIBS"
  859. ;;
  860. no)
  861. AC_MSG_RESULT(no)
  862. ;;
  863. esac ],
  864. [
  865. AC_MSG_RESULT(no)
  866. ]
  867. )
  868. dnl finish: Avro handling
  869. dnl start: nDPI handling
  870. AC_ARG_WITH(ndpi-static-lib,
  871. [ --with-ndpi-static-lib=DIR Search the specified directory for nDPI static library],
  872. [
  873. AC_LINEARIZE_PATH($withval, withval=$absdir)
  874. NDPI_CUST_STATIC_LIB=$withval
  875. ])
  876. if test x"$NDPI_CUST_STATIC_LIB" != x""; then
  877. AC_MSG_CHECKING(your own nDPI library)
  878. if test -r $NDPI_CUST_STATIC_LIB/libndpi.a; then
  879. AC_MSG_RESULT(ok)
  880. NDPI_CUST_STATIC_LIB_FOUND="yes"
  881. else
  882. AC_MSG_RESULT(no)
  883. AC_MSG_ERROR(ERROR: unable to find nDPI library in $NDPI_CUST_STATIC_LIB)
  884. fi
  885. fi
  886. AC_MSG_CHECKING(whether to enable nDPI support)
  887. AC_ARG_ENABLE(ndpi,
  888. [ --enable-ndpi Enable nDPI support (default: no)],
  889. [ case "$enableval" in
  890. yes)
  891. AC_MSG_RESULT(yes)
  892. PKG_CHECK_MODULES([NDPI], [libndpi >= 2.0])
  893. SUPPORTS="${SUPPORTS} ndpi"
  894. USING_NDPI="yes"
  895. if test x"$NDPI_CFLAGS" != x""; then
  896. NDPI_CFLAGS_INST=`echo $NDPI_CFLAGS | sed 's/ $//'`
  897. NDPI_CFLAGS_INST="$NDPI_CFLAGS_INST/libndpi"
  898. else
  899. NDPI_CFLAGS_INST=""
  900. fi
  901. PMACCT_CFLAGS="$PMACCT_CFLAGS $NDPI_CFLAGS $NDPI_CFLAGS_INST"
  902. AC_DEFINE(WITH_NDPI, 1)
  903. _save_LIBS="$LIBS"
  904. LIBS="$LIBS $NDPI_LIBS"
  905. AC_CHECK_LIB(ndpi, ndpi_init_detection_module, [], [])
  906. LIBS="$_save_LIBS"
  907. dnl XXX: to be improved: avoid linking both static and dynamic libs
  908. if test x"$NDPI_CUST_STATIC_LIB_FOUND" = x"yes"; then
  909. NDPI_LIBS_STATIC="$NDPI_CUST_STATIC_LIB/libndpi.a"
  910. elif test -r /usr/lib/libndpi.a; then
  911. NDPI_LIBS_STATIC="/usr/lib/libndpi.a"
  912. elif test -r /usr/local/lib/libndpi.a; then
  913. NDPI_LIBS_STATIC="/usr/local/lib/libndpi.a"
  914. elif test -r /usr/local/nDPI/lib/libndpi.a; then
  915. NDPI_LIBS_STATIC="/usr/local/nDPI/lib/libndpi.a"
  916. else
  917. AC_MSG_ERROR([ERROR: missing nDPI static library])
  918. fi
  919. AC_SUBST([NDPI_LIBS_STATIC])
  920. ;;
  921. no)
  922. AC_MSG_RESULT(no)
  923. ;;
  924. esac ],
  925. [
  926. AC_MSG_RESULT(no)
  927. ]
  928. )
  929. dnl finish: nDPI handling
  930. if test x"$USING_DLOPEN" = x"yes"; then
  931. AC_DEFINE(HAVE_DLOPEN, 1)
  932. else
  933. # Adding linking to libdl here 1) if required and 2) in case of --disable-so
  934. if test x"$USING_MYSQL" = x"yes" -o x"$USING_SQLITE3" = x"yes"; then
  935. AC_CHECK_LIB([dl], [dlopen], [LIBS="${LIBS} -ldl"], [AC_MSG_ERROR([
  936. ERROR: missing libdl devel.
  937. ])])
  938. fi
  939. fi
  940. AC_CHECK_LIB([z], [deflate], [
  941. LIBS="${LIBS} -lz"
  942. AC_DEFINE(HAVE_ZLIB, 1)]
  943. )
  944. dnl Checks for header files.
  945. AC_HEADER_STDC
  946. AC_HEADER_SYS_WAIT
  947. AC_CHECK_HEADERS([getopt.h sys/select.h sys/time.h])
  948. dnl Checks for typedefs, structures, and compiler characteristics.
  949. AC_CHECK_TYPE(u_int64_t, [AC_DEFINE(HAVE_U_INT64_T, 1)])
  950. AC_CHECK_TYPE(u_int32_t, [AC_DEFINE(HAVE_U_INT32_T, 1)])
  951. AC_CHECK_TYPE(u_int16_t, [AC_DEFINE(HAVE_U_INT16_T, 1)])
  952. AC_CHECK_TYPE(u_int8_t, [AC_DEFINE(HAVE_U_INT8_T, 1)])
  953. AC_CHECK_TYPE(uint64_t, [AC_DEFINE(HAVE_UINT64_T, 1)])
  954. AC_CHECK_TYPE(uint32_t, [AC_DEFINE(HAVE_UINT32_T, 1)])
  955. AC_CHECK_TYPE(uint16_t, [AC_DEFINE(HAVE_UINT16_T, 1)])
  956. AC_CHECK_TYPE(uint8_t, [AC_DEFINE(HAVE_UINT8_T, 1)])
  957. AC_MSG_CHECKING([whether to enable 64bit counters])
  958. AC_ARG_ENABLE(64bit,
  959. [ --enable-64bit Enable 64bit counters (default: yes)],
  960. [
  961. if test x$enableval = x"yes" ; then
  962. AC_MSG_RESULT(yes)
  963. AC_DEFINE(HAVE_64BIT_COUNTERS, 1)
  964. else
  965. AC_MSG_RESULT(no)
  966. fi
  967. ],
  968. [
  969. AC_MSG_RESULT(yes)
  970. AC_DEFINE(HAVE_64BIT_COUNTERS, 1)
  971. COMPILE_ARGS="${COMPILE_ARGS} '--enable-64bit'"
  972. ]
  973. )
  974. AC_MSG_CHECKING([whether to enable multithreading in pmacct])
  975. AC_ARG_ENABLE(threads,
  976. [ --enable-threads Enable multi-threading in pmacct (default: yes)],
  977. [
  978. if test x$enableval = x"yes" ; then
  979. AC_MSG_RESULT(yes)
  980. AC_DEFINE(ENABLE_THREADS, 1)
  981. dnl OS Specifics
  982. case "$host" in
  983. *-linux-*)
  984. AC_DEFINE(_XOPEN_SOURCE, 600)
  985. AC_DEFINE(_GNU_SOURCE, 1)
  986. ;;
  987. esac
  988. LIBS="${LIBS} -lpthread"
  989. USING_THREADPOOL=yes
  990. else
  991. AC_MSG_RESULT(no)
  992. fi
  993. ],
  994. [
  995. AC_MSG_RESULT(yes)
  996. AC_DEFINE(ENABLE_THREADS, 1)
  997. dnl OS Specifics
  998. case "$host" in
  999. *-linux-*)
  1000. AC_DEFINE(_XOPEN_SOURCE, 600)
  1001. AC_DEFINE(_GNU_SOURCE, 1)
  1002. ;;
  1003. esac
  1004. LIBS="${LIBS} -lpthread"
  1005. USING_THREADPOOL=yes
  1006. COMPILE_ARGS="${COMPILE_ARGS} '--enable-threads'"
  1007. ]
  1008. )
  1009. AC_MSG_CHECKING(whether to enable NFLOG support)
  1010. AC_ARG_ENABLE(nflog,
  1011. [ --enable-nflog Enable NFLOG support (default: no)],
  1012. [ case "$enableval" in
  1013. yes)
  1014. AC_MSG_RESULT(yes)
  1015. PKG_CHECK_MODULES([NFLOG], [libnetfilter_log >= 1])
  1016. USING_NFLOG="yes"
  1017. AC_DEFINE(WITH_NFLOG, 1)
  1018. ;;
  1019. no)
  1020. AC_MSG_RESULT(no)
  1021. ;;
  1022. esac ],
  1023. AC_MSG_RESULT(no))
  1024. AC_MSG_CHECKING(whether to link IPv4/IPv6 traffic accounting accounting binaries)
  1025. AC_ARG_ENABLE(traffic-bins,
  1026. [ --enable-traffic-bins Link IPv4/IPv6 traffic accounting binaries (default: yes)],
  1027. [
  1028. if test x$enableval = x"yes" ; then
  1029. AC_MSG_RESULT(yes)
  1030. AC_DEFINE(HAVE_TRAFFIC_BINS, 1)
  1031. USING_TRAFFIC_BINS="yes"
  1032. else
  1033. AC_MSG_RESULT(no)
  1034. fi
  1035. ],
  1036. [
  1037. AC_MSG_RESULT(yes)
  1038. AC_DEFINE(HAVE_TRAFFIC_BINS, 1)
  1039. USING_TRAFFIC_BINS="yes"
  1040. COMPILE_ARGS="${COMPILE_ARGS} '--enable-traffic-bins'"
  1041. ]
  1042. )
  1043. AC_MSG_CHECKING(whether to link BGP daemon binaries)
  1044. AC_ARG_ENABLE(bgp-bins,
  1045. [ --enable-bgp-bins Link BGP daemon binaries (default: yes)],
  1046. [
  1047. if test x$enableval = x"yes" ; then
  1048. AC_MSG_RESULT(yes)
  1049. AC_DEFINE(HAVE_BGP_BINS, 1)
  1050. USING_BGP_BINS="yes"
  1051. else
  1052. AC_MSG_RESULT(no)
  1053. fi
  1054. ],
  1055. [
  1056. AC_MSG_RESULT(yes)
  1057. AC_DEFINE(HAVE_BGP_BINS, 1)
  1058. USING_BGP_BINS="yes"
  1059. COMPILE_ARGS="${COMPILE_ARGS} '--enable-bgp-bins'"
  1060. ]
  1061. )
  1062. AC_MSG_CHECKING(whether to link BMP daemon binaries)
  1063. AC_ARG_ENABLE(bmp-bins,
  1064. [ --enable-bmp-bins Link BMP daemon binaries (default: yes)],
  1065. [
  1066. if test x$enableval = x"yes" ; then
  1067. AC_MSG_RESULT(yes)
  1068. AC_DEFINE(HAVE_BMP_BINS, 1)
  1069. USING_BMP_BINS="yes"
  1070. else
  1071. AC_MSG_RESULT(no)
  1072. fi
  1073. ],
  1074. [
  1075. AC_MSG_RESULT(yes)
  1076. AC_DEFINE(HAVE_BMP_BINS, 1)
  1077. USING_BMP_BINS="yes"
  1078. COMPILE_ARGS="${COMPILE_ARGS} '--enable-bmp-bins'"
  1079. ]
  1080. )
  1081. AC_MSG_CHECKING(whether to link Streaming Telemetry daemon binaries)
  1082. AC_ARG_ENABLE(st-bins,
  1083. [ --enable-st-bins Link Streaming Telemetry daemon binaries (default: yes)],
  1084. [
  1085. if test x$enableval = x"yes" ; then
  1086. AC_MSG_RESULT(yes)
  1087. AC_DEFINE(HAVE_ST_BINS, 1)
  1088. USING_ST_BINS="yes"
  1089. else
  1090. AC_MSG_RESULT(no)
  1091. fi
  1092. ],
  1093. [
  1094. AC_MSG_RESULT(yes)
  1095. AC_DEFINE(HAVE_ST_BINS, 1)
  1096. USING_ST_BINS="yes"
  1097. COMPILE_ARGS="${COMPILE_ARGS} '--enable-st-bins'"
  1098. ]
  1099. )
  1100. dnl Checks for library functions.
  1101. AC_TYPE_SIGNAL
  1102. AC_CHECK_FUNCS([strlcpy vsnprintf setproctitle mallopt tdestroy])
  1103. dnl final checks
  1104. dnl trivial solution to portability issue
  1105. AC_DEFINE_UNQUOTED(COMPILE_ARGS, "$COMPILE_ARGS")
  1106. CFLAGS="${CFLAGS} ${INCLUDES}"
  1107. INCLUDES=""
  1108. echo "
  1109. PLATFORM ..... : `uname -m`
  1110. OS ........... : `uname -rs` (`uname -n`)
  1111. COMPILER ..... : ${CC}
  1112. CFLAGS ....... : ${CFLAGS}
  1113. LIBS ......... : ${LIBS}
  1114. LDFLAGS ...... : ${LDFLAGS}
  1115. PLUGINS ...... : ${PLUGINS}
  1116. SUPPORTS ..... : ${SUPPORTS}
  1117. Now type 'make' to compile the source code.
  1118. Wanting to get in touch with other pmacct users?
  1119. Join the pmacct mailing-list with an email to pmacct-discussion-subscribe@pmacct.net
  1120. Need for documentation and examples?
  1121. Start by reading the README.md file
  1122. Star, watch or contribute to the project on GitHub:
  1123. https://github.com/pmacct/pmacct
  1124. "
  1125. AC_SUBST([EXTRABIN])
  1126. AC_SUBST([PMACCT_CFLAGS])
  1127. AM_CONDITIONAL([WITH_MYSQL], [test x"$USING_MYSQL" = x"yes"])
  1128. AM_CONDITIONAL([WITH_PGSQL], [test x"$USING_PGSQL" = x"yes"])
  1129. AM_CONDITIONAL([WITH_MONGODB], [test x"$USING_MONGODB" = x"yes"])
  1130. AM_CONDITIONAL([WITH_SQLITE3], [test x"$USING_SQLITE3" = x"yes"])
  1131. AM_CONDITIONAL([WITH_RABBITMQ], [test x"$USING_RABBITMQ" = x"yes"])
  1132. AM_CONDITIONAL([WITH_ZMQ], [test x"$USING_ZMQ" = x"yes"])
  1133. AM_CONDITIONAL([WITH_KAFKA], [test x"$USING_KAFKA" = x"yes"])
  1134. AM_CONDITIONAL([USING_SQL], [test x"$USING_SQL" = x"yes"])
  1135. AM_CONDITIONAL([USING_THREADPOOL], [test x"$USING_THREADPOOL" = x"yes"])
  1136. AM_CONDITIONAL([WITH_AVRO], [test x"$USING_AVRO" = x"yes"])
  1137. AM_CONDITIONAL([WITH_NDPI], [test x"$USING_NDPI" = x"yes"])
  1138. AM_CONDITIONAL([WITH_NFLOG], [test x"$USING_NFLOG" = x"yes"])
  1139. AM_CONDITIONAL([USING_TRAFFIC_BINS], [test x"$USING_TRAFFIC_BINS" = x"yes"])
  1140. AM_CONDITIONAL([USING_BGP_BINS], [test x"$USING_BGP_BINS" = x"yes"])
  1141. AM_CONDITIONAL([USING_BMP_BINS], [test x"$USING_BMP_BINS" = x"yes"])
  1142. AM_CONDITIONAL([USING_ST_BINS], [test x"$USING_ST_BINS" = x"yes"])
  1143. AC_OUTPUT([ Makefile \
  1144. src/Makefile src/nfprobe_plugin/Makefile \
  1145. src/sfprobe_plugin/Makefile src/bgp/Makefile \
  1146. src/tee_plugin/Makefile src/isis/Makefile \
  1147. src/bmp/Makefile src/telemetry/Makefile \
  1148. src/ndpi/Makefile ])