source: configure.in @ 9a0e118

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivelibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 9a0e118 was 67dc06e, checked in by Shane Alcock <salcock@…>, 5 years ago

Add configure check for libcrypto

traceanon is going to use libcrypto to do the AES operations, so we need
to be able to check if it is available.

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