source: configure.in @ 8bfa671

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

fixed tests for pcap_open_dead etc, so that they only test if we actually have pcap installed anyway

  • Property mode set to 100644
File size: 8.3 KB
Line 
1# Process this file with autoconf to produce a configure script.
2
3LIBTRACE_MAJOR=2
4LIBTRACE_MID=0
5LIBTRACE_MINOR=24
6
7AC_INIT(libtrace,2.0.24,[contact@wand.net.nz],libtrace)
8AC_CONFIG_SRCDIR(lib/trace.c)
9AM_INIT_AUTOMAKE(libtrace,2.0.24)
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 header files.
28AC_HEADER_STDC
29dnl 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)
30AC_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 )
31
32AC_CHECK_HEADERS(netinet/in.h)
33
34AC_CHECK_HEADER(net/if.h,
35                AC_DEFINE(HAVE_NET_IF_H,1,[We have net/if.h]), [],
36[#include <sys/types.h>
37 #include <sys/socket.h>
38])
39
40
41AC_CHECK_HEADER(netinet/if_ether.h,
42                AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[We have netinet/if_ether.h]), [],
43[
44 #include <sys/types.h>
45 #include <sys/socket.h>
46 #include <netinet/in.h>
47 #include <net/if.h>
48])
49
50AC_CHECK_HEADER(net/if_arp.h,
51                AC_DEFINE(HAVE_NET_IF_ARP_H,1,[We have net/if_arp.h]), [],
52[
53 #include <sys/types.h>
54 #include <sys/socket.h>
55 #include <netinet/in.h>
56 #include <net/if.h>
57])
58
59       
60# Checking for the right bpf header to include
61AC_MSG_CHECKING([where the bpf headers are kept])
62echo ""
63bpfh=no
64AC_CHECK_HEADER(pcap-bpf.h,
65        [AC_DEFINE([HAVE_PCAP_BPF_H]) bpfh=pcap-bpf.h])
66if test $bpfh = no; then
67AC_CHECK_HEADER(net/bpf.h,
68        [AC_DEFINE([HAVE_NET_BPF_H]) bpfh=net/bpf.h])
69fi
70
71if test $bpfh = no; then
72  AC_MSG_RESULT([No BPF headers, compiling without support for BPF filters])
73  AC_DEFINE(HAVE_BPF,0,[Conditional for building bpf support])
74  libtrace_bpf=false
75else
76  AC_MSG_RESULT([Using $bpfh])
77  AC_DEFINE(HAVE_BPF,1,[Conditional for building bpf support])
78  libtrace_bpf=true
79fi
80
81
82# Check for various broken functions
83AC_FUNC_MALLOC
84AC_FUNC_REALLOC
85
86# *BSD doesn't have strndup. Currently provide our own.
87AC_REPLACE_FUNCS(strndup)
88
89# Check to see if we have libpcap
90AC_CHECK_LIB(pcap,pcap_open_live,
91             libtrace_pcap=true,
92             libtrace_pcap=false)
93
94if test "$libtrace_pcap" = true; then
95    AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support])
96    ADD_LIBS="$ADD_LIBS  -lpcap"
97else
98    AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support])
99fi     
100
101# Only test for these functions if we have PCAP installed
102        if test "$libtrace_pcap" = true; then
103        # Earlier versions of pcap don't have pcap_open_dead. EG: the one
104        # OpenBSD ships with. Even Debian Woody is more up to date.
105        AC_CHECK_LIB(pcap,pcap_open_dead,
106                have_pcap_open_dead=true,
107                have_pcap_open_dead=false)
108
109        if test "$have_pcap_open_dead" = false; then
110                AC_REPLACE_FUNCS(pcap_open_dead)
111        fi
112   
113        # Versions of libpcap earlier than 0.8 don't have pcap_dump_flush
114        AC_CHECK_LIB(pcap,pcap_dump_flush,
115                     have_pcap_dump_flush=true,
116                     have_pcap_dump_flush=false)
117
118        if test "$have_pcap_dump_flush" = false; then
119                AC_REPLACE_FUNCS(pcap_dump_flush)
120        fi
121fi
122
123# Checks for typedefs, structures, and compiler characteristics.
124AC_C_CONST
125AC_C_INLINE
126AC_C_BIGENDIAN
127AC_TYPE_SIZE_T
128AC_HEADER_TIME
129AC_SYS_LARGEFILE
130
131# Checks for library functions.
132AC_PROG_GCC_TRADITIONAL
133AC_CHECK_FUNCS(socket strdup)
134
135# configure time options for man pages
136AC_ARG_WITH(man,
137            AC_HELP_STRING([--with-man],
138                           [install man pages by default]),
139
140             if test "$withval" = yes
141             then
142                     MANPAGES="docs/man/man3/[a-zA-Z]*.3]"
143             else
144                     MANPAGES=""
145             fi
146)
147
148# configure time options for use of DAG cards
149# borrowed from libpcap!
150AC_ARG_WITH(dag,
151            AC_HELP_STRING([--with-dag[=DIR]],
152                           [include DAG support (located in directory DIR, if supplied)]),
153[
154        if test "$withval" = no
155        then
156                want_dag=no
157        elif test "$withval" = yes
158        then
159                want_dag=yes
160                dag_root=/root/dag
161        else
162                want_dag=yes
163                dag_root=$withval
164        fi
165],[
166        #
167        # Use DAG API if present, otherwise don't
168        #
169        want_dag=ifpresent
170        dag_root=/root/dag/
171])
172
173# turn the test part of the next block into a function, so it can be
174# called multiple times for $dag_root, /root/dag, /usr/local/lib
175libtrace_dag=false
176libtrace_dag2_4=false
177if test "$with_dag" != no; then
178        AC_MSG_CHECKING(whether we have DAG API)
179
180        if test -r "$dag_root/lib"; then
181                dag_lib_dir="$dag_root/lib"
182        else
183                dag_lib_dir="$dag_root"
184        fi
185       
186        if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
187                dag_tools_dir="$dag_root/tools"
188                dag_include_dir="$dag_root/include"
189        else
190                dag_tools_dir="$dag_root"
191                dag_include_dir="$dag_root"
192        fi
193
194        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
195        then
196                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
197                ADD_LIBS="$ADD_LIBS -ldag"
198                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
199                DAG_TOOLS_DIR=$dag_tools_dir
200                AC_SUBST([DAG_TOOLS_DIR])
201                libtrace_dag=true
202               
203                AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
204                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support])
205        else
206                if test "$want_dag" = yes; then
207                        AC_MSG_ERROR(DAG API not found under directory $dag_root
208; use --without-dag)
209                fi
210                libtrace_dag=false
211        fi
212        AC_MSG_RESULT($libtrace_dag)
213       
214        AC_MSG_CHECKING(if we are using DAG 2.4)
215        if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then
216                libtrace_dag2_4=true
217        else
218                libtrace_dag2_4=false
219        fi
220        AC_MSG_RESULT($libtrace_dag2_4)
221else
222        AC_DEFINE(HAVE_DAG,0,[conditional for building with DAG support])
223fi
224
225AM_CONDITIONAL(HAVE_DAG, test x$libtrace_dag = xtrue)
226AM_CONDITIONAL(DAG2_4, test x$libtrace_dag2_4 = xtrue)
227
228
229# Check for miscellaneous programs
230AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
231
232AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
233
234
235
236
237AC_ARG_WITH([zlib],
238    AC_HELP_STRING([--with-zlib],
239                               [name of zlib library (default is z)]),
240        [ac_cv_use_zlib=$withval],
241    [ac_cv_use_zlib=z])
242
243AC_ARG_WITH([zlib-path],
244    AC_HELP_STRING([--with-zlib-path],
245                   [location of zlib library (default is /usr/lib)]),
246    [ac_cv_use_zlib_path=$withval],
247    [ac_cv_use_zlib_path=/usr/lib])
248
249libtrace_zlib=false
250if test "$ac_cv_use_zlib" != no; then
251   
252    zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so"
253
254    # if the library is in /usr/lib/, then just use AC_CHECK_LIB
255    if test x"${ac_cv_use_zlib_path}" == x"/usr/lib"; then
256            AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen,
257                         libtrace_zlib=true,
258                         libtrace_zlib=false)
259    else
260        ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path"
261        # if it's not in /usr/lib/, check manually. This isn't nice
262        # and will probably break.
263        if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then
264                AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
265                AC_MSG_ERROR([Exiting]);
266        else
267                libtrace_zlib=true
268        fi
269    fi
270fi
271
272if test $libtrace_zlib = true; then
273        ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib"
274        AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support])
275else
276        AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support])   
277fi
278
279
280
281AC_SUBST([ADD_LIBS])
282AC_SUBST([ADD_LDFLAGS])
283AC_SUBST([ADD_INCLS])
284AC_SUBST([LTLIBOBJS])
285AC_SUBST([MANPAGES])
286AC_SUBST([LIBTRACE_VERSION])
287AC_SUBST(LIBTRACE_LT_VERSION)
288
289dnl and finally, output our Makefiles
290AC_OUTPUT
291
292function reportopt() {
293        if test x"$2" = xtrue -o x"$2" = xyes; then
294                AC_MSG_NOTICE([$1: Yes])
295        else
296                AC_MSG_NOTICE([$1: No])
297        fi
298}
299
300reportopt "Compiled with BPF filter support" $libtrace_bpf
301reportopt "Compiled with PCAP support" $libtrace_pcap
302reportopt "Compiled with compressed trace (zlib) support" $libtrace_zlib
303reportopt "Compiled with DAG support (libdag)" $libtrace_dag
304reportopt "Compiled with DAG support (DAG 2.4)" $libtrace_dag2_4
305reportopt "Building man pages/documentation" $libtrace_doxygen
306
Note: See TracBrowser for help on using the repository browser.