source: configure.in @ b73407f

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since b73407f was d7fd648, checked in by Richard Sanger <rsangerarj@…>, 7 years ago

Improves speed of the DPDK format(and parallel libtrace) and fixes some DPDK bugs

Fixes bug with PCI address being parsed as a decimal instead of hex.
Fixes bug so DPDK Breaks out of loop when libtrace_halt is called

For performance

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