source: configure.in @ 755e794

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

Add /dev/bpf capture support for the ThreeBSD's

  • Property mode set to 100644
File size: 7.9 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.0-beta4],[contact@wand.net.nz],[libtrace])
7
8LIBTRACE_MAJOR=3
9LIBTRACE_MID=0
10LIBTRACE_MINOR=0
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/tracedump/Makefile
21        tools/tracemerge/Makefile tools/tracereport/Makefile
22        tools/tracertstats/Makefile tools/tracesplit/Makefile
23        tools/tracestats/Makefile
24        docs/libtrace.doxygen
25        lib/libtrace.h
26        swig/Makefile])
27dnl GNU C library
28dnl AC_GNU_SOURCE
29
30
31AM_CONFIG_HEADER([config.h])
32dnl Checks for programs.
33AC_PROG_CC
34AC_PROG_CXX
35AC_PROG_INSTALL
36AC_PROG_YACC
37AM_PROG_LEX
38
39AC_CONFIG_LIBOBJ_DIR(lib)
40
41# Checks for typedefs, structures, and compiler characteristics.
42AC_C_CONST
43AC_C_INLINE
44AC_C_BIGENDIAN
45AC_TYPE_SIZE_T
46AC_HEADER_TIME
47AC_SYS_LARGEFILE
48
49AC_PROG_LIBTOOL
50
51AC_ARG_ENABLE(swig,
52[  --disable-swig               don't generate python bindings],
53lt_use_python=true,lt_use_python=false)
54
55if test "x$lt_use_python" = "xtrue"
56then
57        AM_PATH_PYTHON(2.3)
58        AC_PROG_SWIG(1.3.21)
59        SWIG_PYTHON
60fi
61
62# Checks for library functions.
63AC_PROG_GCC_TRADITIONAL
64AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf)
65
66AC_CHECK_SIZEOF([long int])
67
68
69
70# Check for various broken functions
71AC_FUNC_MALLOC
72AC_FUNC_REALLOC
73
74# *BSD doesn't have strndup. Currently provide our own.
75AC_REPLACE_FUNCS(strndup)
76
77# Checks for header files.
78AC_HEADER_STDC
79dnl AC_CHECK_HEADERS(errno.h stdlib.h stdio.h assert.h string.h netinet/in.h assert.h errno.h fcntl.h net/ethernet.h netdb.h pcap.h stdio.h stdlib.h string.h sys/stat.h sys/types.h sys/socket.h sys/un.h unistd.h time.h sys/ioctl.h net/bpf.h pcap.h zlib.h pcap-bpf.h)
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)
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_open_live)
126AC_REPLACE_FUNCS(pcap_open_dead)
127AC_REPLACE_FUNCS(pcap_dump_flush)
128AC_REPLACE_FUNCS(pcap_next_ex)
129AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
130AC_CHECK_DECLS([BIOCSETIF],,,[
131#include <sys/types.h>
132#include <sys/time.h>
133#include <sys/ioctl.h>
134#include <net/bpf.h>
135])
136
137# configure time options for man pages
138AC_ARG_WITH(man,
139            #AS_HELP_STRING(--with-man,install man pages by default),
140
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
151# configure time options for use of DAG cards
152# borrowed from libpcap!
153AC_ARG_WITH(dag,
154#           AS_HELP_STRING(--with-dag[=DIR],include DAG support (located in directory DIR, if supplied)),
155[
156        if test "$withval" = no
157        then
158                want_dag=no
159        elif test "$withval" = yes
160        then
161                want_dag=yes
162                dag_root=/root/dag
163        else
164                want_dag=yes
165                dag_root=$withval
166        fi
167],[
168        #
169        # Use DAG API if present, otherwise don't
170        #
171        want_dag=ifpresent
172        dag_root=/root/dag/
173])
174
175# turn the test part of the next block into a function, so it can be
176# called multiple times for $dag_root, /root/dag, /usr/local/lib
177libtrace_dag=false
178libtrace_dag2_4=false
179if test "$with_dag" != no; then
180        AC_MSG_CHECKING(whether we have DAG API)
181
182        if test -r "$dag_root/lib"; then
183                dag_lib_dir="$dag_root/lib"
184        else
185                dag_lib_dir="$dag_root"
186        fi
187       
188        if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
189                dag_tools_dir="$dag_root/tools"
190                dag_include_dir="$dag_root/include"
191        else
192                dag_tools_dir="$dag_root"
193                dag_include_dir="$dag_root"
194        fi
195
196        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
197        then
198                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
199                ADD_LIBS="$ADD_LIBS -ldag"
200                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
201                DAG_TOOLS_DIR=$dag_tools_dir
202                AC_SUBST([DAG_TOOLS_DIR])
203                libtrace_dag=true
204               
205                AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
206                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support])
207        else
208                if test "$want_dag" = yes; then
209                        AC_MSG_ERROR(DAG API not found under directory $dag_root
210; use --without-dag)
211                fi
212                libtrace_dag=false
213        fi
214        AC_MSG_RESULT($libtrace_dag)
215       
216        AC_MSG_CHECKING(if we are using DAG 2.4)
217        if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then
218                libtrace_dag2_4=true
219                AC_DEFINE(DAG_VERSION_2_4, 1, [define if using DAG 2.4])
220        else
221                libtrace_dag2_4=false
222        fi
223        AC_MSG_RESULT($libtrace_dag2_4)
224fi
225
226AC_CHECK_LIB(z, gzopen)
227
228libtrace_swig=false;
229if test -n "$SWIG"; then
230        libtrace_swig=true;
231fi
232libtrace_python=false;
233if test -n "$PYTHON"; then
234        libtrace_python=true;
235fi
236
237AM_CONDITIONAL([HAVE_BPF], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
238AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
239AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true])
240AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_gzopen" = yes])
241AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
242AM_CONDITIONAL([LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
243AM_CONDITIONAL([LIBTRACE_SWIG], [test "$libtrace_swig" = true])
244#AM_CONDITIONAL([HAVE_PYTHON], [test "$libtrace_python" = true])
245
246# Check for miscellaneous programs
247AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
248
249AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
250
251
252AC_SUBST([ADD_LIBS])
253AC_SUBST([ADD_LDFLAGS])
254AC_SUBST([ADD_INCLS])
255AC_SUBST([LTLIBOBJS])
256AC_SUBST([MANPAGES])
257AC_SUBST([PACKAGE_VERSION])
258AC_SUBST([LIBTRACE_MAJOR])
259AC_SUBST([LIBTRACE_MID])
260AC_SUBST([LIBTRACE_MINOR])
261
262dnl and finally, output our Makefiles
263AC_OUTPUT
264
265reportopt() {
266        if test x"$2" = xtrue -o x"$2" = xyes; then
267                AC_MSG_NOTICE([$1: Yes])
268        else
269                AC_MSG_NOTICE([$1: No])
270        fi
271}
272
273echo
274AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
275reportopt "Compiled with PCAP support" $ac_cv_lib_pcap_pcap_open_live
276reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_gzopen
277if test x"$libtrace_dag" = xtrue; then
278        if test x"$libtrace_dag2_4"; then
279                AC_MSG_NOTICE([Compiled with DAG support: 2.4])
280        else
281                AC_MSG_NOTICE([Compiled with DAG support: 2.5])
282        fi
283else
284        AC_MSG_NOTICE([Compiled with DAG support: No])
285fi
286reportopt "Building man pages/documentation" $libtrace_doxygen
287
288if test x"$libtrace_swig" = xtrue; then
289H
290        if test x"$libtrace_python" = xtrue; then
291                AC_MSG_NOTICE([Building swig bindings for: python])
292        else
293                AC_MSG_NOTICE([Building swig bindings for: Nothing])
294        fi
295else
296        AC_MSG_NOTICE([Not building swig bindings])
297fi
Note: See TracBrowser for help on using the repository browser.