source: configure.in @ e5f1431

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since e5f1431 was e5f1431, checked in by Shane Alcock <salcock@…>, 14 years ago

Updated build system to require version number changes in only two places
(format)_set_direction no longer takes a const libtrace_packet_t
Removed unnecessary #include <dagformat.h> from linktypes.c
libtrace.h and libtrace.doxygen are now .h.in files - a la libtrace2

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