source: configure.in @ e4e95499

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

Added support for writing onto an interface to pcap and linuxnative

  • Property mode set to 100644
File size: 11.2 KB
Line 
1# Process this file with autoconf to produce a configure script.
2
3LIBTRACE_MAJOR=3
4LIBTRACE_MID=0
5LIBTRACE_MINOR=0
6
7AC_INIT(libtrace,3.0.0,[contact@wand.net.nz],libtrace)
8AC_CONFIG_SRCDIR(lib/trace.c)
9AM_INIT_AUTOMAKE(libtrace,3.0.0)
10
11AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile tools/Makefile tools/traceanon/Makefile tools/tracedump/Makefile tools/tracemerge/Makefile tools/tracereport/Makefile tools/tracertstats/Makefile tools/tracesplit/Makefile tools/tracestats/Makefile ])
12dnl GNU C library
13dnl AC_GNU_SOURCE
14
15
16AM_CONFIG_HEADER(config.h)
17#AC_CONFIG_HEADERS([config.h])
18dnl Checks for programs.
19AC_PROG_CC
20AC_PROG_CXX
21AC_PROG_INSTALL
22AC_LIBTOOL_DLOPEN
23AC_PROG_LIBTOOL
24
25AC_CONFIG_LIBOBJ_DIR(lib)
26
27# Checks for typedefs, structures, and compiler characteristics.
28AC_C_CONST
29AC_C_INLINE
30AC_C_BIGENDIAN
31AC_TYPE_SIZE_T
32AC_HEADER_TIME
33AC_SYS_LARGEFILE
34
35# Checks for library functions.
36AC_PROG_GCC_TRADITIONAL
37AC_CHECK_FUNCS(socket strdup)
38
39AC_CHECK_SIZEOF([long int])
40
41
42
43# Check for various broken functions
44AC_FUNC_MALLOC
45AC_FUNC_REALLOC
46
47# *BSD doesn't have strndup. Currently provide our own.
48AC_REPLACE_FUNCS(strndup)
49
50# Checks for header files.
51AC_HEADER_STDC
52dnl 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)
53AC_CHECK_HEADERS(pcap.h pcap-int.h pcap-bpf.h net/bpf.h zlib.h sys/limits.h stddef.h inttypes.h limits.h net/ethernet.h )
54
55AC_CHECK_HEADERS(netinet/in.h)
56AC_CHECK_HEADER(netpacket/packet.h,
57                libtrace_netpacket_packet_h=true
58                AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[We have netpacket/packet.h]),
59                [libtrace_netpacket_packet_h=false])
60
61AC_CHECK_HEADER(net/if.h,
62                AC_DEFINE(HAVE_NET_IF_H,1,[We have net/if.h]), [],
63[#include <sys/types.h>
64 #include <sys/socket.h>
65])
66
67
68AC_CHECK_HEADER(netinet/ether.h,
69                AC_DEFINE(HAVE_NETINET_ETHER_H,1,[We have netinet/ether.h]
70), [],
71[
72 #include <sys/types.h>
73 #include <sys/socket.h>
74 #include <netinet/in.h>
75 #include <net/if.h>
76])
77
78AC_CHECK_HEADER(netinet/if_ether.h,
79                AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[We have netinet/if_ether.h]), [],
80[
81 #include <sys/types.h>
82 #include <sys/socket.h>
83 #include <netinet/in.h>
84 #include <net/if.h>
85])
86
87AC_CHECK_HEADER(net/if_arp.h,
88                AC_DEFINE(HAVE_NET_IF_ARP_H,1,[We have net/if_arp.h]), [],
89[
90 #include <sys/types.h>
91 #include <sys/socket.h>
92 #include <netinet/in.h>
93 #include <net/if.h>
94])
95
96       
97# Checking for the right bpf header to include
98AC_MSG_CHECKING([where the bpf headers are kept])
99echo ""
100bpfh=no
101AC_CHECK_HEADER(pcap-bpf.h,
102        [AC_DEFINE([HAVE_PCAP_BPF_H]) bpfh=pcap-bpf.h])
103if test $bpfh = no; then
104AC_CHECK_HEADER(net/bpf.h,
105        [AC_DEFINE([HAVE_NET_BPF_H]) bpfh=net/bpf.h])
106fi
107
108if test $bpfh = no; then
109  AC_MSG_RESULT([No BPF headers, compiling without support for BPF filters])
110  AC_DEFINE(HAVE_BPF,0,[Conditional for building bpf support])
111  libtrace_bpf=false
112else
113  AC_MSG_RESULT([Using $bpfh])
114  AC_DEFINE(HAVE_BPF,1,[Conditional for building bpf support])
115  libtrace_bpf=true
116fi
117
118
119AC_CHECK_HEADER(gdc.h,
120             [AC_DEFINE(HAVE_GDC_H,1,[Conditional for building with libGDC support]) libtrace_gdc=true],
121             [AC_DEFINE(HAVE_GDC_H,0,[Conditional for building with libGDC support]) libtrace_gdc=false])
122
123
124# Check to see if we have libpcap
125AC_CHECK_LIB(pcap,pcap_open_live,
126             libtrace_pcap=true,
127             libtrace_pcap=false)
128
129if test "$libtrace_pcap" = true; then
130    AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support])
131    ADD_LIBS="$ADD_LIBS  -lpcap"
132else
133    AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support])
134fi     
135
136# Only test for these functions if we have PCAP installed
137        if test "$libtrace_pcap" = true; then
138        # Earlier versions of pcap don't have pcap_open_dead. EG: the one
139        # OpenBSD ships with. Even Debian Woody is more up to date.
140        AC_CHECK_LIB(pcap,pcap_open_dead,
141                have_pcap_open_dead=true,
142                have_pcap_open_dead=false)
143
144        if test "$have_pcap_open_dead" = false; then
145                AC_REPLACE_FUNCS(pcap_open_dead)
146        fi
147   
148        # Versions of libpcap earlier than 0.8 don't have pcap_dump_flush
149        AC_CHECK_LIB(pcap,pcap_dump_flush,
150                     have_pcap_dump_flush=true,
151                     have_pcap_dump_flush=false)
152
153        if test "$have_pcap_dump_flush" = false; then
154                AC_REPLACE_FUNCS(pcap_dump_flush)
155        fi
156
157        AC_CHECK_LIB(pcap,pcap_inject,
158                        AC_DEFINE(HAVE_PCAP_INJECT,1,[pcap has pcap_inject]),
159                        have_pcap_inject=false)
160
161        AC_CHECK_LIB(pcap,pcap_sendpacket,
162                        AC_DEFINE(HAVE_PCAP_SENDPACKET,1,[pcap has pcap_sendpacket]),
163                        have_pcap_sendpacket=false)
164fi
165
166
167# configure time options for man pages
168AC_ARG_WITH(man,
169            AC_HELP_STRING([--with-man],
170                           [install man pages by default]),
171
172             if test "$withval" = yes
173             then
174                     MANPAGES="docs/man/man3/[a-zA-Z]*.3]"
175             else
176                     MANPAGES=""
177             fi
178)
179
180# configure time option for building libpacketdump
181# libpacketdump needs a C++ compiler to build, so we should do some tests
182# at this point to see if one is installed
183libtrace_libpacketdump=true
184AC_ARG_ENABLE(libpacketdump,
185              AC_HELP_STRING([--disable-libpacketdump],
186                             [disable building of libpacketdump (enabled by default). libpacketdump needs a c++ compiler to build] ),
187[
188        if test "$enableval" = no -o "$enableval" = false
189        then
190                libtrace_libpacketdump=false
191        else
192                libtrace_libpacketdump=true
193        fi
194],
195[
196        libtrace_libpacketdump=true
197])
198
199if test "$libtrace_libpacketdump" = true; then
200        AC_LANG_PUSH(C++)
201        AC_MSG_CHECKING([if we can compile C++ ])
202        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
203                           [[
204#include <iostream>
205                           ]])],
206                [AC_DEFINE(HAVE_CXX,1,[define to test for presence of a working C++ compiler]) libtrace_cxx=true],
207                [AC_DEFINE(HAVE_CXX,0,[define to test for presence of a working C++ compiler]) libtrace_cxx=false])
208
209        AC_MSG_RESULT($libtrace_cxx)   
210        AC_LANG_POP(C++)
211
212        if test "$libtrace_cxx" = false; then
213                AC_MSG_ERROR([libpacketdump requested, but no C++ compiler found. Build with --disable-libpacketdump if you wish to continue anyway ])
214        fi
215fi
216
217# configure time option for building the libtrace tools
218# one of the tools requires libpacketdump, so won't build if libpacketdump
219# hasn't also been built
220libtrace_tools=true
221AC_ARG_ENABLE(tools,
222              AC_HELP_STRING([--disable-tools],
223                             [disable building of the tools contained in the tools/ directory]),
224[
225        if test "$enableval" = no -o "$enableval" = false
226        then
227                libtrace_tools=false
228        else
229                libtrace_tools=true
230        fi
231       
232],
233[
234        libtrace_tools=true
235])
236
237# configure time options for use of DAG cards
238# borrowed from libpcap!
239AC_ARG_WITH(dag,
240            AC_HELP_STRING([--with-dag[=DIR]],
241                           [include DAG support (located in directory DIR, if supplied)]),
242[
243        if test "$withval" = no
244        then
245                want_dag=no
246        elif test "$withval" = yes
247        then
248                want_dag=yes
249                dag_root=/root/dag
250        else
251                want_dag=yes
252                dag_root=$withval
253        fi
254],[
255        #
256        # Use DAG API if present, otherwise don't
257        #
258        want_dag=ifpresent
259        dag_root=/root/dag/
260])
261
262# turn the test part of the next block into a function, so it can be
263# called multiple times for $dag_root, /root/dag, /usr/local/lib
264libtrace_dag=false
265libtrace_dag2_4=false
266if test "$with_dag" != no; then
267        AC_MSG_CHECKING(whether we have DAG API)
268
269        if test -r "$dag_root/lib"; then
270                dag_lib_dir="$dag_root/lib"
271        else
272                dag_lib_dir="$dag_root"
273        fi
274       
275        if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
276                dag_tools_dir="$dag_root/tools"
277                dag_include_dir="$dag_root/include"
278        else
279                dag_tools_dir="$dag_root"
280                dag_include_dir="$dag_root"
281        fi
282
283        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
284        then
285                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
286                ADD_LIBS="$ADD_LIBS -ldag"
287                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
288                DAG_TOOLS_DIR=$dag_tools_dir
289                AC_SUBST([DAG_TOOLS_DIR])
290                libtrace_dag=true
291               
292                AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
293                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support])
294        else
295                if test "$want_dag" = yes; then
296                        AC_MSG_ERROR(DAG API not found under directory $dag_root
297; use --without-dag)
298                fi
299                libtrace_dag=false
300        fi
301        AC_MSG_RESULT($libtrace_dag)
302       
303        AC_MSG_CHECKING(if we are using DAG 2.4)
304        if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then
305                libtrace_dag2_4=true
306        else
307                libtrace_dag2_4=false
308        fi
309        AC_MSG_RESULT($libtrace_dag2_4)
310else
311        AC_DEFINE(HAVE_DAG,0,[conditional for building with DAG support])
312fi
313
314
315
316
317
318AC_ARG_WITH([zlib],
319    AC_HELP_STRING([--with-zlib],
320                               [name of zlib library (default is z)]),
321        [ac_cv_use_zlib=$withval],
322    [ac_cv_use_zlib=z])
323
324AC_ARG_WITH([zlib-path],
325    AC_HELP_STRING([--with-zlib-path],
326                   [location of zlib library (default is /usr/lib)]),
327    [ac_cv_use_zlib_path=$withval],
328    [ac_cv_use_zlib_path=/usr/lib])
329
330libtrace_zlib=false
331if test "$ac_cv_use_zlib" != no; then
332   
333    zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so"
334
335    # if the library is in /usr/lib/, then just use AC_CHECK_LIB
336    if test x"${ac_cv_use_zlib_path}" == x"/usr/lib"; then
337            AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen,
338                         libtrace_zlib=true,
339                         libtrace_zlib=false)
340    else
341        ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path"
342        # if it's not in /usr/lib/, check manually. This isn't nice
343        # and will probably break.
344        if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then
345                AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
346                AC_MSG_ERROR([Exiting]);
347        else
348                libtrace_zlib=true
349        fi
350    fi
351fi
352
353if test $libtrace_zlib = true; then
354        ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib"
355        AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support])
356else
357        AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support])   
358fi
359
360AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
361AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true])
362AM_CONDITIONAL([HAVE_CXX], [test "$libtrace_cxx" = true])
363AM_CONDITIONAL([HAVE_ZLIB], [test "$libtrace_zlib" = true])
364AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
365AM_CONDITIONAL([LIBPACKETDUMP], [test "$libtrace_libpacketdump" = true])
366AM_CONDITIONAL([LIBTRACE_TOOLS], [test "$libtrace_tools" = true])
367AM_CONDITIONAL([LIBGDC], [test "$libtrace_gdc" = true])
368
369
370# Check for miscellaneous programs
371AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
372
373AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
374
375
376AC_SUBST([ADD_LIBS])
377AC_SUBST([ADD_LDFLAGS])
378AC_SUBST([ADD_INCLS])
379AC_SUBST([LTLIBOBJS])
380AC_SUBST([MANPAGES])
381
382dnl and finally, output our Makefiles
383AC_OUTPUT
384
385reportopt() {
386        if test x"$2" = xtrue -o x"$2" = xyes; then
387                AC_MSG_NOTICE([$1: Yes])
388        else
389                AC_MSG_NOTICE([$1: No])
390        fi
391}
392
393reportopt "Compiled with BPF filter support" $libtrace_bpf
394reportopt "Compiled with PCAP support" $libtrace_pcap
395reportopt "Compiled with compressed trace (zlib) support" $libtrace_zlib
396reportopt "Compiled with DAG support (libdag)" $libtrace_dag
397reportopt "Compiled with DAG support (DAG 2.4)" $libtrace_dag2_4
398reportopt "Building man pages/documentation" $libtrace_doxygen
399reportopt "Building libpacketdump" $libtrace_libpacketdump
400reportopt "Building tools/ directory" $libtrace_tools
401
Note: See TracBrowser for help on using the repository browser.