source: configure.in @ b282cf8

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

Clarify even further that the DAG api is only required for live capture

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