source: configure.in @ 9d7d9e9

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 9d7d9e9 was 9d7d9e9, checked in by Perry Lorier <perry@…>, 15 years ago
  • Clarify the documentation for trace_read_packet()
  • Force blocking mode in pcap
  • Property mode set to 100644
File size: 11.4 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)
164
165        AC_CHECK_LIB(pcap,pcap_setnonblock,
166                        AC_DEFINE(HAVE_PCAP_SETNONBLOCK,1,[pcap has pcap_setnonblock]),
167                        have_pcap_setnonblock=false)
168fi
169
170
171# configure time options for man pages
172AC_ARG_WITH(man,
173            AC_HELP_STRING([--with-man],
174                           [install man pages by default]),
175
176             if test "$withval" = yes
177             then
178                     MANPAGES="docs/man/man3/[a-zA-Z]*.3]"
179             else
180                     MANPAGES=""
181             fi
182)
183
184# configure time option for building libpacketdump
185# libpacketdump needs a C++ compiler to build, so we should do some tests
186# at this point to see if one is installed
187libtrace_libpacketdump=true
188AC_ARG_ENABLE(libpacketdump,
189              AC_HELP_STRING([--disable-libpacketdump],
190                             [disable building of libpacketdump (enabled by default). libpacketdump needs a c++ compiler to build] ),
191[
192        if test "$enableval" = no -o "$enableval" = false
193        then
194                libtrace_libpacketdump=false
195        else
196                libtrace_libpacketdump=true
197        fi
198],
199[
200        libtrace_libpacketdump=true
201])
202
203if test "$libtrace_libpacketdump" = true; then
204        AC_LANG_PUSH(C++)
205        AC_MSG_CHECKING([if we can compile C++ ])
206        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
207                           [[
208#include <iostream>
209                           ]])],
210                [AC_DEFINE(HAVE_CXX,1,[define to test for presence of a working C++ compiler]) libtrace_cxx=true],
211                [AC_DEFINE(HAVE_CXX,0,[define to test for presence of a working C++ compiler]) libtrace_cxx=false])
212
213        AC_MSG_RESULT($libtrace_cxx)   
214        AC_LANG_POP(C++)
215
216        if test "$libtrace_cxx" = false; then
217                AC_MSG_ERROR([libpacketdump requested, but no C++ compiler found. Build with --disable-libpacketdump if you wish to continue anyway ])
218        fi
219fi
220
221# configure time option for building the libtrace tools
222# one of the tools requires libpacketdump, so won't build if libpacketdump
223# hasn't also been built
224libtrace_tools=true
225AC_ARG_ENABLE(tools,
226              AC_HELP_STRING([--disable-tools],
227                             [disable building of the tools contained in the tools/ directory]),
228[
229        if test "$enableval" = no -o "$enableval" = false
230        then
231                libtrace_tools=false
232        else
233                libtrace_tools=true
234        fi
235       
236],
237[
238        libtrace_tools=true
239])
240
241# configure time options for use of DAG cards
242# borrowed from libpcap!
243AC_ARG_WITH(dag,
244            AC_HELP_STRING([--with-dag[=DIR]],
245                           [include DAG support (located in directory DIR, if supplied)]),
246[
247        if test "$withval" = no
248        then
249                want_dag=no
250        elif test "$withval" = yes
251        then
252                want_dag=yes
253                dag_root=/root/dag
254        else
255                want_dag=yes
256                dag_root=$withval
257        fi
258],[
259        #
260        # Use DAG API if present, otherwise don't
261        #
262        want_dag=ifpresent
263        dag_root=/root/dag/
264])
265
266# turn the test part of the next block into a function, so it can be
267# called multiple times for $dag_root, /root/dag, /usr/local/lib
268libtrace_dag=false
269libtrace_dag2_4=false
270if test "$with_dag" != no; then
271        AC_MSG_CHECKING(whether we have DAG API)
272
273        if test -r "$dag_root/lib"; then
274                dag_lib_dir="$dag_root/lib"
275        else
276                dag_lib_dir="$dag_root"
277        fi
278       
279        if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
280                dag_tools_dir="$dag_root/tools"
281                dag_include_dir="$dag_root/include"
282        else
283                dag_tools_dir="$dag_root"
284                dag_include_dir="$dag_root"
285        fi
286
287        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
288        then
289                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
290                ADD_LIBS="$ADD_LIBS -ldag"
291                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
292                DAG_TOOLS_DIR=$dag_tools_dir
293                AC_SUBST([DAG_TOOLS_DIR])
294                libtrace_dag=true
295               
296                AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
297                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support])
298        else
299                if test "$want_dag" = yes; then
300                        AC_MSG_ERROR(DAG API not found under directory $dag_root
301; use --without-dag)
302                fi
303                libtrace_dag=false
304        fi
305        AC_MSG_RESULT($libtrace_dag)
306       
307        AC_MSG_CHECKING(if we are using DAG 2.4)
308        if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then
309                libtrace_dag2_4=true
310        else
311                libtrace_dag2_4=false
312        fi
313        AC_MSG_RESULT($libtrace_dag2_4)
314else
315        AC_DEFINE(HAVE_DAG,0,[conditional for building with DAG support])
316fi
317
318
319
320
321
322AC_ARG_WITH([zlib],
323    AC_HELP_STRING([--with-zlib],
324                               [name of zlib library (default is z)]),
325        [ac_cv_use_zlib=$withval],
326    [ac_cv_use_zlib=z])
327
328AC_ARG_WITH([zlib-path],
329    AC_HELP_STRING([--with-zlib-path],
330                   [location of zlib library (default is /usr/lib)]),
331    [ac_cv_use_zlib_path=$withval],
332    [ac_cv_use_zlib_path=/usr/lib])
333
334libtrace_zlib=false
335if test "$ac_cv_use_zlib" != no; then
336   
337    zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so"
338
339    # if the library is in /usr/lib/, then just use AC_CHECK_LIB
340    if test x"${ac_cv_use_zlib_path}" == x"/usr/lib"; then
341            AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen,
342                         libtrace_zlib=true,
343                         libtrace_zlib=false)
344    else
345        ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path"
346        # if it's not in /usr/lib/, check manually. This isn't nice
347        # and will probably break.
348        if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then
349                AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
350                AC_MSG_ERROR([Exiting]);
351        else
352                libtrace_zlib=true
353        fi
354    fi
355fi
356
357if test $libtrace_zlib = true; then
358        ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib"
359        AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support])
360else
361        AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support])   
362fi
363
364AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
365AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true])
366AM_CONDITIONAL([HAVE_CXX], [test "$libtrace_cxx" = true])
367AM_CONDITIONAL([HAVE_ZLIB], [test "$libtrace_zlib" = true])
368AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
369AM_CONDITIONAL([LIBPACKETDUMP], [test "$libtrace_libpacketdump" = true])
370AM_CONDITIONAL([LIBTRACE_TOOLS], [test "$libtrace_tools" = true])
371AM_CONDITIONAL([LIBGDC], [test "$libtrace_gdc" = true])
372
373
374# Check for miscellaneous programs
375AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
376
377AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
378
379
380AC_SUBST([ADD_LIBS])
381AC_SUBST([ADD_LDFLAGS])
382AC_SUBST([ADD_INCLS])
383AC_SUBST([LTLIBOBJS])
384AC_SUBST([MANPAGES])
385
386dnl and finally, output our Makefiles
387AC_OUTPUT
388
389reportopt() {
390        if test x"$2" = xtrue -o x"$2" = xyes; then
391                AC_MSG_NOTICE([$1: Yes])
392        else
393                AC_MSG_NOTICE([$1: No])
394        fi
395}
396
397reportopt "Compiled with BPF filter support" $libtrace_bpf
398reportopt "Compiled with PCAP support" $libtrace_pcap
399reportopt "Compiled with compressed trace (zlib) support" $libtrace_zlib
400reportopt "Compiled with DAG support (libdag)" $libtrace_dag
401reportopt "Compiled with DAG support (DAG 2.4)" $libtrace_dag2_4
402reportopt "Building man pages/documentation" $libtrace_doxygen
403reportopt "Building libpacketdump" $libtrace_libpacketdump
404reportopt "Building tools/ directory" $libtrace_tools
405
Note: See TracBrowser for help on using the repository browser.