source: configure.in @ 5b91b48

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 5b91b48 was 14d8a63, checked in by Daniel Lawson <dlawson@…>, 16 years ago

update to version 3.0.0
zero-copy patch - trace.c updated with new trace_create_packet() etc
format_*.c updated with zero-copy codepath

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