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@…>, 7 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
RevLine 
[dcc1343]1# Process this file with autoconf to produce a configure script.
[144fc8d]2
[e5f1431]3# Now you only need to update the version number in two places - below,
4# and in the README
5
[fbd4ba6]6AC_INIT([libtrace],[3.0.19],[contact@wand.net.nz],[libtrace])
[e5f1431]7
[14d8a63]8LIBTRACE_MAJOR=3
[144fc8d]9LIBTRACE_MID=0
[fbd4ba6]10LIBTRACE_MINOR=19
[144fc8d]11
[7aebb85]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
[c86384c]15if test -d "/usr/gnu/lib"; then
16        LDFLAGS+=" -L/usr/gnu/lib"
17fi
[7aebb85]18
[099c35e]19AC_CONFIG_MACRO_DIR([m4])
[3085992]20AC_CONFIG_SRCDIR(lib/trace.c)
[e5f1431]21AM_INIT_AUTOMAKE
[c11c3ce]22
23# Make sure we use the relatively silent automake output
[6e565d9]24m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
[e5f1431]25
[c11c3ce]26# Define our libtrace version number externally so we can use it in the source
27# as well, if needed.
[e5f1431]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])
[14e60c60]31
[c11c3ce]32# These are all the files we want to be built for us by configure
[e5f1431]33AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile
[83f2cbf]34        tools/Makefile tools/traceanon/Makefile tools/tracepktdump/Makefile
[896ad39]35        tools/tracemerge/Makefile tools/tracereport/Makefile
36        tools/tracertstats/Makefile tools/tracesplit/Makefile
[a6da077]37        tools/tracestats/Makefile tools/tracetop/Makefile
[7da2676]38        tools/tracereplay/Makefile tools/tracediff/Makefile
[c29a0e0]39        tools/traceends/Makefile
[6187a46]40        examples/Makefile examples/skeleton/Makefile examples/rate/Makefile
[8835f5a]41        examples/stats/Makefile examples/tutorial/Makefile
[47de0aa]42        docs/libtrace.doxygen
[60f3c4c]43        lib/libtrace.h libwandio/Makefile
[d5a27e8]44        ])
[c11c3ce]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 :(
[3085992]51
[ba2263a]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
[c11c3ce]63# Put all our automake definitions in config.h
[755e794]64AM_CONFIG_HEADER([config.h])
[c11c3ce]65
66# Checks for C and C++ compilers
[14e60c60]67AC_PROG_CC
[a3505a8]68AC_PROG_CXX
[ba2263a]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
[c11c3ce]75# Checking for 'install'
[14e60c60]76AC_PROG_INSTALL
[c11c3ce]77
78# Checking for bison and flex
[66cf27f]79AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc)
[22ce0d5]80AM_PROG_LEX
[14e60c60]81
[c11c3ce]82# All our source files for function replacements are in lib/
[61ecfb6]83AC_CONFIG_LIBOBJ_DIR(lib)
[14e60c60]84
[c11c3ce]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
[5540efc]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
[9589941]101LIBPKTDUMP_LIBS="-ltrace "
[60f3c4c]102ADD_LDFLAGS="$ADD_LDFLAGS -L\$(abs_top_srcdir)/libwandio -L\$(abs_top_srcdir)/lib"
103LIBTRACE_LIBS="-lwandio"
[9589941]104TOOLS_LIBS=""
[60f3c4c]105LIBWANDIO_LIBS=""
[9589941]106
[c11c3ce]107# Set our C compiler flags based on the gcc version
[470afa7]108if test "$GCC" = "yes"; then
[97fcf28]109       
[12e6a39]110        gcc_version=`$CC -dumpversion`
[97fcf28]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
[2bef800]119        major=$(echo $gcc_version | cut -d'.' -f1)
120
121        #major=${gcc_version%\.*\.*}
[97fcf28]122
123        if test "$major" -lt 4; then
124                vis=no
125        else
126                vis=yes
127        fi
128       
[c01d813]129        CFLAGS="$CFLAGS -Wall -Wmissing-prototypes"
130        CXXFLAGS="$CXXFLAGS -Wall"
[f1ab057]131        LIBCFLAGS="$CFLAGS"
132        LIBCFLAGS="$LIBCFLAGS -DLT_BUILDING_DLL=1"
[d48008d]133        LIBCXXFLAGS="$CXXFLAGS"
134        LIBCXXFLAGS="$CXXFLAGS -DLT_BUILDING_DLL=1"
[97fcf28]135       
136        if test "$vis" = "yes"; then
[ba2263a]137                LIBCFLAGS="$LIBCFLAGS -Wextra -fvisibility=hidden"
138                LIBCXXFLAGS="$CXXFLAGS -Wextra -fvisibility=hidden"
[97fcf28]139        fi
[470afa7]140fi
141
[c11c3ce]142# Check for libtool
[47de0aa]143AC_PROG_LIBTOOL
[858f07f]144
[5540efc]145# Checks for library functions.
146AC_PROG_GCC_TRADITIONAL
[c11c3ce]147
148# Fail if any of these functions are missing
[b06d126]149AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf vsnprintf)
[5540efc]150
[41b53c2]151AC_CHECK_SIZEOF([long int])
152
[fe3d755]153
[dcc1343]154# Checks for header files.
[14e60c60]155AC_HEADER_STDC
[441f34d]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)
[808a478]157
[c11c3ce]158
159# OpenSolaris puts ncurses.h in /usr/include/ncurses rather than /usr/include,
160# so check for that
[11754a6]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
[c11c3ce]170# Check for the presence of various networking headers and define appropriate
171# macros
[808a478]172AC_CHECK_HEADERS(netinet/in.h)
[e5c2bc4]173AC_CHECK_HEADERS(netpacket/packet.h,[
174        libtrace_netpacket_packet_h=true
175        AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net])
176])
[808a478]177AC_CHECK_HEADER(net/if.h,
[e5c2bc4]178        AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[
179 #include <sys/types.h>
[808a478]180 #include <sys/socket.h>
181])
182
[41b53c2]183AC_CHECK_HEADER(netinet/ether.h,
[e5c2bc4]184        AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[
[41b53c2]185 #include <sys/types.h>
186 #include <sys/socket.h>
187 #include <netinet/in.h>
188 #include <net/if.h>
189])
190
[808a478]191AC_CHECK_HEADER(netinet/if_ether.h,
[e5c2bc4]192        AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[
[808a478]193 #include <sys/types.h>
194 #include <sys/socket.h>
195 #include <netinet/in.h>
196 #include <net/if.h>
197])
198
[e5c2bc4]199AC_CHECK_HEADER(net/if_arp.h,
200        AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[
[808a478]201 #include <sys/types.h>
202 #include <sys/socket.h>
203 #include <netinet/in.h>
204 #include <net/if.h>
205])
206
[c11c3ce]207# Check for sdl_len in sockaddr_dl - sockaddr_dl is used on BSD systems
[4bbe9bd]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
[dcc1343]217# Checking for the right bpf header to include
[e5c2bc4]218AC_CHECK_HEADER(pcap-bpf.h)
219AC_CHECK_HEADER(net/bpf.h)
[c11c3ce]220
221# Checking for libgdc
[530bcf0]222AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h]))
[5540efc]223
[c11c3ce]224# Check for libpcap
[544c680]225AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0)
[c0506ea]226AC_CHECK_LIB(pcap,pcap_create,pcapcreate=1,pcapcreate=0)
[755e794]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])
[14e60c60]233
[c11c3ce]234# Configure options for man pages
[da17570]235AC_ARG_WITH(man,
[01bc623]236            AS_HELP_STRING(--with-man,install man pages by default),[
[da17570]237             if test "$withval" = yes
238             then
[4362100]239                     MANPAGES="docs/man/man3/[a-zA-Z]*.3"
[da17570]240             else
241                     MANPAGES=""
242             fi
[01bc623]243])
[97eadcc]244
[c11c3ce]245# Complain if we didn't find a suitable libpcap
[544c680]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
[9589941]249        TOOL_LIBS="$TOOL_LIBS -lpcap"
250        LIBTRACE_LIBS="$LIBTRACE_LIBS -lpcap"
[d5a27e8]251        AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support])
[1c68a81]252        AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support])
[d11be03]253
[a8c3d1d]254        LIBS="-lpcap"
[d11be03]255        AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
256        LIBS=""
257
[544c680]258fi
259
[c0506ea]260if test "$pcapcreate" = 1; then
261        AC_DEFINE([HAVE_PCAP_CREATE],1,[compile with libpcap 1.0 support])
262fi
263
[c11c3ce]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
[4fd12ac]269AC_ARG_WITH(dag,
[b282cf8]270            AS_HELP_STRING(--with-dag[=DIR],include DAG live capture support (located in directory DIR, if supplied)),
[4fd12ac]271[
272        if test "$withval" = no
273        then
274                want_dag=no
275        elif test "$withval" = yes
276        then
277                want_dag=yes
[df3bd99]278                dag_root=/usr/local/dag
[4fd12ac]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
[df3bd99]288        dag_root=/usr/local/dag
[4fd12ac]289])
290
[52656ed]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
[437d002]298libtrace_dag=false
[52656ed]299libtrace_dag_version=none
300
[4fd12ac]301if test "$with_dag" != no; then
[52656ed]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"
[9589941]305                LIBTRACE_LIBS="$LIBTRACE_LIBS -ldag"
[b282cf8]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])
[52656ed]308                libtrace_dag=true
309               
[db32a56]310                AC_DEFINE(DAG_VERSION,25,[defines the DAG driver version])
311                libtrace_dag_version=25
[52656ed]312        fi
313fi
314
[c11c3ce]315# TODO: turn the test part of the next block into a function, so it can be
[52656ed]316# called multiple times for $dag_root, /root/dag, /usr/local/lib
[d8ed7e2]317dag_drv_v="DAG not present"
[52656ed]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
[5798dc6]321        AC_MSG_CHECKING(whether we have DAG 2.4 API instead)
[4fd12ac]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
[9f15cd1]328       
[e502f76]329        if test -r "$dag_root/include"; then
[dfc2673]330                dag_tools_dir="$dag_root/tools"
[4fd12ac]331                dag_include_dir="$dag_root/include"
332        else
333                dag_tools_dir="$dag_root"
334                dag_include_dir="$dag_root"
[e502f76]335        fi
[4fd12ac]336
337        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
[dcc1343]338        then
[4fd12ac]339                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
340                ADD_LIBS="$ADD_LIBS -ldag"
341                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
[caa8f99]342                DAG_TOOLS_DIR=$dag_tools_dir
343                AC_SUBST([DAG_TOOLS_DIR])
[437d002]344                libtrace_dag=true
[80a6589]345               
[b282cf8]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])
[52656ed]348                AC_DEFINE(DAG_VERSION, 24, [defines the DAG driver version])
349                libtrace_dag_version=24
[4fd12ac]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
[437d002]355                libtrace_dag=false
[4fd12ac]356        fi
[437d002]357        AC_MSG_RESULT($libtrace_dag)
[0fd4ad6]358
[4fd12ac]359fi
[52656ed]360
[d8ed7e2]361# Try to determine the DAG driver version
[c11c3ce]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
[d8ed7e2]377
[c04929c]378# Check for DPDK
379AC_ARG_WITH(dpdk,
[2bef800]380            AS_HELP_STRING(--with-dpdk,include DPDK live capture support (Must set RTE_SDK/_TARGET environment variable)),
[c04929c]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
[2bef800]390        want_dpdk=no
[c04929c]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/"
[2138553]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)
[c04929c]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])
[2138553]410        # Force dpdk library to be statically linked to allow compiler optimisations
411        LIBTRACE_LIBS="$LIBTRACE_LIBS -l:libintel_dpdk.a"
[c04929c]412                AC_DEFINE(HAVE_DPDK,1,[conditional for building with DPDK live capture support])
413                libtrace_dpdk=true
414        fi
415fi
[d8ed7e2]416
[c11c3ce]417# Checks for various "optional" libraries
[9589941]418AC_CHECK_LIB(pthread, pthread_create, have_pthread=1, have_pthread=0)
[c11c3ce]419
420# Check for ncurses
421
422# These libraries have to be explicitly linked in OpenSolaris
[9902272]423AC_SEARCH_LIBS(getservent, socket, have_socket=1, have_socket=0, -lnsl)
[9589941]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
[c04929c]433# Check for clock_gettime
434AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=1, have_clock_gettime=0)
435LIBS=
436
[9589941]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
[60f3c4c]446        LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lpthread"
[9589941]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
[2138553]465
466if test "$have_clock_gettime" = 1; then
[c04929c]467    LIBTRACE_LIBS="$LIBTRACE_LIBS -lrt"
468fi
469
[9589941]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
[7b29593]475# For now, the user has to explicitly ask for the LLVM stuff, as it's a bit
476# rough around the edges :(
[d48008d]477AC_ARG_WITH([llvm],
478        [AC_HELP_STRING([--with-llvm],
479                [support Just In Time compiler])],
480        use_llvm="yes",
[7b29593]481        use_llvm="no")
482JIT=no
[d48008d]483
[c11c3ce]484# Search for LLVM and the libraries that it requires
[d48008d]485if (test "$use_llvm" != "no"); then
486        AC_PATH_PROG(LLVM_CONFIG, llvm-config, no)
[7b29593]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
[d48008d]504                AC_MSG_NOTICE([Unable to find llvm-config.  JIT support disabled.])
505                JIT=no
[7b29593]506        elif test "$LLVM_GCC" = "no"; then
507                AC_MSG_NOTICE([Unable to find llvm-gcc.  JIT support disabled.])
508                JIT=no
[d48008d]509        else
510                LIBCXXFLAGS="`$LLVM_CONFIG --cxxflags` $CXXFLAGS"
[9589941]511                LIBTRACE_LIBS="$LIBRACE_LIBS `$LLVM_CONFIG --libs all`";
[d48008d]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
[9902272]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
[00d49b6]530        AC_DEFINE(HAVE_NCURSES, 1, "Compiled with ncurses support")
[9902272]531        with_ncurses=yes],
532
533       
534        [AS_IF([test "x$with_ncurses" = "xyes"],
535                [AC_MSG_ERROR([ncurses requested but not found])])
[00d49b6]536        AC_DEFINE(HAVE_NCURSES, 0, "Compiled with ncurses support")
[9902272]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
[60f3c4c]550                LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lbz2"
[9902272]551        fi
[00d49b6]552        with_bzip2=yes
553        AC_DEFINE(HAVE_LIBBZ2, 1, "Compiled with bzip2 support")],
[9902272]554       
555        [AS_IF([test "x$with_bzip2" = "xyes"],
556                [AC_MSG_ERROR([bzip2 requested but not found])])
[00d49b6]557        AC_DEFINE(HAVE_LIBBZ2, 0, "Compiled with bzip2 support")
[9902272]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
[60f3c4c]571                LIBWANDIO_LIBS="$LIBWANDIO_LIBS -lz"
[9902272]572        fi
[00d49b6]573        AC_DEFINE(HAVE_LIBZ, 1, "Compiled with zlib support")
[9902272]574        with_zlib=yes],
575
576       
577        [AS_IF([test "x$with_zlib" = "xyes"],
578                [AC_MSG_ERROR([zlib requested but not found])])
[00d49b6]579        AC_DEFINE(HAVE_LIBZ, 0, "Compiled with zlib support")
[9902272]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        [
[00d49b6]588        AC_CHECK_LIB(lzo2, lzo1x_1_compress, have_lzo=yes, have_lzo=no)
[9902272]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
[60f3c4c]593                LIBWANDIO_LIBS="$LIBWANDIO_LIBS -llzo2"
[9902272]594        fi
[00d49b6]595        AC_DEFINE(HAVE_LIBLZO2, 1, "Compiled with lzo2 support")
[9902272]596        with_lzo=yes],
597
598       
599        [AS_IF([test "x$with_lzo" = "xyes"],
600                [AC_MSG_ERROR([lzo requested but not found])])
[00d49b6]601        AC_DEFINE(HAVE_LIBLZO2, 0, "Compiled with lzo2 support")
[9902272]602        with_lzo=no]
603)
604
[d48008d]605
[c11c3ce]606# Define automake conditionals for use in our Makefile.am files
[1c68a81]607AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
[4a605a9]608AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
[c04929c]609AM_CONDITIONAL([HAVE_DPDK], [test "$libtrace_dpdk" = true])
[52656ed]610AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24])
611AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25])
[7b2a39b]612AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
[530bcf0]613AM_CONDITIONAL([HAVE_LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
[7b29593]614AM_CONDITIONAL([HAVE_LLVM], [test "x$JIT" != "xno" ])
[00d49b6]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"])
[4a605a9]619
620# Check for miscellaneous programs
621AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
622
623AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
[dcc1343]624
[c11c3ce]625# Set all our output variables
[9589941]626AC_SUBST([LIBTRACE_LIBS])
627AC_SUBST([LIBPKTDUMP_LIBS])
[60f3c4c]628AC_SUBST([LIBWANDIO_LIBS])
[9589941]629AC_SUBST([TOOLS_LIBS])
630#AC_SUBST([ADD_LIBS])
[4fd12ac]631AC_SUBST([ADD_LDFLAGS])
632AC_SUBST([ADD_INCLS])
[be40c18]633AC_SUBST([LTLIBOBJS])
[da17570]634AC_SUBST([MANPAGES])
[e5f1431]635AC_SUBST([PACKAGE_VERSION])
636AC_SUBST([LIBTRACE_MAJOR])
637AC_SUBST([LIBTRACE_MID])
638AC_SUBST([LIBTRACE_MINOR])
[0fd4ad6]639AC_SUBST([DAG_VERSION_NUM])
[1c68a81]640AC_SUBST([HAVE_BPF_CAPTURE])
[530bcf0]641AC_SUBST([HAVE_LIBGDC])
[d48008d]642AC_SUBST([HAVE_LLVM])
[a1e177d]643AC_SUBST([HAVE_NCURSES])
[f1ab057]644AC_SUBST([LIBCFLAGS])
[d48008d]645AC_SUBST([LIBCXXFLAGS])
[c11c3ce]646
647
648# Finally, output our Makefiles
[6659ffb]649AC_OUTPUT
[437d002]650
[c11c3ce]651# Function for reporting whether an option was set or not
[41b53c2]652reportopt() {
[ba0017c]653        if test x"$2" = xtrue -o x"$2" = xyes; then
[437d002]654                AC_MSG_NOTICE([$1: Yes])
655        else
656                AC_MSG_NOTICE([$1: No])
657        fi
658}
659
[c11c3ce]660
661# Report which configure options were set
[306f91c]662echo
[e5f1431]663AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
[c0506ea]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
[9902272]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
[01b2922]673if test x"$libtrace_dag" = xtrue; then
[52656ed]674        if test "$libtrace_dag_version" = 24; then
[b282cf8]675                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.4])
[52656ed]676        elif test "$libtrace_dag_version" = 30; then
[b282cf8]677                AC_MSG_NOTICE([Compiled with DAG live capture support: 3.0])
[01b2922]678        else
[b282cf8]679                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.5])
[52656ed]680        fi     
[01b2922]681else
[b282cf8]682        AC_MSG_NOTICE([Compiled with DAG live capture support: No])
[01b2922]683fi
[c04929c]684
685if test x"$libtrace_dpdk" = xtrue; then
686    AC_MSG_NOTICE([Compiled with DPDK live capture support: Yes])
[2bef800]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])
[c04929c]694fi
[d48008d]695reportopt "Compiled with LLVM BPF JIT support" $JIT
[437d002]696reportopt "Building man pages/documentation" $libtrace_doxygen
[9902272]697reportopt "Building tracetop (requires libncurses)" $with_ncurses
[437d002]698
[c11c3ce]699# Report any errors relating to missing bison, flex, etc.
[66cf27f]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
[a0ec6f1]707if test "x$LEX" != xflex -a "x$LEX" != xlex; then
[66cf27f]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.