source: configure.in @ 41b53c2

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 41b53c2 was 41b53c2, checked in by Daniel Lawson <dlawson@…>, 15 years ago

2.0.25

Fixes for builds under openbsd:

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