source: configure.in @ 2138553

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

Updates the dpdk build system to support the lastest DPDK libraries v1.5 and above
This drops support for anything before v1.5 due to the requirment to patch the build system.
Hopefully this new way will continue to work with newer releases

This removes the need to patch the DPDK library
Instead the only requirement is that DPDK is built as a static library with the following options
CONFIG_RTE_BUILD_COMBINE_LIBS=y EXTRA_CFLAGS="-fPIC added to the make command

-This line, and those below, will be ignored--

M configure.in
D Intel DPDK Patches/DPDKLibtracePatch.patch
M Intel DPDK Patches/README
M lib/format_dpdk.c
A lib/dpdk_libtrace.mk
M lib/Makefile.am

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