source: configure.in @ b663d33

cachetimestampsdevelopetsiliverc-4.0.4ringdecrementfixringperformance
Last change on this file since b663d33 was b663d33, checked in by Shane Alcock <salcock@…>, 2 years ago

etsilive format is now functional (for single-threaded only).

Packets are decoded using libwandder. The ETSI headers are treated
as a meta-data layer.

Libpacketdump support has also been added for all fields and
structures that libwandder understands.

  • Property mode set to 100644
File size: 22.8 KB
Line 
1# Process this file with autoconf to produce a configure script.
2
3# Now you only need to update the version number in two places - below,
4# and in the README
5
6AC_INIT([libtrace],[4.0.3],[contact@wand.net.nz],[libtrace])
7
8LIBTRACE_MAJOR=4
9LIBTRACE_MID=0
10LIBTRACE_MINOR=3
11
12# OpenSolaris hides libraries like libncurses in /usr/gnu/lib, which is not
13# searched by default - add it to LDFLAGS so we at least have a chance of
14# finding it
15if test -d "/usr/gnu/lib"; then
16        LDFLAGS+=" -L/usr/gnu/lib"
17fi
18
19AC_CONFIG_MACRO_DIR([m4])
20AC_CONFIG_SRCDIR(lib/trace.c)
21AM_INIT_AUTOMAKE([subdir-objects])
22
23# Make sure we use the relatively silent automake output
24m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
25
26# Define our libtrace version number externally so we can use it in the source
27# as well, if needed.
28AC_DEFINE([LIBTRACE_MAJOR],${LIBTRACE_MAJOR},[libtrace major version])
29AC_DEFINE([LIBTRACE_MID],${LIBTRACE_MID},[libtrace mid version])
30AC_DEFINE([LIBTRACE_MINOR],${LIBTRACE_MINOR},[libtrace minor version])
31
32# These are all the files we want to be built for us by configure
33AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile
34        tools/Makefile tools/traceanon/Makefile tools/tracepktdump/Makefile
35        tools/tracemerge/Makefile tools/tracereport/Makefile
36        tools/tracertstats/Makefile tools/tracesplit/Makefile
37        tools/tracestats/Makefile tools/tracetop/Makefile
38        tools/tracereplay/Makefile tools/tracediff/Makefile
39        tools/traceends/Makefile
40        examples/Makefile examples/skeleton/Makefile examples/rate/Makefile
41        examples/stats/Makefile examples/tutorial/Makefile examples/parallel/Makefile
42        docs/libtrace.doxygen
43        lib/libtrace.h
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)/lib"
103LIBTRACE_LIBS=""
104TOOLS_LIBS=""
105
106CFLAGS="$CFLAGS -Wall -Wmissing-prototypes -Wextra -DLT_BUILDING_DLL=1"
107CXXFLAGS="$CXXFLAGS -Wall -DLT_BUILDING_DLL=1"
108
109# Check for -fvisibility
110gl_VISIBILITY
111
112gcc_PACKED
113gcc_DEPRECATED
114gcc_UNUSED
115gcc_PURE
116gcc_FORMAT
117
118# Check for gcc style TLS (__thread)
119gcc_TLS
120       
121# Check for libtool
122AC_PROG_LIBTOOL
123
124# Checks for library functions.
125AC_PROG_GCC_TRADITIONAL
126
127# Fail if any of these functions are missing
128AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf vsnprintf recvmmsg)
129
130AC_CHECK_SIZEOF([long int])
131
132
133# Checks for header files.
134AC_HEADER_STDC
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)
136
137
138# OpenSolaris puts ncurses.h in /usr/include/ncurses rather than /usr/include,
139# so check for that
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
149# Check for the presence of various networking headers and define appropriate
150# macros
151AC_CHECK_HEADERS(netinet/in.h)
152AC_CHECK_HEADERS(netpacket/packet.h,[
153        libtrace_netpacket_packet_h=true
154        AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net])
155])
156AC_CHECK_HEADER(net/if.h,
157        AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[
158 #include <sys/types.h>
159 #include <sys/socket.h>
160])
161
162AC_CHECK_HEADER(netinet/ether.h,
163        AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[
164 #include <sys/types.h>
165 #include <sys/socket.h>
166 #include <netinet/in.h>
167 #include <net/if.h>
168])
169
170AC_CHECK_HEADER(netinet/if_ether.h,
171        AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[
172 #include <sys/types.h>
173 #include <sys/socket.h>
174 #include <netinet/in.h>
175 #include <net/if.h>
176])
177
178AC_CHECK_HEADER(net/if_arp.h,
179        AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[
180 #include <sys/types.h>
181 #include <sys/socket.h>
182 #include <netinet/in.h>
183 #include <net/if.h>
184])
185
186# Check for sdl_len in sockaddr_dl - sockaddr_dl is used on BSD systems
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
196# Checking for the right bpf header to include
197AC_CHECK_HEADER(pcap-bpf.h)
198AC_CHECK_HEADER(net/bpf.h)
199
200# Checking for libgdc
201AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h]))
202
203# Check for libwandio (no longer bundled with libtrace)
204AC_CHECK_LIB(wandio,wandio_create,wandiofound=1,wandiofound=0)
205if test "$wandiofound" = 0; then
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)
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
213AC_CHECK_LIB(crypto, EVP_EncryptInit_ex, cryptofound=1, cryptofound=0)
214if test "$cryptofound" = 1; then
215        AC_CHECK_HEADER(openssl/evp.h, cryptofound=1, cryptofound=0)
216fi
217AC_CHECK_LIB(tasn1, asn1_array2tree, asn1found=1, asn1found=0)
218
219# Check for libpcap
220AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0)
221AC_CHECK_LIB(pcap,pcap_create,pcapcreate=1,pcapcreate=0)
222AC_CHECK_LIB(pcap,pcap_set_immediate_mode,pcapimmediate=1,pcapimmediate=0)
223AC_CHECK_DECLS([BIOCSETIF],,,[
224#include <sys/types.h>
225#include <sys/time.h>
226#include <sys/ioctl.h>
227#include <net/bpf.h>
228])
229
230AC_ARG_ENABLE(memory-debugging,
231                AS_HELP_STRING(--enable-memory-debugging, prints internal memory statistics),[
232                if test "$HAVE_TLS" = 1
233                then
234                    AC_DEFINE([ENABLE_MEM_STATS], 1, [print debug memory statistics])
235                fi
236],[])
237
238# Configure options for man pages
239AC_ARG_WITH(man,
240            AS_HELP_STRING(--with-man,install man pages by default),[
241             if test "$withval" = yes
242             then
243                     MANPAGES="docs/man/man3/[a-zA-Z]*.3"
244             else
245                     MANPAGES=""
246             fi
247])
248
249# Complain if we didn't find a suitable libpcap
250if test "$pcapfound" = 0; then
251        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)
252else
253        TOOLS_LIBS="$TOOLS_LIBS -lpcap"
254        LIBTRACE_LIBS="$LIBTRACE_LIBS -lpcap"
255        AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support])
256
257        LIBS="-lpcap"
258        AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
259        LIBS=""
260
261fi
262
263if test "$pcapcreate" = 1; then
264        AC_DEFINE([HAVE_PCAP_CREATE],1,[compile with libpcap 1.0 support])
265fi
266
267if test "$pcapimmediate" = 1; then
268        AC_DEFINE([HAVE_PCAP_IMMEDIATE],1,[able to use pcap_set_immediate_mode])
269fi       
270
271# Configure options for use of DAG cards
272# Originally borrowed from libpcap, but extended quite a bit :)
273# More details on how this check works:
274#       http://wand.net.nz/trac/libtrace/wiki/DAGNotes
275
276AC_ARG_WITH(dag,
277            AS_HELP_STRING(--with-dag[=DIR],include DAG live capture support (located in directory DIR, if supplied)),
278[
279        if test "$withval" = no
280        then
281                want_dag=no
282        elif test "$withval" = yes
283        then
284                want_dag=yes
285                dag_root=/usr/local/dag
286        else
287                want_dag=yes
288                dag_root=$withval
289        fi
290],[
291        #
292        # Use DAG API if present, otherwise don't
293        #
294        want_dag=ifpresent
295        dag_root=/usr/local/dag
296])
297
298# DAG 3.0 actually puts header files and shared libraries into sensible
299# places now, so we should be able to do a simple CHECK_LIB to see if
300# they're there!
301
302# Addendum: It turns out DAG 2.5 does this too, so we'll match DAG2.5 in here
303# also. This isn't such a bad thing, the DAG2.5 API is essentially the same as
304# DAG 3.0 and libtrace will use the same format_dagXX source for both
305libtrace_dag=false
306libtrace_dag_version=none
307
308if test "$with_dag" != no; then
309        AC_CHECK_LIB(dag, dag_open, dag_found=1, dag_found=0)
310        if test "$dag_found" = 1; then
311                ADD_LIBS="$ADD_LIBS -ldag"
312                LIBTRACE_LIBS="$LIBTRACE_LIBS -ldag"
313                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
314                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
315                libtrace_dag=true
316               
317                AC_DEFINE(DAG_VERSION,25,[defines the DAG driver version])
318                libtrace_dag_version=25
319
320                AC_CHECK_HEADERS(dag_config_api.h,[csapi_found=1],,)
321                if test "$csapi_found" = 1; then
322                        LIBTRACE_LIBS="$LIBTRACE_LIBS -ldagconf"
323                fi
324        fi     
325fi
326
327# TODO: turn the test part of the next block into a function, so it can be
328# called multiple times for $dag_root, /root/dag, /usr/local/lib
329dag_drv_v="DAG not present"
330
331# Now check for 2.4 DAG drivers which don't install as cleanly!
332if test "$with_dag" != no -a "$libtrace_dag" = false; then
333        AC_MSG_CHECKING(whether we have DAG 2.4 API instead)
334
335        if test -r "$dag_root/lib"; then
336                dag_lib_dir="$dag_root/lib"
337        else
338                dag_lib_dir="$dag_root"
339        fi
340       
341        if test -r "$dag_root/include"; then
342                dag_tools_dir="$dag_root/tools"
343                dag_include_dir="$dag_root/include"
344        else
345                dag_tools_dir="$dag_root"
346                dag_include_dir="$dag_root"
347        fi
348
349        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
350        then
351                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
352                ADD_LIBS="$ADD_LIBS -ldag"
353                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
354                DAG_TOOLS_DIR=$dag_tools_dir
355                AC_SUBST([DAG_TOOLS_DIR])
356                libtrace_dag=true
357               
358                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
359                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
360                AC_DEFINE(DAG_VERSION, 24, [defines the DAG driver version])
361                libtrace_dag_version=24
362        else
363                if test "$want_dag" = yes; then
364                        AC_MSG_ERROR(DAG API not found under directory $dag_root
365; use --without-dag)
366                fi
367                libtrace_dag=false
368        fi
369        AC_MSG_RESULT($libtrace_dag)
370
371fi
372
373# Try to determine the DAG driver version
374#if test x"$libtrace_dag" = xtrue; then
375#       dag_drv_v="Unknown"
376#       files=`locate /usr/*dag*/VERSION`
377#       file_count=0
378#
379#       for i in $files; do
380#                if $file_count > 0; then
381#                        dag_drv_v="Indeterminate"
382#                        break
383#                fi
384#                dag_drv_v=`cat $i`
385#                file_count=$file_count+1
386#        done
387#fi
388#DAG_VERSION_NUM=$dag_drv_v
389
390# Check for DPDK
391AC_ARG_WITH(dpdk,
392            AS_HELP_STRING(--with-dpdk,include DPDK live capture support (From either the RTE_SDK/_TARGET environment variable or the dpdk-dev package)),
393[
394        if test "$withval" = no
395        then
396            want_dpdk=no
397        else
398            want_dpdk=ifpresent
399        fi
400],[
401        # Default to building without DPDK format
402        want_dpdk=no
403])
404
405libtrace_dpdk=false
406if test "$want_dpdk" != no; then
407        # So instead simply check for existence
408        if test "$RTE_SDK" != ""; then
409                AC_CHECK_FILE("$RTE_SDK/$RTE_TARGET/lib/libintel_dpdk.a", dpdk_found=":libintel_dpdk.a", dpdk_found=0)
410        fi
411        # DPDK 2.1.0+ renames this to libdpdk from libintel_dpdk
412        if test "$dpdk_found" = 0 -a "$RTE_SDK" != ""; then
413                AC_CHECK_FILE("$RTE_SDK/$RTE_TARGET/lib/libdpdk.a", dpdk_found=":libdpdk.a", dpdk_found=0)
414        fi
415        if test "$dpdk_found" = 0 -a "$RTE_SDK" != ""; then
416                AC_CHECK_FILE("$RTE_SDK/$RTE_TARGET/lib/libdpdk.so", dpdk_found="dpdk", dpdk_found=0)
417        fi
418        if test "$dpdk_found" != 0 -a "$RTE_SDK" != ""; then
419                # Save these now so that they can be re-exported later
420                AC_SUBST([RTE_TARGET])
421                AC_SUBST([RTE_SDK])
422                # Force dpdk library to be statically linked to allow compiler optimisations
423                LIBTRACE_LIBS="$LIBTRACE_LIBS -Wl,--whole-archive -Wl,-l$dpdk_found -Wl,--no-whole-archive -Wl,-lm"
424                AC_DEFINE(HAVE_DPDK,1,[conditional for building with DPDK live capture support])
425                libtrace_dpdk=true
426        fi
427        if test "$RTE_SDK" = ""; then
428                AC_MSG_NOTICE([No RTE_SDK given, checking for system dpdk-dev package])
429                # Search the system, maybe it is installed? Ethdev is one of the main libraries
430                AC_CHECK_LIB(ethdev, rte_eth_dev_configure, dpdk_found="system", dpdk_found=0)
431                # We also need to check that rte.vars.mk is installed from dpdk-dev (as well as libdpdk-dev)
432                if test "$dpdk_found" != 0 -a -e /usr/share/dpdk/mk/rte.vars.mk ; then
433                        RTE_TARGET="x86_64-default-linuxapp-gcc"
434                        RTE_SDK="/usr/share/dpdk/"
435                        RTE_INCLUDE="/usr/include/dpdk"
436                        AC_SUBST([RTE_TARGET])
437                        AC_SUBST([RTE_SDK])
438                        AC_SUBST([RTE_INCLUDE])
439                        # include libethdev this is part of DPDK
440                        LIBTRACE_LIBS="$LIBTRACE_LIBS -lethdev"
441                        # Include all rte libs note we need to escape '[' and ']'
442                        LIBTRACE_LIBS="$LIBTRACE_LIBS $(ldconfig -p | sed 's/.*lib\([[^.]]*\).*/-l\1/' | grep rte_ | tr '\n' ' ')"
443                        AC_MSG_NOTICE([Building against system DPDK])
444
445                        AC_DEFINE(HAVE_DPDK,1,[conditional for building with DPDK live capture support])
446                        libtrace_dpdk=true
447                fi
448        fi
449fi
450
451# Check for PACKET_FANOUT (borrowed from Suricata)
452AC_CHECK_DECL([PACKET_FANOUT],
453        AC_DEFINE([HAVE_PACKET_FANOUT],[1],
454        [Recent packet fanout support is available]),
455        [],
456        [[#include <linux/if_packet.h>]])
457
458# If we use DPDK we might be able to use libnuma
459AC_CHECK_LIB(numa, numa_node_to_cpus, have_numa=1, have_numa=0)
460
461# Need libwandder for ETSI live decoding
462AC_CHECK_LIB(wandder, init_wandder_decoder, have_wandder=1, have_wandder=0)
463
464# Checks for various "optional" libraries
465AC_CHECK_LIB(pthread, pthread_create, have_pthread=1, have_pthread=0)
466
467AC_CHECK_LIB(pthread, pthread_setname_np, have_pthread_setname_np=1, have_pthread_setname_np=0)
468
469# Check for ncurses
470
471# These libraries have to be explicitly linked in OpenSolaris
472AC_SEARCH_LIBS(getservent, socket, have_socket=1, have_socket=0, -lnsl)
473LIBS=
474
475AC_SEARCH_LIBS(inet_ntop, nsl, have_nsl=1, have_nsl=0, -lsocket)
476LIBS=
477
478# Check to see if we have libdl - *BSD has built-in libdl
479AC_SEARCH_LIBS(dlopen,dl, dlfound=1,dlfound=0 )
480LIBS=
481
482# Check for clock_gettime
483AC_CHECK_LIB(rt, clock_gettime, have_clock_gettime=1, have_clock_gettime=0)
484LIBS=
485
486if test "$have_numa" = 1; then
487        LIBTRACE_LIBS="$LIBTRACE_LIBS -lnuma"
488        AC_DEFINE(HAVE_LIBNUMA, 1, [Set to 1 if libnuma is supported])
489        with_numa=yes
490else
491        AC_DEFINE(HAVE_LIBNUMA, 0, [Set to 1 if libnuma is supported])
492        with_numa=no
493fi
494
495if test "$have_wandder" = 1; then
496        LIBTRACE_LIBS="$LIBTRACE_LIBS -lwandder"
497        AC_DEFINE(HAVE_WANDDER, 1, [Set to 1 if libwandder is available])
498        wandder_avail=yes
499else
500        AC_DEFINE(HAVE_WANDDER, 0, [Set to 1 if libwandder is available])
501        wandder_avail=no
502fi
503
504if test "$dlfound" = 0; then
505        AC_MSG_ERROR("Unable to find dlopen. Please use LDFLAGS to specify the location of libdl and re-run configure")
506fi
507
508if test "$ac_cv_search_dlopen" != "none required"; then
509        LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_dlopen"
510        if test "$dpdk_found" != 0; then
511                LIBTRACE_LIBS="$LIBTRACE_LIBS -Wl,$ac_cv_search_dlopen"
512        fi
513fi
514
515if test "$have_pthread" = 1; then
516        AC_DEFINE(HAVE_LIBPTHREAD, 1, [Set to 1 if pthreads are supported])
517fi
518
519if test "$have_pthread_setname_np" = 1; then
520        AC_DEFINE(HAVE_PTHREAD_SETNAME_NP, 1, [Set to 1 if pthread_setname_np is found])
521fi
522
523if test "$cryptofound" = 1; then
524        AC_DEFINE(HAVE_LIBCRYPTO, 1, [Set to 1 if libcrypto is available])
525        TOOLS_LIBS="$TOOLS_LIBS -lcrypto"
526        have_crypto=yes
527else
528        have_crypto=no
529fi
530
531if test "$have_nsl" = 1; then
532        if test "$ac_cv_search_inet_ntop" != "none required"; then
533                LIBTRACE_LIBS="$LIBTRACE_LIBS $ac_cv_search_inet_ntop"
534                LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_inet_ntop"
535        fi
536fi
537
538if test "$have_socket" = 1; then
539        if test "$ac_cv_search_getservent" != "none required"; then
540                LIBTRACE_LIBS="$LIBTRACE_LIBS $ac_cv_search_getservent"
541                LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_getservent"
542        fi
543fi
544
545
546if test "$have_clock_gettime" = 1; then
547        LIBTRACE_LIBS="$LIBTRACE_LIBS -lrt"
548        AC_DEFINE(HAVE_CLOCK_GETTIME, 1, [Set to 1 if clock_gettime is supported])
549        with_clock_gettime=yes
550else
551        AC_DEFINE(HAVE_CLOCK_GETTIME, 0, [Set to 1 if clock_gettime is supported])
552        with_clock_gettime=no
553fi
554
555
556# Stupid AC_SEARCH_LIB appends stuff to LIBS even when I don't want it to, so
557# just set libs to null here to avoid linking against them by default
558LIBS=
559
560# For now, the user has to explicitly ask for the LLVM stuff, as it's a bit
561# rough around the edges :(
562AC_ARG_WITH([llvm],
563        [AC_HELP_STRING([--with-llvm],
564                [support Just In Time compiler])],
565        use_llvm="yes",
566        use_llvm="no")
567JIT=no
568
569# Search for LLVM and the libraries that it requires
570if (test "$use_llvm" != "no"); then
571        AC_PATH_PROG(LLVM_CONFIG, llvm-config, no)
572
573        # XXX Hard coding the path is REALLY bad.
574        # llvm-gcc is installed in a stupid place in Debian / Ubuntu. Hard luck
575        # if you've installed it somewhere custom.
576        # Hopefully in future we can replace this with clang, which may or may
577        # not be installed somewhere intelligent.
578        AC_PATH_PROG(LLVM_GCC, llvm-gcc, no, /usr/lib/llvm/llvm/gcc-4.2/bin)
579
580        AC_LANG_PUSH([C++])
581        AC_CHECK_HEADERS([boost/lexical_cast.hpp], boost="yes", boost="no")
582        AC_LANG_POP([C++])
583
584               
585        if test "$boost" = "no"; then
586                AC_MSG_NOTICE([Unabled to find boost libraries.  JIT support disabled.])
587                JIT=no
588        elif test "$LLVM_CONFIG" = "no" ; then
589                AC_MSG_NOTICE([Unable to find llvm-config.  JIT support disabled.])
590                JIT=no
591        elif test "$LLVM_GCC" = "no"; then
592                AC_MSG_NOTICE([Unable to find llvm-gcc.  JIT support disabled.])
593                JIT=no
594        else
595                LIBCXXFLAGS="`$LLVM_CONFIG --cxxflags` $CXXFLAGS"
596                LIBTRACE_LIBS="$LIBRACE_LIBS `$LLVM_CONFIG --libs all`";
597                LDFLAGS="`$LLVM_CONFIG --ldflags` $LDFLAGS";
598                JIT=yes
599                AC_DEFINE(HAVE_LLVM, 1, [Set to 1 if you have LLVM installed])
600        fi
601fi
602
603AC_ARG_WITH([ncurses],
604        AC_HELP_STRING([--with-ncurses], [build tracetop (requires ncurses)]))
605
606AS_IF([test "x$with_ncurses" != "xno"],
607        [AC_SEARCH_LIBS(mvprintw, ncurses, have_ncurses=yes, have_ncurses=no)
608         LIBS=
609        ], [have_ncurses=no])
610
611AS_IF([test "x$have_ncurses" = "xyes"], [
612        if test "$ac_cv_search_mvprintw" != "none required"; then
613                TOOLS_LIBS="$TOOLS_LIBS $ac_cv_search_mvprintw"
614        fi
615        AC_DEFINE(HAVE_NCURSES, 1, "Compiled with ncurses support")
616        with_ncurses=yes],
617
618       
619        [AS_IF([test "x$with_ncurses" = "xyes"],
620                [AC_MSG_ERROR([ncurses requested but not found])])
621        AC_DEFINE(HAVE_NCURSES, 0, "Compiled with ncurses support")
622        with_ncurses=no]
623)
624
625# Define automake conditionals for use in our Makefile.am files
626AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
627AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
628AM_CONDITIONAL([HAVE_DPDK], [test "$libtrace_dpdk" = true])
629AM_CONDITIONAL([HAVE_WANDDER], [test "x$wandder_avail" = "xyes"])
630AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24])
631AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25])
632AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
633AM_CONDITIONAL([HAVE_LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
634AM_CONDITIONAL([HAVE_LLVM], [test "x$JIT" != "xno" ])
635AM_CONDITIONAL([HAVE_NCURSES], [test "x$with_ncurses" != "xno"])
636
637# Check for miscellaneous programs
638AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
639
640AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
641
642# Set all our output variables
643AC_SUBST([LIBTRACE_LIBS])
644AC_SUBST([LIBPKTDUMP_LIBS])
645AC_SUBST([TOOLS_LIBS])
646#AC_SUBST([ADD_LIBS])
647AC_SUBST([ADD_LDFLAGS])
648AC_SUBST([ADD_INCLS])
649AC_SUBST([LTLIBOBJS])
650AC_SUBST([MANPAGES])
651AC_SUBST([PACKAGE_VERSION])
652AC_SUBST([LIBTRACE_MAJOR])
653AC_SUBST([LIBTRACE_MID])
654AC_SUBST([LIBTRACE_MINOR])
655AC_SUBST([DAG_VERSION_NUM])
656AC_SUBST([HAVE_BPF_CAPTURE])
657AC_SUBST([HAVE_LIBGDC])
658AC_SUBST([HAVE_LLVM])
659AC_SUBST([HAVE_NCURSES])
660AC_SUBST([LIBCFLAGS])
661AC_SUBST([LIBCXXFLAGS])
662
663
664# Finally, output our Makefiles
665AC_OUTPUT
666
667# Function for reporting whether an option was set or not
668reportopt() {
669        if test x"$2" = xtrue -o x"$2" = xyes; then
670                AC_MSG_NOTICE([$1: Yes])
671        else
672                AC_MSG_NOTICE([$1: No])
673        fi
674}
675
676
677# Report which configure options were set
678echo
679AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
680if test "$pcapcreate" = 1; then
681        AC_MSG_NOTICE([Compiled with PCAP support: >= 1.0])
682else
683        AC_MSG_NOTICE([Compiled with PCAP support: < 1.0])
684fi
685
686if test x"$libtrace_dag" = xtrue; then
687        if test "$libtrace_dag_version" = 24; then
688                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.4])
689        elif test "$libtrace_dag_version" = 30; then
690                AC_MSG_NOTICE([Compiled with DAG live capture support: 3.0])
691        else
692                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.5])
693        fi     
694else
695        AC_MSG_NOTICE([Compiled with DAG live capture support: No])
696fi
697
698if test x"$libtrace_dpdk" = xtrue; then
699        AC_MSG_NOTICE([Compiled with DPDK live capture support: Yes])
700        reportopt "Compiled with DPDK trace NUMA support" $with_numa
701        reportopt "Compiled with clock_gettime support" $with_clock_gettime
702elif test x"$want_dpdk" != "xno"; then
703#   We don't officially support DPDK so only report failure if the user
704#   explicitly asked for DPDK. That way, we can hopefully keep it hidden
705#   from most users for now...
706
707        AC_MSG_NOTICE([Compiled with DPDK live capture support: No])
708        AC_MSG_NOTICE([Note: Requires DPDK v1.5 or newer])
709fi
710reportopt "Compiled with LLVM BPF JIT support" $JIT
711reportopt "Compiled with live ETSI LI support (requires libwandder)" $wandder_avail
712reportopt "Building man pages/documentation" $libtrace_doxygen
713reportopt "Building tracetop (requires libncurses)" $with_ncurses
714reportopt "Building traceanon with CryptoPan (requires libcrypto and openssl/evp.h)" $have_crypto
715
716# Report any errors relating to missing bison, flex, etc.
717echo
718ac_cv_errcount=0;
719if test -z "$YACC"; then
720        AC_MSG_WARN(bison or yacc not found. Please install bison before continuing)
721        ac_cv_errcount=$((ac_cv_errcount + 1))
722fi
723
724if test "x$LEX" != xflex -a "x$LEX" != xlex; then
725        AC_MSG_WARN(flex or lex not found. Please install flex before continuing)
726        ac_cv_errcount=$((ac_cv_errcount + 1))
727fi
728
729if test $ac_cv_errcount -gt 0; then
730        AC_MSG_ERROR(Critical packages are missing and compilation will fail. Please install the packages listed above and rerun ./configure)
731fi
732
Note: See TracBrowser for help on using the repository browser.