1 | # Process this file with autoconf to produce a configure script. |
---|
2 | |
---|
3 | # Now you only need to update the version number in two places - below, |
---|
4 | # and in the README |
---|
5 | |
---|
6 | AC_INIT([libtrace],[4.0.0],[contact@wand.net.nz],[libtrace]) |
---|
7 | |
---|
8 | LIBTRACE_MAJOR=4 |
---|
9 | LIBTRACE_MID=0 |
---|
10 | LIBTRACE_MINOR=0 |
---|
11 | |
---|
12 | # OpenSolaris hides libraries like libncurses in /usr/gnu/lib, which is not |
---|
13 | # searched by default - add it to LDFLAGS so we at least have a chance of |
---|
14 | # finding it |
---|
15 | if test -d "/usr/gnu/lib"; then |
---|
16 | LDFLAGS+=" -L/usr/gnu/lib" |
---|
17 | fi |
---|
18 | |
---|
19 | AC_CONFIG_MACRO_DIR([m4]) |
---|
20 | AC_CONFIG_SRCDIR(lib/trace.c) |
---|
21 | AM_INIT_AUTOMAKE([subdir-objects]) |
---|
22 | |
---|
23 | # Make sure we use the relatively silent automake output |
---|
24 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) |
---|
25 | |
---|
26 | # Define our libtrace version number externally so we can use it in the source |
---|
27 | # as well, if needed. |
---|
28 | AC_DEFINE([LIBTRACE_MAJOR],${LIBTRACE_MAJOR},[libtrace major version]) |
---|
29 | AC_DEFINE([LIBTRACE_MID],${LIBTRACE_MID},[libtrace mid version]) |
---|
30 | AC_DEFINE([LIBTRACE_MINOR],${LIBTRACE_MINOR},[libtrace minor version]) |
---|
31 | |
---|
32 | # These are all the files we want to be built for us by configure |
---|
33 | AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile |
---|
34 | tools/Makefile tools/traceanon/Makefile tools/tracepktdump/Makefile |
---|
35 | tools/tracemerge/Makefile tools/tracereport/Makefile |
---|
36 | tools/tracertstats/Makefile tools/tracesplit/Makefile |
---|
37 | tools/tracestats/Makefile tools/tracetop/Makefile |
---|
38 | tools/tracereplay/Makefile tools/tracediff/Makefile |
---|
39 | tools/traceends/Makefile |
---|
40 | examples/Makefile examples/skeleton/Makefile examples/rate/Makefile |
---|
41 | examples/stats/Makefile examples/tutorial/Makefile examples/parallel/Makefile |
---|
42 | docs/libtrace.doxygen |
---|
43 | lib/libtrace.h |
---|
44 | ]) |
---|
45 | |
---|
46 | |
---|
47 | # Function that checks if the C++ compiler actually works - there's a bit of |
---|
48 | # oversight in autoconf that will set the C++ compiler to g++ if no compiler |
---|
49 | # is found, even if g++ is not present! So we need an extra test to make sure |
---|
50 | # that the compiler works :( |
---|
51 | |
---|
52 | AC_DEFUN([rw_PROG_CXX_WORKS], |
---|
53 | [AC_REQUIRE([AC_PROG_CXX])dnl |
---|
54 | AC_CACHE_CHECK([whether the C++ compiler works], |
---|
55 | [rw_cv_prog_cxx_works], |
---|
56 | [AC_LANG_PUSH([C++]) |
---|
57 | AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
---|
58 | [rw_cv_prog_cxx_works=yes], |
---|
59 | [rw_cv_prog_cxx_works=no]) |
---|
60 | AC_LANG_POP([C++])]) |
---|
61 | ]) |
---|
62 | |
---|
63 | # Put all our automake definitions in config.h |
---|
64 | AM_CONFIG_HEADER([config.h]) |
---|
65 | |
---|
66 | # Checks for C and C++ compilers |
---|
67 | AC_PROG_CC |
---|
68 | AC_PROG_CXX |
---|
69 | rw_PROG_CXX_WORKS |
---|
70 | |
---|
71 | if test "$rw_cv_prog_cxx_works" = "no"; then |
---|
72 | AC_MSG_ERROR("Failed to find working C++ compiler") |
---|
73 | fi |
---|
74 | |
---|
75 | # Checking for 'install' |
---|
76 | AC_PROG_INSTALL |
---|
77 | |
---|
78 | # Checking for bison and flex |
---|
79 | AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc) |
---|
80 | AM_PROG_LEX |
---|
81 | |
---|
82 | # All our source files for function replacements are in lib/ |
---|
83 | AC_CONFIG_LIBOBJ_DIR(lib) |
---|
84 | |
---|
85 | # Check for various "replacement" functions |
---|
86 | AC_FUNC_MALLOC |
---|
87 | AC_FUNC_REALLOC |
---|
88 | |
---|
89 | # *BSD doesn't have strndup. Currently provide our own. |
---|
90 | AC_REPLACE_FUNCS(strndup) |
---|
91 | |
---|
92 | |
---|
93 | # Checks for typedefs, structures, and compiler characteristics. |
---|
94 | AC_C_CONST |
---|
95 | AC_C_INLINE |
---|
96 | AC_C_BIGENDIAN |
---|
97 | AC_TYPE_SIZE_T |
---|
98 | AC_HEADER_TIME |
---|
99 | AC_SYS_LARGEFILE |
---|
100 | |
---|
101 | LIBPKTDUMP_LIBS="-ltrace " |
---|
102 | ADD_LDFLAGS="$ADD_LDFLAGS -L\$(abs_top_srcdir)/lib" |
---|
103 | LIBTRACE_LIBS="" |
---|
104 | TOOLS_LIBS="" |
---|
105 | |
---|
106 | CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wextra -DLT_BUILDING_DLL=1" |
---|
107 | CXXFLAGS="$CXXFLAGS -Wall -DLT_BUILDING_DLL=1" |
---|
108 | |
---|
109 | # Check for -fvisibility |
---|
110 | gl_VISIBILITY |
---|
111 | |
---|
112 | gcc_PACKED |
---|
113 | gcc_DEPRECATED |
---|
114 | gcc_UNUSED |
---|
115 | gcc_PURE |
---|
116 | gcc_FORMAT |
---|
117 | |
---|
118 | # Check for gcc style TLS (__thread) |
---|
119 | gcc_TLS |
---|
120 | |
---|
121 | # Check for libtool |
---|
122 | AC_PROG_LIBTOOL |
---|
123 | |
---|
124 | # Checks for library functions. |
---|
125 | AC_PROG_GCC_TRADITIONAL |
---|
126 | |
---|
127 | # Fail if any of these functions are missing |
---|
128 | AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf vsnprintf) |
---|
129 | |
---|
130 | AC_CHECK_SIZEOF([long int]) |
---|
131 | |
---|
132 | |
---|
133 | # Checks for header files. |
---|
134 | AC_HEADER_STDC |
---|
135 | AC_CHECK_HEADERS(pcap.h pcap-int.h pcap-bpf.h net/bpf.h sys/limits.h stddef.h inttypes.h limits.h net/ethernet.h sys/prctl.h) |
---|
136 | |
---|
137 | |
---|
138 | # OpenSolaris puts ncurses.h in /usr/include/ncurses rather than /usr/include, |
---|
139 | # so check for that |
---|
140 | AC_CHECK_HEADERS(ncurses.h,,[missing_ncurses=true]) |
---|
141 | |
---|
142 | if test "x$missing_ncurses" = xtrue; then |
---|
143 | if test -f "/usr/include/ncurses/ncurses.h"; then |
---|
144 | AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Has nested ncurses header]) |
---|
145 | fi |
---|
146 | fi |
---|
147 | |
---|
148 | |
---|
149 | # Check for the presence of various networking headers and define appropriate |
---|
150 | # macros |
---|
151 | AC_CHECK_HEADERS(netinet/in.h) |
---|
152 | AC_CHECK_HEADERS(netpacket/packet.h,[ |
---|
153 | libtrace_netpacket_packet_h=true |
---|
154 | AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net]) |
---|
155 | ]) |
---|
156 | AC_CHECK_HEADER(net/if.h, |
---|
157 | AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[ |
---|
158 | #include <sys/types.h> |
---|
159 | #include <sys/socket.h> |
---|
160 | ]) |
---|
161 | |
---|
162 | AC_CHECK_HEADER(netinet/ether.h, |
---|
163 | AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[ |
---|
164 | #include <sys/types.h> |
---|
165 | #include <sys/socket.h> |
---|
166 | #include <netinet/in.h> |
---|
167 | #include <net/if.h> |
---|
168 | ]) |
---|
169 | |
---|
170 | AC_CHECK_HEADER(netinet/if_ether.h, |
---|
171 | AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[ |
---|
172 | #include <sys/types.h> |
---|
173 | #include <sys/socket.h> |
---|
174 | #include <netinet/in.h> |
---|
175 | #include <net/if.h> |
---|
176 | ]) |
---|
177 | |
---|
178 | AC_CHECK_HEADER(net/if_arp.h, |
---|
179 | AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[ |
---|
180 | #include <sys/types.h> |
---|
181 | #include <sys/socket.h> |
---|
182 | #include <netinet/in.h> |
---|
183 | #include <net/if.h> |
---|
184 | ]) |
---|
185 | |
---|
186 | # Check for sdl_len in sockaddr_dl - sockaddr_dl is used on BSD systems |
---|
187 | if test "$libtrace_netpacket_packet_h" != "true"; then |
---|
188 | AC_CHECK_MEMBER([struct sockaddr_dl.sdl_len], |
---|
189 | AC_DEFINE(HAVE_SDL_LEN,1,[Has sdl_len in sockaddr_dl]),,[ |
---|
190 | #include <sys/types.h> |
---|
191 | #include <sys/socket.h> |
---|
192 | #include <net/if_dl.h> |
---|
193 | ]) |
---|
194 | fi |
---|
195 | |
---|
196 | # Checking for the right bpf header to include |
---|
197 | AC_CHECK_HEADER(pcap-bpf.h) |
---|
198 | AC_CHECK_HEADER(net/bpf.h) |
---|
199 | |
---|
200 | # Checking for libgdc |
---|
201 | AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h])) |
---|
202 | |
---|
203 | # Check for libwandio (no longer bundled with libtrace) |
---|
204 | AC_CHECK_LIB(wandio,wandio_create,wandiofound=1,wandiofound=0) |
---|
205 | if test "$wandiofound" = 0; then |
---|
206 | AC_MSG_ERROR(libwandio is required to compile libtrace. If you have installed it in a non-standard location please use LDFLAGS to specify the location of the library. WANDIO can be obtained from http://research.wand.net.nz/software/libwandio.php) |
---|
207 | else |
---|
208 | LIBTRACE_LIBS="$LIBTRACE_LIBS -lwandio" |
---|
209 | TOOLS_LIBS="$TOOLS_LIBS -lwandio" |
---|
210 | AC_DEFINE([HAVE_LIBWANDIO],1,[compile with libwandio support]) |
---|
211 | fi |
---|
212 | |
---|
213 | AC_CHECK_LIB(crypto, EVP_EncryptInit_ex, cryptofound=1, cryptofound=0) |
---|
214 | |
---|
215 | # Check for libpcap |
---|
216 | AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0) |
---|
217 | AC_CHECK_LIB(pcap,pcap_create,pcapcreate=1,pcapcreate=0) |
---|
218 | AC_CHECK_DECLS([BIOCSETIF],,,[ |
---|
219 | #include <sys/types.h> |
---|
220 | #include <sys/time.h> |
---|
221 | #include <sys/ioctl.h> |
---|
222 | #include <net/bpf.h> |
---|
223 | ]) |
---|
224 | |
---|
225 | AC_ARG_ENABLE(memory-debugging, |
---|
226 | AS_HELP_STRING(--enable-memory-debugging, prints internal memory statistics),[ |
---|
227 | if test "$HAVE_TLS" = 1 |
---|
228 | then |
---|
229 | AC_DEFINE([ENABLE_MEM_STATS], 1, [print debug memory statistics]) |
---|
230 | fi |
---|
231 | ],[]) |
---|
232 | |
---|
233 | # Configure options for man pages |
---|
234 | AC_ARG_WITH(man, |
---|
235 | AS_HELP_STRING(--with-man,install man pages by default),[ |
---|
236 | if test "$withval" = yes |
---|
237 | then |
---|
238 | MANPAGES="docs/man/man3/[a-zA-Z]*.3" |
---|
239 | else |
---|
240 | MANPAGES="" |
---|
241 | fi |
---|
242 | ]) |
---|
243 | |
---|
244 | # Complain if we didn't find a suitable libpcap |
---|
245 | if test "$pcapfound" = 0; then |
---|
246 | AC_MSG_ERROR(libpcap0.8 or greater is required to compile libtrace. If you have installed it in a non-standard location please use LDFLAGS to specify the location of the library) |
---|
247 | else |
---|
248 | TOOL_LIBS="$TOOL_LIBS -lpcap" |
---|
249 | LIBTRACE_LIBS="$LIBTRACE_LIBS -lpcap" |
---|
250 | AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support]) |
---|
251 | AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support]) |
---|
252 | |
---|
253 | LIBS="-lpcap" |
---|
254 | AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock) |
---|
255 | LIBS="" |
---|
256 | |
---|
257 | fi |
---|
258 | |
---|
259 | if test "$pcapcreate" = 1; then |
---|
260 | AC_DEFINE([HAVE_PCAP_CREATE],1,[compile with libpcap 1.0 support]) |
---|
261 | fi |
---|
262 | |
---|
263 | # Configure options for use of DAG cards |
---|
264 | # Originally borrowed from libpcap, but extended quite a bit :) |
---|
265 | # More details on how this check works: |
---|
266 | # http://wand.net.nz/trac/libtrace/wiki/DAGNotes |
---|
267 | |
---|
268 | AC_ARG_WITH(dag, |
---|
269 | AS_HELP_STRING(--with-dag[=DIR],include DAG live capture support (located in directory DIR, if supplied)), |
---|
270 | [ |
---|
271 | if test "$withval" = no |
---|
272 | then |
---|
273 | want_dag=no |
---|
274 | elif test "$withval" = yes |
---|
275 | then |
---|
276 | want_dag=yes |
---|
277 | dag_root=/usr/local/dag |
---|
278 | else |
---|
279 | want_dag=yes |
---|
280 | dag_root=$withval |
---|
281 | fi |
---|
282 | ],[ |
---|
283 | # |
---|
284 | # Use DAG API if present, otherwise don't |
---|
285 | # |
---|
286 | want_dag=ifpresent |
---|
287 | dag_root=/usr/local/dag |
---|
288 | ]) |
---|
289 | |
---|
290 | # DAG 3.0 actually puts header files and shared libraries into sensible |
---|
291 | # places now, so we should be able to do a simple CHECK_LIB to see if |
---|
292 | # they're there! |
---|
293 | |
---|
294 | # Addendum: It turns out DAG 2.5 does this too, so we'll match DAG2.5 in here |
---|
295 | # also. This isn't such a bad thing, the DAG2.5 API is essentially the same as |
---|
296 | # DAG 3.0 and libtrace will use the same format_dagXX source for both |
---|
297 | libtrace_dag=false |
---|
298 | libtrace_dag_version=none |
---|
299 | |
---|
300 | if test "$with_dag" != no; then |
---|
301 | AC_CHECK_LIB(dag, dag_open, dag_found=1, dag_found=0) |
---|
302 | if test "$dag_found" = 1; then |
---|
303 | ADD_LIBS="$ADD_LIBS -ldag" |
---|
304 | LIBTRACE_LIBS="$LIBTRACE_LIBS -ldag" |
---|
305 | AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) |
---|
306 | AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support]) |
---|
307 | libtrace_dag=true |
---|
308 | |
---|
309 | AC_DEFINE(DAG_VERSION,25,[defines the DAG driver version]) |
---|
310 | libtrace_dag_version=25 |
---|
311 | fi |
---|
312 | fi |
---|
313 | |
---|
314 | # TODO: turn the test part of the next block into a function, so it can be |
---|
315 | # called multiple times for $dag_root, /root/dag, /usr/local/lib |
---|
316 | dag_drv_v="DAG not present" |
---|
317 | |
---|
318 | # Now check for 2.4 DAG drivers which don't install as cleanly! |
---|
319 | if test "$with_dag" != no -a "$libtrace_dag" = false; then |
---|
320 | AC_MSG_CHECKING(whether we have DAG 2.4 API instead) |
---|
321 | |
---|
322 | if test -r "$dag_root/lib"; then |
---|
323 | dag_lib_dir="$dag_root/lib" |
---|
324 | else |
---|
325 | dag_lib_dir="$dag_root" |
---|
326 | fi |
---|
327 | |
---|
328 | if test -r "$dag_root/include"; then |
---|
329 | dag_tools_dir="$dag_root/tools" |
---|
330 | dag_include_dir="$dag_root/include" |
---|
331 | else |
---|
332 | dag_tools_dir="$dag_root" |
---|
333 | dag_include_dir="$dag_root" |
---|
334 | fi |
---|
335 | |
---|
336 | if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a"; |
---|
337 | then |
---|
338 | ADD_INCLS="$ADD_INCLS -I $dag_include_dir" |
---|
339 | ADD_LIBS="$ADD_LIBS -ldag" |
---|
340 | ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir" |
---|
341 | DAG_TOOLS_DIR=$dag_tools_dir |
---|
342 | AC_SUBST([DAG_TOOLS_DIR]) |
---|
343 | libtrace_dag=true |
---|
344 | |
---|
345 | AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) |
---|
346 | AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support]) |
---|
347 | AC_DEFINE(DAG_VERSION, 24, [defines the DAG driver version]) |
---|
348 | libtrace_dag_version=24 |
---|
349 | else |
---|
350 | if test "$want_dag" = yes; then |
---|
351 | AC_MSG_ERROR(DAG API not found under directory $dag_root |
---|
352 | ; use --without-dag) |
---|
353 | fi |
---|
354 | libtrace_dag=false |
---|
355 | fi |
---|
356 | AC_MSG_RESULT($libtrace_dag) |
---|
357 | |
---|
358 | fi |
---|
359 | |
---|
360 | # Try to determine the DAG driver version |
---|
361 | #if test x"$libtrace_dag" = xtrue; then |
---|
362 | # dag_drv_v="Unknown" |
---|
363 | # files=`locate /usr/*dag*/VERSION` |
---|
364 | # file_count=0 |
---|
365 | # |
---|
366 | # for i in $files; do |
---|
367 | # if $file_count > 0; then |
---|
368 | # dag_drv_v="Indeterminate" |
---|
369 | # break |
---|
370 | # fi |
---|
371 | # dag_drv_v=`cat $i` |
---|
372 | # file_count=$file_count+1 |
---|
373 | # done |
---|
374 | #fi |
---|
375 | #DAG_VERSION_NUM=$dag_drv_v |
---|
376 | |
---|
377 | # Check for DPDK |
---|
378 | AC_ARG_WITH(dpdk, |
---|
379 | AS_HELP_STRING(--with-dpdk,include DPDK live capture support (Must set RTE_SDK/_TARGET environment variable)), |
---|
380 | [ |
---|
381 | if test "$withval" = no |
---|
382 | then |
---|
383 | want_dpdk=no |
---|
384 | else |
---|
385 | want_dpdk=ifpresent |
---|
386 | fi |
---|
387 | ],[ |
---|
388 | # Default to building without DPDK format |
---|
389 | want_dpdk=no |
---|
390 | ]) |
---|
391 | |
---|
392 | libtrace_dpdk=false |
---|
393 | if test "$want_dpdk" != no; then |
---|
394 | saved_ldflags="$LDFLAGS" |
---|
395 | # Add to our libpath location |
---|
396 | LDFLAGS="$LDFLAGS -L$RTE_SDK/$RTE_TARGET/lib/" |
---|
397 | # Test that the library exists, we cannot be sure of what extra library flags need to be added |
---|
398 | # this could change in the next version which would make the test fail |
---|
399 | #AC_CHECK_LIB(intel_dpdk, rte_eal_init, dpdk_found=1, dpdk_found=0, -lpthread -lm -lrt) |
---|
400 | |
---|
401 | # So instead simply check for existence |
---|
402 | AC_CHECK_FILE("$RTE_SDK/$RTE_TARGET/lib/libintel_dpdk.a", dpdk_found=1, dpdk_found=0) |
---|
403 | # Revert back |
---|
404 | LDFLAGS="$saved_ldflags" |
---|
405 | if test "$dpdk_found" = 1; then |
---|
406 | # Save these now so that they can be re-exported later |
---|
407 | AC_SUBST([RTE_TARGET]) |
---|
408 | AC_SUBST([RTE_SDK]) |
---|
409 | # Force dpdk library to be statically linked to allow compiler optimisations |
---|
410 | LIBTRACE_LIBS="$LIBTRACE_LIBS -Wl,--whole-archive -Wl,-l:libintel_dpdk.a -Wl,--no-whole-archive -Wl,-lm" |
---|
411 | AC_DEFINE(HAVE_DPDK,1,[conditional for building with DPDK live capture support]) |
---|
412 | libtrace_dpdk=true |
---|
413 | fi |
---|
414 | fi |
---|
415 | |
---|
416 | # Check for PACKET_FANOUT (borrowed from Suricata) |
---|
417 | AC_CHECK_DECL([PACKET_FANOUT], |
---|
418 | AC_DEFINE([HAVE_PACKET_FANOUT],[1], |
---|
419 | [Recent packet fanout support is available]), |
---|
420 | [], |
---|
421 | [[#include <linux/if_packet.h>]]) |
---|
422 | |
---|
423 | # If we use DPDK we might be able to use libnuma |
---|
424 | AC_CHECK_LIB(numa, numa_node_to_cpus, have_numa=1, have_numa=0) |
---|
425 | |
---|
426 | # Checks for various "optional" libraries |
---|
427 | AC_CHECK_LIB(pthread, pthread_create, have_pthread=1, have_pthread=0) |
---|
428 | |
---|
429 | AC_CHECK_LIB(pthread, pthread_setname_np, have_pthread_setname_np=1, have_pthread_setname_np=0) |
---|
430 | |
---|
431 | # Check for ncurses |
---|
432 | |
---|
433 | # These libraries have to be explicitly linked in OpenSolaris |
---|
434 | AC_SEARCH_LIBS(getservent, socket, have_socket=1, have_socket=0, -lnsl) |
---|
435 | LIBS= |
---|
436 | |
---|
437 | AC_SEARCH_LIBS(inet_ntop, nsl, have_nsl=1, have_nsl=0, -lsocket) |
---|
438 | LIBS= |
---|
439 | |
---|
440 | # Check to see if we have libdl - *BSD has built-in libdl |
---|
441 | AC_SEARCH_LIBS(dlopen,dl, dlfound=1,dlfound=0 ) |
---|
442 | LIBS= |
---|
443 | |
---|
444 | # Check for clock_gettime |
---|
445 | AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=1, have_clock_gettime=0) |
---|
446 | LIBS= |
---|
447 | |
---|
448 | if test "$have_numa" = 1; then |
---|
449 | LIBTRACE_LIBS="$LIBTRACE_LIBS -lnuma" |
---|
450 | AC_DEFINE(HAVE_LIBNUMA, 1, [Set to 1 if libnuma is supported]) |
---|
451 | with_numa=yes |
---|
452 | else |
---|
453 | AC_DEFINE(HAVE_LIBNUMA, 0, [Set to 1 if libnuma is supported]) |
---|
454 | with_numa=no |
---|
455 | fi |
---|
456 | |
---|
457 | if test "$dlfound" = 0; then |
---|
458 | AC_MSG_ERROR("Unable to find dlopen. Please use LDFLAGS to specify the location of libdl and re-run configure") |
---|
459 | fi |
---|
460 | |
---|
461 | if test "$ac_cv_search_dlopen" != "none required"; then |
---|
462 | LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_dlopen" |
---|
463 | if test "$dpdk_found" = 1; then |
---|
464 | LIBTRACE_LIBS="$LIBTRACE_LIBS -Wl,$ac_cv_search_dlopen" |
---|
465 | fi |
---|
466 | fi |
---|
467 | |
---|
468 | if test "$have_pthread" = 1; then |
---|
469 | AC_DEFINE(HAVE_LIBPTHREAD, 1, [Set to 1 if pthreads are supported]) |
---|
470 | fi |
---|
471 | |
---|
472 | if test "$have_pthread_setname_np" = 1; then |
---|
473 | AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Set to 1 if pthread_setname_np is found]) |
---|
474 | fi |
---|
475 | |
---|
476 | if test "$cryptofound" = 1; then |
---|
477 | AC_DEFINE(HAVE_LIBCRYPTO, 1, [Set to 1 if libcrypto is available]) |
---|
478 | TOOLS_LIBS="$TOOLS_LIBS -lcrypto" |
---|
479 | have_crypto=yes |
---|
480 | else |
---|
481 | have_crypto=no |
---|
482 | fi |
---|
483 | |
---|
484 | if test "$have_nsl" = 1; then |
---|
485 | if test "$ac_cv_search_inet_ntop" != "none required"; then |
---|
486 | LIBTRACE_LIBS="$LIBTRACE_LIBS $ac_cv_search_inet_ntop" |
---|
487 | LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_inet_ntop" |
---|
488 | fi |
---|
489 | fi |
---|
490 | |
---|
491 | if test "$have_socket" = 1; then |
---|
492 | if test "$ac_cv_search_getservent" != "none required"; then |
---|
493 | LIBTRACE_LIBS="$LIBTRACE_LIBS $ac_cv_search_getservent" |
---|
494 | LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_getservent" |
---|
495 | fi |
---|
496 | fi |
---|
497 | |
---|
498 | |
---|
499 | if test "$have_clock_gettime" = 1; then |
---|
500 | LIBTRACE_LIBS="$LIBTRACE_LIBS -lrt" |
---|
501 | AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Set to 1 if clock_gettime is supported]) |
---|
502 | with_clock_gettime=yes |
---|
503 | else |
---|
504 | AC_DEFINE(HAVE_CLOCK_GETTIME, 0, [Set to 1 if clock_gettime is supported]) |
---|
505 | with_clock_gettime=no |
---|
506 | fi |
---|
507 | |
---|
508 | |
---|
509 | # Stupid AC_SEARCH_LIB appends stuff to LIBS even when I don't want it to, so |
---|
510 | # just set libs to null here to avoid linking against them by default |
---|
511 | LIBS= |
---|
512 | |
---|
513 | # For now, the user has to explicitly ask for the LLVM stuff, as it's a bit |
---|
514 | # rough around the edges :( |
---|
515 | AC_ARG_WITH([llvm], |
---|
516 | [AC_HELP_STRING([--with-llvm], |
---|
517 | [support Just In Time compiler])], |
---|
518 | use_llvm="yes", |
---|
519 | use_llvm="no") |
---|
520 | JIT=no |
---|
521 | |
---|
522 | # Search for LLVM and the libraries that it requires |
---|
523 | if (test "$use_llvm" != "no"); then |
---|
524 | AC_PATH_PROG(LLVM_CONFIG, llvm-config, no) |
---|
525 | |
---|
526 | # XXX Hard coding the path is REALLY bad. |
---|
527 | # llvm-gcc is installed in a stupid place in Debian / Ubuntu. Hard luck |
---|
528 | # if you've installed it somewhere custom. |
---|
529 | # Hopefully in future we can replace this with clang, which may or may |
---|
530 | # not be installed somewhere intelligent. |
---|
531 | AC_PATH_PROG(LLVM_GCC, llvm-gcc, no, /usr/lib/llvm/llvm/gcc-4.2/bin) |
---|
532 | |
---|
533 | AC_LANG_PUSH([C++]) |
---|
534 | AC_CHECK_HEADERS([boost/lexical_cast.hpp], boost="yes", boost="no") |
---|
535 | AC_LANG_POP([C++]) |
---|
536 | |
---|
537 | |
---|
538 | if test "$boost" = "no"; then |
---|
539 | AC_MSG_NOTICE([Unabled to find boost libraries. JIT support disabled.]) |
---|
540 | JIT=no |
---|
541 | elif test "$LLVM_CONFIG" = "no" ; then |
---|
542 | AC_MSG_NOTICE([Unable to find llvm-config. JIT support disabled.]) |
---|
543 | JIT=no |
---|
544 | elif test "$LLVM_GCC" = "no"; then |
---|
545 | AC_MSG_NOTICE([Unable to find llvm-gcc. JIT support disabled.]) |
---|
546 | JIT=no |
---|
547 | else |
---|
548 | LIBCXXFLAGS="`$LLVM_CONFIG --cxxflags` $CXXFLAGS" |
---|
549 | LIBTRACE_LIBS="$LIBRACE_LIBS `$LLVM_CONFIG --libs all`"; |
---|
550 | LDFLAGS="`$LLVM_CONFIG --ldflags` $LDFLAGS"; |
---|
551 | JIT=yes |
---|
552 | AC_DEFINE(HAVE_LLVM, 1, [Set to 1 if you have LLVM installed]) |
---|
553 | fi |
---|
554 | fi |
---|
555 | |
---|
556 | AC_ARG_WITH([ncurses], |
---|
557 | AC_HELP_STRING([--with-ncurses], [build tracetop (requires ncurses)])) |
---|
558 | |
---|
559 | AS_IF([test "x$with_ncurses" != "xno"], |
---|
560 | [AC_SEARCH_LIBS(mvprintw, ncurses, have_ncurses=yes, have_ncurses=no) |
---|
561 | LIBS= |
---|
562 | ], [have_ncurses=no]) |
---|
563 | |
---|
564 | AS_IF([test "x$have_ncurses" = "xyes"], [ |
---|
565 | if test "$ac_cv_search_mvprintw" != "none required"; then |
---|
566 | TOOLS_LIBS="$TOOLS_LIBS $ac_cv_search_mvprintw" |
---|
567 | fi |
---|
568 | AC_DEFINE(HAVE_NCURSES, 1, "Compiled with ncurses support") |
---|
569 | with_ncurses=yes], |
---|
570 | |
---|
571 | |
---|
572 | [AS_IF([test "x$with_ncurses" = "xyes"], |
---|
573 | [AC_MSG_ERROR([ncurses requested but not found])]) |
---|
574 | AC_DEFINE(HAVE_NCURSES, 0, "Compiled with ncurses support") |
---|
575 | with_ncurses=no] |
---|
576 | ) |
---|
577 | |
---|
578 | # Define automake conditionals for use in our Makefile.am files |
---|
579 | AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ]) |
---|
580 | AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true]) |
---|
581 | AM_CONDITIONAL([HAVE_DPDK], [test "$libtrace_dpdk" = true]) |
---|
582 | AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24]) |
---|
583 | AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25]) |
---|
584 | AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true]) |
---|
585 | AM_CONDITIONAL([HAVE_LIBGDC], [test "$ac_cv_header_gdc_h" = yes]) |
---|
586 | AM_CONDITIONAL([HAVE_LLVM], [test "x$JIT" != "xno" ]) |
---|
587 | AM_CONDITIONAL([HAVE_NCURSES], [test "x$with_ncurses" != "xno"]) |
---|
588 | |
---|
589 | # Check for miscellaneous programs |
---|
590 | AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false]) |
---|
591 | |
---|
592 | AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue]) |
---|
593 | |
---|
594 | # Set all our output variables |
---|
595 | AC_SUBST([LIBTRACE_LIBS]) |
---|
596 | AC_SUBST([LIBPKTDUMP_LIBS]) |
---|
597 | AC_SUBST([TOOLS_LIBS]) |
---|
598 | #AC_SUBST([ADD_LIBS]) |
---|
599 | AC_SUBST([ADD_LDFLAGS]) |
---|
600 | AC_SUBST([ADD_INCLS]) |
---|
601 | AC_SUBST([LTLIBOBJS]) |
---|
602 | AC_SUBST([MANPAGES]) |
---|
603 | AC_SUBST([PACKAGE_VERSION]) |
---|
604 | AC_SUBST([LIBTRACE_MAJOR]) |
---|
605 | AC_SUBST([LIBTRACE_MID]) |
---|
606 | AC_SUBST([LIBTRACE_MINOR]) |
---|
607 | AC_SUBST([DAG_VERSION_NUM]) |
---|
608 | AC_SUBST([HAVE_BPF_CAPTURE]) |
---|
609 | AC_SUBST([HAVE_LIBGDC]) |
---|
610 | AC_SUBST([HAVE_LLVM]) |
---|
611 | AC_SUBST([HAVE_NCURSES]) |
---|
612 | AC_SUBST([LIBCFLAGS]) |
---|
613 | AC_SUBST([LIBCXXFLAGS]) |
---|
614 | |
---|
615 | |
---|
616 | # Finally, output our Makefiles |
---|
617 | AC_OUTPUT |
---|
618 | |
---|
619 | # Function for reporting whether an option was set or not |
---|
620 | reportopt() { |
---|
621 | if test x"$2" = xtrue -o x"$2" = xyes; then |
---|
622 | AC_MSG_NOTICE([$1: Yes]) |
---|
623 | else |
---|
624 | AC_MSG_NOTICE([$1: No]) |
---|
625 | fi |
---|
626 | } |
---|
627 | |
---|
628 | |
---|
629 | # Report which configure options were set |
---|
630 | echo |
---|
631 | AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION]) |
---|
632 | if test "$pcapcreate" = 1; then |
---|
633 | AC_MSG_NOTICE([Compiled with PCAP support: >= 1.0]) |
---|
634 | else |
---|
635 | AC_MSG_NOTICE([Compiled with PCAP support: < 1.0]) |
---|
636 | fi |
---|
637 | |
---|
638 | if test x"$libtrace_dag" = xtrue; then |
---|
639 | if test "$libtrace_dag_version" = 24; then |
---|
640 | AC_MSG_NOTICE([Compiled with DAG live capture support: 2.4]) |
---|
641 | elif test "$libtrace_dag_version" = 30; then |
---|
642 | AC_MSG_NOTICE([Compiled with DAG live capture support: 3.0]) |
---|
643 | else |
---|
644 | AC_MSG_NOTICE([Compiled with DAG live capture support: 2.5]) |
---|
645 | fi |
---|
646 | else |
---|
647 | AC_MSG_NOTICE([Compiled with DAG live capture support: No]) |
---|
648 | fi |
---|
649 | |
---|
650 | if test x"$libtrace_dpdk" = xtrue; then |
---|
651 | AC_MSG_NOTICE([Compiled with DPDK live capture support: Yes]) |
---|
652 | reportopt "Compiled with DPDK trace NUMA support" $with_numa |
---|
653 | reportopt "Compiled with clock_gettime support" $with_clock_gettime |
---|
654 | elif test x"$want_dpdk" != "xno"; then |
---|
655 | # We don't officially support DPDK so only report failure if the user |
---|
656 | # explicitly asked for DPDK. That way, we can hopefully keep it hidden |
---|
657 | # from most users for now... |
---|
658 | |
---|
659 | AC_MSG_NOTICE([Compiled with DPDK live capture support: No]) |
---|
660 | AC_MSG_NOTICE([Note: Requires DPDK v1.5 or newer]) |
---|
661 | fi |
---|
662 | reportopt "Compiled with LLVM BPF JIT support" $JIT |
---|
663 | reportopt "Building man pages/documentation" $libtrace_doxygen |
---|
664 | reportopt "Building tracetop (requires libncurses)" $with_ncurses |
---|
665 | reportopt "Building traceanon with CryptoPan (requires libcrypto)" $have_crypto |
---|
666 | |
---|
667 | # Report any errors relating to missing bison, flex, etc. |
---|
668 | echo |
---|
669 | ac_cv_errcount=0; |
---|
670 | if test -z "$YACC"; then |
---|
671 | AC_MSG_WARN(bison or yacc not found. Please install bison before continuing) |
---|
672 | ac_cv_errcount=$((ac_cv_errcount + 1)) |
---|
673 | fi |
---|
674 | |
---|
675 | if test "x$LEX" != xflex -a "x$LEX" != xlex; then |
---|
676 | AC_MSG_WARN(flex or lex not found. Please install flex before continuing) |
---|
677 | ac_cv_errcount=$((ac_cv_errcount + 1)) |
---|
678 | fi |
---|
679 | |
---|
680 | if test $ac_cv_errcount -gt 0; then |
---|
681 | AC_MSG_ERROR(Critical packages are missing and compilation will fail. Please install the packages listed above and rerun ./configure) |
---|
682 | fi |
---|
683 | |
---|