source: configure.in @ 4631115

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

Merge branch 'master' into develop.

Update to include fixes/features etc from the 3.0.22 release.

Conflicts:

README
lib/format_dag25.c
lib/format_dpdk.c
lib/format_linux.c
lib/trace.c
test/Makefile

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