source: configure.in @ 37dc1fb

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

removed Makefile from cvs
updated tracedump to fix compiler warning

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