source: configure.in @ 0ca90be

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

Discuss visibility changes

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