source: configure.in @ 441f34d

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

Missed change from previous commit (detect prctl is available on linux)

  • Property mode set to 100644
File size: 10.3 KB
Line 
1# Process this file with autoconf to produce a configure script.
2
3# Now you only need to update the version number in two places - below,
4# and in the README
5
6AC_INIT([libtrace],[3.0.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# We assume that gcc knows about -fvisibility and friends, as I can't see
58# a good easy way of testing for it here.
59        CFLAGS="$CFLAGS -DLT_BUILDING_DLL=1"
60        CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
61fi
62
63AC_PROG_LIBTOOL
64
65# Checks for library functions.
66AC_PROG_GCC_TRADITIONAL
67AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf)
68
69AC_CHECK_SIZEOF([long int])
70
71
72
73# Check for various broken functions
74AC_FUNC_MALLOC
75AC_FUNC_REALLOC
76
77# *BSD doesn't have strndup. Currently provide our own.
78AC_REPLACE_FUNCS(strndup)
79
80# Checks for header files.
81AC_HEADER_STDC
82AC_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)
83
84AC_CHECK_HEADERS(netinet/in.h)
85AC_CHECK_HEADERS(netpacket/packet.h,[
86        libtrace_netpacket_packet_h=true
87        AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net])
88])
89AC_CHECK_HEADER(net/if.h,
90        AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[
91 #include <sys/types.h>
92 #include <sys/socket.h>
93])
94
95AC_CHECK_HEADER(netinet/ether.h,
96        AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[
97 #include <sys/types.h>
98 #include <sys/socket.h>
99 #include <netinet/in.h>
100 #include <net/if.h>
101])
102
103AC_CHECK_HEADER(netinet/if_ether.h,
104        AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[
105 #include <sys/types.h>
106 #include <sys/socket.h>
107 #include <netinet/in.h>
108 #include <net/if.h>
109])
110
111AC_CHECK_HEADER(net/if_arp.h,
112        AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[
113 #include <sys/types.h>
114 #include <sys/socket.h>
115 #include <netinet/in.h>
116 #include <net/if.h>
117])
118
119# Checking for the right bpf header to include
120AC_CHECK_HEADER(pcap-bpf.h)
121AC_CHECK_HEADER(net/bpf.h)
122AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h]))
123
124# Check to see if we have libdl - *BSD has built-in libdl
125AC_CHECK_LIB(dl, dlopen)
126# check pcap
127AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0)
128#AC_CHECK_LIB(pcap,pcap_next_ex)
129#AC_REPLACE_FUNCS(pcap_open_dead)
130#AC_REPLACE_FUNCS(pcap_dump_flush)
131#AC_REPLACE_FUNCS(pcap_next_ex)
132AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
133AC_CHECK_DECLS([BIOCSETIF],,,[
134#include <sys/types.h>
135#include <sys/time.h>
136#include <sys/ioctl.h>
137#include <net/bpf.h>
138])
139
140# configure time options for man pages
141AC_ARG_WITH(man,
142            AS_HELP_STRING(--with-man,install man pages by default),[
143             if test "$withval" = yes
144             then
145                     MANPAGES="docs/man/man3/[a-zA-Z]*.3"
146             else
147                     MANPAGES=""
148             fi
149])
150
151AC_PROG_CXX
152
153if test "$pcapfound" = 0; then
154        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)
155else
156        ADD_LIBS="$ADD_LIBS -lpcap"
157        AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support])
158        AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support])
159fi
160
161# configure time options for use of DAG cards
162# borrowed from libpcap!
163AC_ARG_WITH(dag,
164            AS_HELP_STRING(--with-dag[=DIR],include DAG live capture support (located in directory DIR, if supplied)),
165[
166        if test "$withval" = no
167        then
168                want_dag=no
169        elif test "$withval" = yes
170        then
171                want_dag=yes
172                dag_root=/usr/local/dag
173        else
174                want_dag=yes
175                dag_root=$withval
176        fi
177],[
178        #
179        # Use DAG API if present, otherwise don't
180        #
181        want_dag=ifpresent
182        dag_root=/usr/local/dag
183])
184
185# DAG 3.0 actually puts header files and shared libraries into sensible
186# places now, so we should be able to do a simple CHECK_LIB to see if
187# they're there!
188
189# Addendum: It turns out DAG 2.5 does this too, so we'll match DAG2.5 in here
190# also. This isn't such a bad thing, the DAG2.5 API is essentially the same as
191# DAG 3.0 and libtrace will use the same format_dagXX source for both
192libtrace_dag=false
193libtrace_dag_version=none
194
195if test "$with_dag" != no; then
196        AC_CHECK_LIB(dag, dag_open, dag_found=1, dag_found=0)
197        if test "$dag_found" = 1; then
198                ADD_LIBS="$ADD_LIBS -ldag"
199                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
200                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
201                libtrace_dag=true
202               
203                AC_DEFINE(DAG_VERSION,30,[defines the DAG driver version])
204                libtrace_dag_version=30
205        fi
206fi
207
208# turn the test part of the next block into a function, so it can be
209# called multiple times for $dag_root, /root/dag, /usr/local/lib
210dag_drv_v="DAG not present"
211
212# Now check for 2.4 DAG drivers which don't install as cleanly!
213if test "$with_dag" != no -a "$libtrace_dag" = false; then
214        AC_MSG_CHECKING(whether we have DAG 2.4 API instead)
215
216        if test -r "$dag_root/lib"; then
217                dag_lib_dir="$dag_root/lib"
218        else
219                dag_lib_dir="$dag_root"
220        fi
221       
222        if test -r "$dag_root/include"; then
223                dag_tools_dir="$dag_root/tools"
224                dag_include_dir="$dag_root/include"
225        else
226                dag_tools_dir="$dag_root"
227                dag_include_dir="$dag_root"
228        fi
229
230        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
231        then
232                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
233                ADD_LIBS="$ADD_LIBS -ldag"
234                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
235                DAG_TOOLS_DIR=$dag_tools_dir
236                AC_SUBST([DAG_TOOLS_DIR])
237                libtrace_dag=true
238               
239                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
240                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
241                AC_DEFINE(DAG_VERSION, 24, [defines the DAG driver version])
242                libtrace_dag_version=24
243        else
244                if test "$want_dag" = yes; then
245                        AC_MSG_ERROR(DAG API not found under directory $dag_root
246; use --without-dag)
247                fi
248                libtrace_dag=false
249        fi
250        AC_MSG_RESULT($libtrace_dag)
251
252fi
253
254# Try to determine the DAG driver version
255if test x"$libtrace_dag" = xtrue; then
256        dag_drv_v="Unknown"
257        files=`locate /usr/*dag*/VERSION`
258        file_count=0
259
260        for i in $files; do
261                if $file_count > 0; then
262                        dag_drv_v="Indeterminate"
263                        break
264                fi
265                dag_drv_v=`cat $i`
266                file_count=$file_count+1
267        done
268fi
269DAG_VERSION_NUM=$dag_drv_v
270
271
272AC_CHECK_LIB(z, deflate)
273AC_CHECK_LIB(bz2, BZ2_bzDecompressInit)
274AC_CHECK_LIB(pthread, pthread_create)
275AC_SEARCH_LIBS(mvprintw, ncurses, [], [ AC_MSG_ERROR([NCurses library not available]) ])
276
277AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
278AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
279AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24])
280AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25])
281AM_CONDITIONAL([DAG3_0], [test "$libtrace_dag_version" = 30])
282AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_deflate" = yes])
283AM_CONDITIONAL([HAVE_BZLIB], [test "$ac_cv_lib_bz2_BZ2_bzDecompressInit" = yes])
284AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
285AM_CONDITIONAL([HAVE_LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
286
287# Check for miscellaneous programs
288AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
289
290AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
291
292AC_SUBST([ADD_LIBS])
293AC_SUBST([ADD_LDFLAGS])
294AC_SUBST([ADD_INCLS])
295AC_SUBST([LTLIBOBJS])
296AC_SUBST([MANPAGES])
297AC_SUBST([PACKAGE_VERSION])
298AC_SUBST([LIBTRACE_MAJOR])
299AC_SUBST([LIBTRACE_MID])
300AC_SUBST([LIBTRACE_MINOR])
301AC_SUBST([DAG_VERSION_NUM])
302AC_SUBST([HAVE_BPF_CAPTURE])
303AC_SUBST([HAVE_LIBGDC])
304dnl and finally, output our Makefiles
305AC_OUTPUT
306
307reportopt() {
308        if test x"$2" = xtrue -o x"$2" = xyes; then
309                AC_MSG_NOTICE([$1: Yes])
310        else
311                AC_MSG_NOTICE([$1: No])
312        fi
313}
314
315echo
316AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
317reportopt "Compiled with PCAP 0.8 support" $ac_cv_lib_pcap_pcap_next_ex
318reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_deflate
319reportopt "Compiled with compressed trace (bz2) support" $ac_cv_lib_bz2_BZ2_bzDecompressInit
320if test x"$libtrace_dag" = xtrue; then
321        if test "$libtrace_dag_version" = 24; then
322                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.4])
323        elif test "$libtrace_dag_version" = 30; then
324                AC_MSG_NOTICE([Compiled with DAG live capture support: 3.0])
325        else
326                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.5])
327        fi     
328else
329        AC_MSG_NOTICE([Compiled with DAG live capture support: No])
330fi
331reportopt "Building man pages/documentation" $libtrace_doxygen
332
333echo
334ac_cv_errcount=0;
335if test -z "$YACC"; then
336        AC_MSG_WARN(bison or yacc not found. Please install bison before continuing)
337        ac_cv_errcount=$((ac_cv_errcount + 1))
338fi
339
340if test -z "$LEXLIB"; then
341        AC_MSG_WARN(flex or lex not found. Please install flex before continuing)
342        ac_cv_errcount=$((ac_cv_errcount + 1))
343fi
344
345if test $ac_cv_errcount -gt 0; then
346        AC_MSG_ERROR(Critical packages are missing and compilation will fail. Please install the packages listed above and rerun ./configure)
347fi
348
Note: See TracBrowser for help on using the repository browser.