source: configure.in @ 4b0cd2f

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 4b0cd2f was 4b0cd2f, checked in by Shane Alcock <salcock@…>, 6 years ago

Integrate lzma into libwandio properly

Update configure to detect lzma properly.
Add missing get_compression_type API function to wandio code.
Add code to detect if input file is LZMA.

  • Property mode set to 100644
File size: 21.3 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.19],[contact@wand.net.nz],[libtrace])
7
8LIBTRACE_MAJOR=3
9LIBTRACE_MID=0
10LIBTRACE_MINOR=19
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
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 -l:libintel_dpdk.a"
389                AC_DEFINE(HAVE_DPDK,1,[conditional for building with DPDK live capture support])
390                libtrace_dpdk=true
391        fi
392fi
393
394# Checks for various "optional" libraries
395AC_CHECK_LIB(pthread, pthread_create, have_pthread=1, have_pthread=0)
396
397# Check for ncurses
398
399# These libraries have to be explicitly linked in OpenSolaris
400AC_SEARCH_LIBS(getservent, socket, have_socket=1, have_socket=0, -lnsl)
401LIBS=
402
403AC_SEARCH_LIBS(inet_ntop, nsl, have_nsl=1, have_nsl=0, -lsocket)
404LIBS=
405
406# Check to see if we have libdl - *BSD has built-in libdl
407AC_SEARCH_LIBS(dlopen,dl, dlfound=1,dlfound=0 )
408LIBS=
409
410# Check for clock_gettime
411AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=1, have_clock_gettime=0)
412LIBS=
413
414if test "$dlfound" = 0; then
415        AC_MSG_ERROR("Unable to find dlopen. Please use LDFLAGS to specify the location of libdl and re-run configure")
416fi
417
418if test "$ac_cv_search_dlopen" != "none required"; then
419        LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_dlopen"
420fi
421
422if test "$have_pthread" = 1; then
423        LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lpthread"
424        AC_DEFINE(HAVE_LIBPTHREAD, 1, [Set to 1 if pthreads are supported])
425fi
426
427
428if test "$have_nsl" = 1; then
429        if test "$ac_cv_search_inet_ntop" != "none required"; then
430                LIBTRACE_LIBS="$LIBTRACE_LIBS $ac_cv_search_inet_ntop"
431                LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_inet_ntop"
432        fi
433fi
434
435if test "$have_socket" = 1; then
436        if test "$ac_cv_search_getservent" != "none required"; then
437                LIBTRACE_LIBS="$LIBTRACE_LIBS $ac_cv_search_getservent"
438                LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_getservent"
439        fi
440fi
441
442
443if test "$have_clock_gettime" = 1; then
444    LIBTRACE_LIBS="$LIBTRACE_LIBS -lrt"
445fi
446
447
448# Stupid AC_SEARCH_LIB appends stuff to LIBS even when I don't want it to, so
449# just set libs to null here to avoid linking against them by default
450LIBS=
451
452# For now, the user has to explicitly ask for the LLVM stuff, as it's a bit
453# rough around the edges :(
454AC_ARG_WITH([llvm],
455        [AC_HELP_STRING([--with-llvm],
456                [support Just In Time compiler])],
457        use_llvm="yes",
458        use_llvm="no")
459JIT=no
460
461# Search for LLVM and the libraries that it requires
462if (test "$use_llvm" != "no"); then
463        AC_PATH_PROG(LLVM_CONFIG, llvm-config, no)
464
465        # XXX Hard coding the path is REALLY bad.
466        # llvm-gcc is installed in a stupid place in Debian / Ubuntu. Hard luck
467        # if you've installed it somewhere custom.
468        # Hopefully in future we can replace this with clang, which may or may
469        # not be installed somewhere intelligent.
470        AC_PATH_PROG(LLVM_GCC, llvm-gcc, no, /usr/lib/llvm/llvm/gcc-4.2/bin)
471
472        AC_LANG_PUSH([C++])
473        AC_CHECK_HEADERS([boost/lexical_cast.hpp], boost="yes", boost="no")
474        AC_LANG_POP([C++])
475
476               
477        if test "$boost" = "no"; then
478                AC_MSG_NOTICE([Unabled to find boost libraries.  JIT support disabled.])
479                JIT=no
480        elif test "$LLVM_CONFIG" = "no" ; then
481                AC_MSG_NOTICE([Unable to find llvm-config.  JIT support disabled.])
482                JIT=no
483        elif test "$LLVM_GCC" = "no"; then
484                AC_MSG_NOTICE([Unable to find llvm-gcc.  JIT support disabled.])
485                JIT=no
486        else
487                LIBCXXFLAGS="`$LLVM_CONFIG --cxxflags` $CXXFLAGS"
488                LIBTRACE_LIBS="$LIBRACE_LIBS `$LLVM_CONFIG --libs all`";
489                LDFLAGS="`$LLVM_CONFIG --ldflags` $LDFLAGS";
490                JIT=yes
491                AC_DEFINE(HAVE_LLVM, 1, [Set to 1 if you have LLVM installed])
492        fi
493fi
494
495AC_ARG_WITH([ncurses],
496        AC_HELP_STRING([--with-ncurses], [build tracetop (requires ncurses)]))
497
498AS_IF([test "x$with_ncurses" != "xno"],
499        [AC_SEARCH_LIBS(mvprintw, ncurses, have_ncurses=yes, have_ncurses=no)
500         LIBS=
501        ], [have_ncurses=no])
502
503AS_IF([test "x$have_ncurses" = "xyes"], [
504        if test "$ac_cv_search_mvprintw" != "none required"; then
505                TOOLS_LIBS="$TOOLS_LIBS $ac_cv_search_mvprintw"
506        fi
507        AC_DEFINE(HAVE_NCURSES, 1, "Compiled with ncurses support")
508        with_ncurses=yes],
509
510       
511        [AS_IF([test "x$with_ncurses" = "xyes"],
512                [AC_MSG_ERROR([ncurses requested but not found])])
513        AC_DEFINE(HAVE_NCURSES, 0, "Compiled with ncurses support")
514        with_ncurses=no]
515)
516                       
517AC_ARG_WITH([bzip2],
518        AC_HELP_STRING([--with-bzip2], [build with support for bzip2 compressed files]))
519
520AS_IF([test "x$with_bzip2" != "xno"],
521        [
522        AC_CHECK_LIB(bz2, BZ2_bzDecompressInit, have_bzip=yes, have_bzip=no)
523        ], [have_bzip=no])
524
525AS_IF([test "x$have_bzip" = "xyes"], [
526        if test "$ac_cv_lib_bz2_BZ2_bzDecompressInit" != "none required"; then
527                LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lbz2"
528        fi
529        with_bzip2=yes
530        AC_DEFINE(HAVE_LIBBZ2, 1, "Compiled with bzip2 support")],
531       
532        [AS_IF([test "x$with_bzip2" = "xyes"],
533                [AC_MSG_ERROR([bzip2 requested but not found])])
534        AC_DEFINE(HAVE_LIBBZ2, 0, "Compiled with bzip2 support")
535        with_bzip2=no]
536)
537
538AC_ARG_WITH([zlib],
539        AC_HELP_STRING([--with-zlib], [build with support for zlib compressed files]))
540
541AS_IF([test "x$with_zlib" != "xno"],
542        [
543        AC_CHECK_LIB(z, deflate, have_zlib=yes, have_zlib=no)
544        ], [have_zlib=no])
545
546AS_IF([test "x$have_zlib" = "xyes"], [
547        if test "$ac_cv_lib_z_deflate" != "none required"; then
548                LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lz"
549        fi
550        AC_DEFINE(HAVE_LIBZ, 1, "Compiled with zlib support")
551        with_zlib=yes],
552
553       
554        [AS_IF([test "x$with_zlib" = "xyes"],
555                [AC_MSG_ERROR([zlib requested but not found])])
556        AC_DEFINE(HAVE_LIBZ, 0, "Compiled with zlib support")
557        with_zlib=no]
558)
559
560AC_ARG_WITH([lzo],
561        AC_HELP_STRING([--with-lzo], [build with support for writing lzo compressed files]))
562
563AS_IF([test "x$with_lzo" != "xno"],
564        [
565        AC_CHECK_LIB(lzo2, lzo1x_1_compress, have_lzo=yes, have_lzo=no)
566        ], [have_lzo=no])
567
568AS_IF([test "x$have_lzo" = "xyes"], [
569        if test "$ac_cv_lib_lzo2_lzo1x_1_compress" != "none required"; then
570                LIBWANDIO_LIBS="$LIBWANDIO_LIBS -llzo2"
571        fi
572        AC_DEFINE(HAVE_LIBLZO2, 1, "Compiled with lzo2 support")
573        with_lzo=yes],
574
575       
576        [AS_IF([test "x$with_lzo" = "xyes"],
577                [AC_MSG_ERROR([lzo requested but not found])])
578        AC_DEFINE(HAVE_LIBLZO2, 0, "Compiled with lzo2 support")
579        with_lzo=no]
580)
581
582AC_ARG_WITH([lzma],
583        AC_HELP_STRING([--with-lzma], [build with support for lzma compressed files]))
584
585AS_IF([test "x$with_lzma" != "xno"],
586        [
587        AC_CHECK_LIB(lzma, lzma_code, have_lzma=yes, have_lzma=no)
588        ], [have_lzma=no])
589
590AS_IF([test "x$have_lzma" = "xyes"], [
591        if test "$ac_cv_lib_lzma_code" != "none required"; then
592                LIBWANDIO_LIBS="$LIBWANDIO_LIBS -llzma"
593        fi
594        AC_DEFINE(HAVE_LIBLZMA, 1, "Compiled with lzma support")
595        with_lzma=yes],
596
597       
598        [AS_IF([test "x$with_lzma" = "xyes"],
599                [AC_MSG_ERROR([lzma requested but not found])])
600        AC_DEFINE(HAVE_LIBLZMA, 0, "Compiled with lzma support")
601        with_lzma=no]
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"])
617AM_CONDITIONAL([HAVE_LZMA], [ test "x$with_lzma" != "xno"])
618
619# Check for miscellaneous programs
620AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
621
622AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
623
624# Set all our output variables
625AC_SUBST([LIBTRACE_LIBS])
626AC_SUBST([LIBPKTDUMP_LIBS])
627AC_SUBST([LIBWANDIO_LIBS])
628AC_SUBST([TOOLS_LIBS])
629#AC_SUBST([ADD_LIBS])
630AC_SUBST([ADD_LDFLAGS])
631AC_SUBST([ADD_INCLS])
632AC_SUBST([LTLIBOBJS])
633AC_SUBST([MANPAGES])
634AC_SUBST([PACKAGE_VERSION])
635AC_SUBST([LIBTRACE_MAJOR])
636AC_SUBST([LIBTRACE_MID])
637AC_SUBST([LIBTRACE_MINOR])
638AC_SUBST([DAG_VERSION_NUM])
639AC_SUBST([HAVE_BPF_CAPTURE])
640AC_SUBST([HAVE_LIBGDC])
641AC_SUBST([HAVE_LLVM])
642AC_SUBST([HAVE_NCURSES])
643AC_SUBST([LIBCFLAGS])
644AC_SUBST([LIBCXXFLAGS])
645
646
647# Finally, output our Makefiles
648AC_OUTPUT
649
650# Function for reporting whether an option was set or not
651reportopt() {
652        if test x"$2" = xtrue -o x"$2" = xyes; then
653                AC_MSG_NOTICE([$1: Yes])
654        else
655                AC_MSG_NOTICE([$1: No])
656        fi
657}
658
659
660# Report which configure options were set
661echo
662AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
663if test "$pcapcreate" = 1; then
664        AC_MSG_NOTICE([Compiled with PCAP support: >= 1.0])
665else
666        AC_MSG_NOTICE([Compiled with PCAP support: < 1.0])
667fi
668
669reportopt "Compiled with compressed trace (zlib) support" $with_zlib
670reportopt "Compiled with compressed trace (bz2) support" $with_bzip2
671reportopt "Compiled with compressed trace (lzo write only) support" $with_lzo
672reportopt "Compiled with compressed trace (lzma) support" $with_lzma
673if test x"$libtrace_dag" = xtrue; then
674        if test "$libtrace_dag_version" = 24; then
675                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.4])
676        elif test "$libtrace_dag_version" = 30; then
677                AC_MSG_NOTICE([Compiled with DAG live capture support: 3.0])
678        else
679                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.5])
680        fi     
681else
682        AC_MSG_NOTICE([Compiled with DAG live capture support: No])
683fi
684
685if test x"$libtrace_dpdk" = xtrue; then
686    AC_MSG_NOTICE([Compiled with DPDK live capture support: Yes])
687elif test x"$want_dpdk" != "xno"; then
688#   We don't officially support DPDK so only report failure if the user
689#   explicitly asked for DPDK. That way, we can hopefully keep it hidden
690#   from most users for now...
691       
692    AC_MSG_NOTICE([Compiled with DPDK live capture support: No])
693    AC_MSG_NOTICE([Note: Requires DPDK v1.5 or newer])
694fi
695reportopt "Compiled with LLVM BPF JIT support" $JIT
696reportopt "Building man pages/documentation" $libtrace_doxygen
697reportopt "Building tracetop (requires libncurses)" $with_ncurses
698
699# Report any errors relating to missing bison, flex, etc.
700echo
701ac_cv_errcount=0;
702if test -z "$YACC"; then
703        AC_MSG_WARN(bison or yacc not found. Please install bison before continuing)
704        ac_cv_errcount=$((ac_cv_errcount + 1))
705fi
706
707if test "x$LEX" != xflex -a "x$LEX" != xlex; then
708        AC_MSG_WARN(flex or lex not found. Please install flex before continuing)
709        ac_cv_errcount=$((ac_cv_errcount + 1))
710fi
711
712if test $ac_cv_errcount -gt 0; then
713        AC_MSG_ERROR(Critical packages are missing and compilation will fail. Please install the packages listed above and rerun ./configure)
714fi
715
Note: See TracBrowser for help on using the repository browser.