source: configure.in @ d48008d

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since d48008d was d48008d, checked in by Perry Lorier <perry@…>, 10 years ago

Add JITting of BPF bytecode using LLVM

  • Property mode set to 100644
File size: 11.5 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.7],[contact@wand.net.nz],[libtrace])
7
8LIBTRACE_MAJOR=3
9LIBTRACE_MID=0
10LIBTRACE_MINOR=7
11
12AC_CONFIG_MACRO_DIR([m4])
13AC_CONFIG_SRCDIR(lib/trace.c)
14AM_INIT_AUTOMAKE
15m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
16
17AC_DEFINE([LIBTRACE_MAJOR],${LIBTRACE_MAJOR},[libtrace major version])
18AC_DEFINE([LIBTRACE_MID],${LIBTRACE_MID},[libtrace mid version])
19AC_DEFINE([LIBTRACE_MINOR],${LIBTRACE_MINOR},[libtrace minor version])
20
21AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile
22        tools/Makefile tools/traceanon/Makefile tools/tracepktdump/Makefile
23        tools/tracemerge/Makefile tools/tracereport/Makefile
24        tools/tracertstats/Makefile tools/tracesplit/Makefile
25        tools/tracestats/Makefile tools/tracetop/Makefile
26        tools/tracereplay/Makefile tools/tracediff/Makefile
27        examples/Makefile examples/skeleton/Makefile examples/rate/Makefile
28        examples/stats/Makefile examples/tutorial/Makefile
29        docs/libtrace.doxygen
30        lib/libtrace.h
31        ])
32dnl GNU C library
33dnl AC_GNU_SOURCE
34
35
36AM_CONFIG_HEADER([config.h])
37dnl Checks for programs.
38AC_PROG_CC
39AC_PROG_CXX
40AC_PROG_INSTALL
41dnl AC_PROG_YACC
42AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc)
43AM_PROG_LEX
44
45AC_CONFIG_LIBOBJ_DIR(lib)
46
47# Checks for typedefs, structures, and compiler characteristics.
48AC_C_CONST
49AC_C_INLINE
50AC_C_BIGENDIAN
51AC_TYPE_SIZE_T
52AC_HEADER_TIME
53AC_SYS_LARGEFILE
54
55if test "$GCC" = "yes"; then
56        CFLAGS="$CFLAGS -Wall -Wextra -Wmissing-prototypes -O2"
57        CXXFLAGS="$CXXFLAGS -Wall -Wextra -O2"
58# We assume that gcc knows about -fvisibility and friends, as I can't see
59# a good easy way of testing for it here.
60        LIBCFLAGS="$CFLAGS"
61        LIBCFLAGS="$LIBCFLAGS -DLT_BUILDING_DLL=1"
62        LIBCFLAGS="$LIBCFLAGS -fvisibility=hidden"
63        LIBCXXFLAGS="$CXXFLAGS"
64        LIBCXXFLAGS="$CXXFLAGS -DLT_BUILDING_DLL=1"
65        LIBCXXFLAGS="$CXXFLAGS -fvisibility=hidden"
66fi
67
68AC_PROG_LIBTOOL
69
70# Checks for library functions.
71AC_PROG_GCC_TRADITIONAL
72AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf)
73
74AC_CHECK_SIZEOF([long int])
75
76
77
78# Check for various broken functions
79AC_FUNC_MALLOC
80AC_FUNC_REALLOC
81
82# *BSD doesn't have strndup. Currently provide our own.
83AC_REPLACE_FUNCS(strndup)
84
85# Checks for header files.
86AC_HEADER_STDC
87AC_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)
88
89AC_CHECK_HEADERS(netinet/in.h)
90AC_CHECK_HEADERS(netpacket/packet.h,[
91        libtrace_netpacket_packet_h=true
92        AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net])
93])
94AC_CHECK_HEADER(net/if.h,
95        AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[
96 #include <sys/types.h>
97 #include <sys/socket.h>
98])
99
100AC_CHECK_HEADER(netinet/ether.h,
101        AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[
102 #include <sys/types.h>
103 #include <sys/socket.h>
104 #include <netinet/in.h>
105 #include <net/if.h>
106])
107
108AC_CHECK_HEADER(netinet/if_ether.h,
109        AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[
110 #include <sys/types.h>
111 #include <sys/socket.h>
112 #include <netinet/in.h>
113 #include <net/if.h>
114])
115
116AC_CHECK_HEADER(net/if_arp.h,
117        AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[
118 #include <sys/types.h>
119 #include <sys/socket.h>
120 #include <netinet/in.h>
121 #include <net/if.h>
122])
123
124# Checking for the right bpf header to include
125AC_CHECK_HEADER(pcap-bpf.h)
126AC_CHECK_HEADER(net/bpf.h)
127AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h]))
128
129# Check to see if we have libdl - *BSD has built-in libdl
130AC_CHECK_LIB(dl, dlopen)
131# check pcap
132AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0)
133#AC_CHECK_LIB(pcap,pcap_next_ex)
134#AC_REPLACE_FUNCS(pcap_open_dead)
135#AC_REPLACE_FUNCS(pcap_dump_flush)
136#AC_REPLACE_FUNCS(pcap_next_ex)
137AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
138AC_CHECK_DECLS([BIOCSETIF],,,[
139#include <sys/types.h>
140#include <sys/time.h>
141#include <sys/ioctl.h>
142#include <net/bpf.h>
143])
144
145# configure time options for man pages
146AC_ARG_WITH(man,
147            AS_HELP_STRING(--with-man,install man pages by default),[
148             if test "$withval" = yes
149             then
150                     MANPAGES="docs/man/man3/[a-zA-Z]*.3"
151             else
152                     MANPAGES=""
153             fi
154])
155
156AC_PROG_CXX
157
158if test "$pcapfound" = 0; then
159        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)
160else
161        ADD_LIBS="$ADD_LIBS -lpcap"
162        AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support])
163        AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support])
164fi
165
166# configure time options for use of DAG cards
167# borrowed from libpcap!
168AC_ARG_WITH(dag,
169            AS_HELP_STRING(--with-dag[=DIR],include DAG live capture support (located in directory DIR, if supplied)),
170[
171        if test "$withval" = no
172        then
173                want_dag=no
174        elif test "$withval" = yes
175        then
176                want_dag=yes
177                dag_root=/usr/local/dag
178        else
179                want_dag=yes
180                dag_root=$withval
181        fi
182],[
183        #
184        # Use DAG API if present, otherwise don't
185        #
186        want_dag=ifpresent
187        dag_root=/usr/local/dag
188])
189
190# DAG 3.0 actually puts header files and shared libraries into sensible
191# places now, so we should be able to do a simple CHECK_LIB to see if
192# they're there!
193
194# Addendum: It turns out DAG 2.5 does this too, so we'll match DAG2.5 in here
195# also. This isn't such a bad thing, the DAG2.5 API is essentially the same as
196# DAG 3.0 and libtrace will use the same format_dagXX source for both
197libtrace_dag=false
198libtrace_dag_version=none
199
200if test "$with_dag" != no; then
201        AC_CHECK_LIB(dag, dag_open, dag_found=1, dag_found=0)
202        if test "$dag_found" = 1; then
203                ADD_LIBS="$ADD_LIBS -ldag"
204                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
205                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
206                libtrace_dag=true
207               
208                AC_DEFINE(DAG_VERSION,30,[defines the DAG driver version])
209                libtrace_dag_version=30
210        fi
211fi
212
213# turn the test part of the next block into a function, so it can be
214# called multiple times for $dag_root, /root/dag, /usr/local/lib
215dag_drv_v="DAG not present"
216
217# Now check for 2.4 DAG drivers which don't install as cleanly!
218if test "$with_dag" != no -a "$libtrace_dag" = false; then
219        AC_MSG_CHECKING(whether we have DAG 2.4 API instead)
220
221        if test -r "$dag_root/lib"; then
222                dag_lib_dir="$dag_root/lib"
223        else
224                dag_lib_dir="$dag_root"
225        fi
226       
227        if test -r "$dag_root/include"; then
228                dag_tools_dir="$dag_root/tools"
229                dag_include_dir="$dag_root/include"
230        else
231                dag_tools_dir="$dag_root"
232                dag_include_dir="$dag_root"
233        fi
234
235        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
236        then
237                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
238                ADD_LIBS="$ADD_LIBS -ldag"
239                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
240                DAG_TOOLS_DIR=$dag_tools_dir
241                AC_SUBST([DAG_TOOLS_DIR])
242                libtrace_dag=true
243               
244                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
245                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
246                AC_DEFINE(DAG_VERSION, 24, [defines the DAG driver version])
247                libtrace_dag_version=24
248        else
249                if test "$want_dag" = yes; then
250                        AC_MSG_ERROR(DAG API not found under directory $dag_root
251; use --without-dag)
252                fi
253                libtrace_dag=false
254        fi
255        AC_MSG_RESULT($libtrace_dag)
256
257fi
258
259# Try to determine the DAG driver version
260if test x"$libtrace_dag" = xtrue; then
261        dag_drv_v="Unknown"
262        files=`locate /usr/*dag*/VERSION`
263        file_count=0
264
265        for i in $files; do
266                if $file_count > 0; then
267                        dag_drv_v="Indeterminate"
268                        break
269                fi
270                dag_drv_v=`cat $i`
271                file_count=$file_count+1
272        done
273fi
274DAG_VERSION_NUM=$dag_drv_v
275
276
277AC_CHECK_LIB(z, deflate)
278AC_CHECK_LIB(bz2, BZ2_bzDecompressInit)
279AC_CHECK_LIB(lzo2, lzo1x_1_compress)
280AC_CHECK_LIB(pthread, pthread_create)
281AC_SEARCH_LIBS(mvprintw, ncurses, [], [ AC_MSG_ERROR([NCurses library not available]) ])
282
283AC_ARG_WITH([llvm],
284        [AC_HELP_STRING([--with-llvm],
285                [support Just In Time compiler])],
286        use_llvm="yes",
287        use_llvm="check")
288
289AC_PATH_PROG(llvm_config, llvm-config)
290
291if (test "$use_llvm" != "no"); then
292        AC_PATH_PROG(LLVM_CONFIG, llvm-config, no)
293        if test "$LLVM_CONFIG" = "no" ; then
294                AC_MSG_NOTICE([Unable to find llvm-config.  JIT support disabled.])
295                JIT=no
296        else
297                LIBCXXFLAGS="`$LLVM_CONFIG --cxxflags` $CXXFLAGS"
298                ADD_LIBS="$ADD_LIBS `$LLVM_CONFIG --libs all`";
299                LDFLAGS="`$LLVM_CONFIG --ldflags` $LDFLAGS";
300                JIT=yes
301                AC_DEFINE(HAVE_LLVM, 1, [Set to 1 if you have LLVM installed])
302        fi
303fi
304
305
306AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
307AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
308AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24])
309AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25])
310AM_CONDITIONAL([DAG3_0], [test "$libtrace_dag_version" = 30])
311AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_deflate" = yes])
312AM_CONDITIONAL([HAVE_BZLIB], [test "$ac_cv_lib_bz2_BZ2_bzDecompressInit" = yes])
313AM_CONDITIONAL([HAVE_LZO], [test "$ac_cv_lib_lzo2_lzo1x_1_compress" = yes])
314AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
315AM_CONDITIONAL([HAVE_LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
316AM_CONDITIONAL([HAVE_LLVM], [test "x$LLVM_CONFIG" != "xno" ])
317
318# Check for miscellaneous programs
319AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
320
321AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
322
323AC_SUBST([ADD_LIBS])
324AC_SUBST([ADD_LDFLAGS])
325AC_SUBST([ADD_INCLS])
326AC_SUBST([LTLIBOBJS])
327AC_SUBST([MANPAGES])
328AC_SUBST([PACKAGE_VERSION])
329AC_SUBST([LIBTRACE_MAJOR])
330AC_SUBST([LIBTRACE_MID])
331AC_SUBST([LIBTRACE_MINOR])
332AC_SUBST([DAG_VERSION_NUM])
333AC_SUBST([HAVE_BPF_CAPTURE])
334AC_SUBST([HAVE_LIBGDC])
335AC_SUBST([HAVE_LLVM])
336AC_SUBST([LIBCFLAGS])
337AC_SUBST([LIBCXXFLAGS])
338dnl and finally, output our Makefiles
339AC_OUTPUT
340
341reportopt() {
342        if test x"$2" = xtrue -o x"$2" = xyes; then
343                AC_MSG_NOTICE([$1: Yes])
344        else
345                AC_MSG_NOTICE([$1: No])
346        fi
347}
348
349echo
350AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
351reportopt "Compiled with PCAP 0.8 support" $ac_cv_lib_pcap_pcap_next_ex
352reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_deflate
353reportopt "Compiled with compressed trace (bz2) support" $ac_cv_lib_bz2_BZ2_bzDecompressInit
354reportopt "Compiled with compressed trace (lzo write only) support" $ac_cv_lib_lzo2_lzo1x_1_compress
355if test x"$libtrace_dag" = xtrue; then
356        if test "$libtrace_dag_version" = 24; then
357                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.4])
358        elif test "$libtrace_dag_version" = 30; then
359                AC_MSG_NOTICE([Compiled with DAG live capture support: 3.0])
360        else
361                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.5])
362        fi     
363else
364        AC_MSG_NOTICE([Compiled with DAG live capture support: No])
365fi
366reportopt "Compiled with LLVM BPF JIT support" $JIT
367reportopt "Building man pages/documentation" $libtrace_doxygen
368
369echo
370ac_cv_errcount=0;
371if test -z "$YACC"; then
372        AC_MSG_WARN(bison or yacc not found. Please install bison before continuing)
373        ac_cv_errcount=$((ac_cv_errcount + 1))
374fi
375
376if test -z "$LEXLIB"; then
377        AC_MSG_WARN(flex or lex not found. Please install flex before continuing)
378        ac_cv_errcount=$((ac_cv_errcount + 1))
379fi
380
381if test $ac_cv_errcount -gt 0; then
382        AC_MSG_ERROR(Critical packages are missing and compilation will fail. Please install the packages listed above and rerun ./configure)
383fi
384
Note: See TracBrowser for help on using the repository browser.