source: configure.in @ 12e6a39

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 12e6a39 was 12e6a39, checked in by Alistair King <alistair@…>, 6 years ago

Fix hard-coded call to gcc in GCC version check

FreeBSD 10 does not have gcc by default, but the clang compiler does support GCC
features. Replaced the hard-coded gcc command with $CC.
Tested on FreeBSD 10, Ubuntu 12.04.4 and Mac OSX 10.9.3

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