source: configure.in @ 4007dbb

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

Updates the new interface to be more complete

This should work around any issues with systems without thread support.
This still remains compatible with existing code.
Examples/tools/tests still need to be updated to make use of the new interface.
And tests also need to be updated.
Adds debug memory stats as an option to configure.

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