source: configure.in @ f20d66c

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since f20d66c was f20d66c, checked in by Perry Lorier <perry@…>, 12 years ago

Fix some warnings found on mroe recent gcc's
Bump version and release 3.0.6

  • Property mode set to 100644
File size: 9.1 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.6],[contact@wand.net.nz],[libtrace])
7
8LIBTRACE_MAJOR=3
9LIBTRACE_MID=0
10LIBTRACE_MINOR=6
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/tracepktdump/Makefile
21        tools/tracemerge/Makefile tools/tracereport/Makefile
22        tools/tracertstats/Makefile tools/tracesplit/Makefile
23        tools/tracestats/Makefile
24        examples/Makefile examples/skeleton/Makefile examples/rate/Makefile
25        examples/stats/Makefile
26        docs/libtrace.doxygen
27        lib/libtrace.h
28        ])
29dnl GNU C library
30dnl AC_GNU_SOURCE
31
32
33AM_CONFIG_HEADER([config.h])
34dnl Checks for programs.
35AC_PROG_CC
36AC_PROG_CXX
37AC_PROG_INSTALL
38AC_PROG_YACC
39AM_PROG_LEX
40
41AC_CONFIG_LIBOBJ_DIR(lib)
42
43# Checks for typedefs, structures, and compiler characteristics.
44AC_C_CONST
45AC_C_INLINE
46AC_C_BIGENDIAN
47AC_TYPE_SIZE_T
48AC_HEADER_TIME
49AC_SYS_LARGEFILE
50
51if test "$GCC" = "yes"; then
52        CFLAGS="$CFLAGS -Wall -W -Wmissing-prototypes"
53fi
54
55AC_PROG_LIBTOOL
56
57# Checks for library functions.
58AC_PROG_GCC_TRADITIONAL
59AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf)
60
61AC_CHECK_SIZEOF([long int])
62
63
64
65# Check for various broken functions
66AC_FUNC_MALLOC
67AC_FUNC_REALLOC
68
69# *BSD doesn't have strndup. Currently provide our own.
70AC_REPLACE_FUNCS(strndup)
71
72# Checks for header files.
73AC_HEADER_STDC
74AC_CHECK_HEADERS(pcap.h pcap-int.h pcap-bpf.h net/bpf.h sys/limits.h stddef.h inttypes.h limits.h net/ethernet.h )
75
76AC_CHECK_HEADERS(netinet/in.h)
77AC_CHECK_HEADERS(netpacket/packet.h,[
78        libtrace_netpacket_packet_h=true
79        AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net])
80])
81AC_CHECK_HEADER(net/if.h,
82        AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[
83 #include <sys/types.h>
84 #include <sys/socket.h>
85])
86
87AC_CHECK_HEADER(netinet/ether.h,
88        AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[
89 #include <sys/types.h>
90 #include <sys/socket.h>
91 #include <netinet/in.h>
92 #include <net/if.h>
93])
94
95AC_CHECK_HEADER(netinet/if_ether.h,
96        AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[
97 #include <sys/types.h>
98 #include <sys/socket.h>
99 #include <netinet/in.h>
100 #include <net/if.h>
101])
102
103AC_CHECK_HEADER(net/if_arp.h,
104        AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[
105 #include <sys/types.h>
106 #include <sys/socket.h>
107 #include <netinet/in.h>
108 #include <net/if.h>
109])
110
111# Checking for the right bpf header to include
112AC_CHECK_HEADER(pcap-bpf.h)
113AC_CHECK_HEADER(net/bpf.h)
114AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h]))
115
116# Check to see if we have libdl - *BSD has built-in libdl
117AC_CHECK_LIB(dl, dlopen)
118# check pcap
119AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0)
120#AC_CHECK_LIB(pcap,pcap_next_ex)
121#AC_REPLACE_FUNCS(pcap_open_dead)
122#AC_REPLACE_FUNCS(pcap_dump_flush)
123#AC_REPLACE_FUNCS(pcap_next_ex)
124AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
125AC_CHECK_DECLS([BIOCSETIF],,,[
126#include <sys/types.h>
127#include <sys/time.h>
128#include <sys/ioctl.h>
129#include <net/bpf.h>
130])
131
132# configure time options for man pages
133AC_ARG_WITH(man,
134            AS_HELP_STRING(--with-man,install man pages by default),[
135             if test "$withval" = yes
136             then
137                     MANPAGES="docs/man/man3/[a-zA-Z]*.3"
138             else
139                     MANPAGES=""
140             fi
141])
142
143AC_PROG_CXX
144
145if test "$pcapfound" = 0; then
146        AC_MSG_ERROR(libpcap0.8 or greater is required to compile libtrace. If you have installed it in a non-standard location please use LDFLAGS to specify the location of the library)
147else
148        ADD_LIBS="$ADD_LIBS -lpcap"
149        AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support])
150        AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support])
151fi
152
153# configure time options for use of DAG cards
154# borrowed from libpcap!
155AC_ARG_WITH(dag,
156            AS_HELP_STRING(--with-dag[=DIR],include DAG live capture support (located in directory DIR, if supplied)),
157[
158        if test "$withval" = no
159        then
160                want_dag=no
161        elif test "$withval" = yes
162        then
163                want_dag=yes
164                dag_root=/usr/local/dag
165        else
166                want_dag=yes
167                dag_root=$withval
168        fi
169],[
170        #
171        # Use DAG API if present, otherwise don't
172        #
173        want_dag=ifpresent
174        dag_root=/usr/local/dag
175])
176
177# DAG 3.0 actually puts header files and shared libraries into sensible
178# places now, so we should be able to do a simple CHECK_LIB to see if
179# they're there!
180
181# Addendum: It turns out DAG 2.5 does this too, so we'll match DAG2.5 in here
182# also. This isn't such a bad thing, the DAG2.5 API is essentially the same as
183# DAG 3.0 and libtrace will use the same format_dagXX source for both
184libtrace_dag=false
185libtrace_dag_version=none
186
187if test "$with_dag" != no; then
188        AC_CHECK_LIB(dag, dag_open, dag_found=1, dag_found=0)
189        if test "$dag_found" = 1; then
190                ADD_LIBS="$ADD_LIBS -ldag"
191                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
192                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
193                libtrace_dag=true
194               
195                AC_DEFINE(DAG_VERSION,30,[defines the DAG driver version])
196                libtrace_dag_version=30
197        fi
198fi
199
200# turn the test part of the next block into a function, so it can be
201# called multiple times for $dag_root, /root/dag, /usr/local/lib
202dag_drv_v="DAG not present"
203
204# Now check for 2.4 DAG drivers which don't install as cleanly!
205if test "$with_dag" != no -a "$libtrace_dag" = false; then
206        AC_MSG_CHECKING(whether we have DAG 2.4 API instead)
207
208        if test -r "$dag_root/lib"; then
209                dag_lib_dir="$dag_root/lib"
210        else
211                dag_lib_dir="$dag_root"
212        fi
213       
214        if test -r "$dag_root/include"; then
215                dag_tools_dir="$dag_root/tools"
216                dag_include_dir="$dag_root/include"
217        else
218                dag_tools_dir="$dag_root"
219                dag_include_dir="$dag_root"
220        fi
221
222        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
223        then
224                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
225                ADD_LIBS="$ADD_LIBS -ldag"
226                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
227                DAG_TOOLS_DIR=$dag_tools_dir
228                AC_SUBST([DAG_TOOLS_DIR])
229                libtrace_dag=true
230               
231                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
232                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
233                AC_DEFINE(DAG_VERSION, 24, [defines the DAG driver version])
234                libtrace_dag_version=24
235        else
236                if test "$want_dag" = yes; then
237                        AC_MSG_ERROR(DAG API not found under directory $dag_root
238; use --without-dag)
239                fi
240                libtrace_dag=false
241        fi
242        AC_MSG_RESULT($libtrace_dag)
243
244fi
245
246# Try to determine the DAG driver version
247if test x"$libtrace_dag" = xtrue; then
248        dag_drv_v="Unknown"
249        files=`locate /usr/*dag*/VERSION`
250        file_count=0
251
252        for i in $files; do
253                if $file_count > 0; then
254                        dag_drv_v="Indeterminate"
255                        break
256                fi
257                dag_drv_v=`cat $i`
258                file_count=$file_count+1
259        done
260fi
261DAG_VERSION_NUM=$dag_drv_v
262
263
264AC_CHECK_LIB(z, gzopen)
265
266AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
267AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
268AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24])
269AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25])
270AM_CONDITIONAL([DAG3_0], [test "$libtrace_dag_version" = 30])
271AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_gzopen" = yes])
272AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
273AM_CONDITIONAL([HAVE_LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
274
275# Check for miscellaneous programs
276AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
277
278AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
279
280AC_SUBST([ADD_LIBS])
281AC_SUBST([ADD_LDFLAGS])
282AC_SUBST([ADD_INCLS])
283AC_SUBST([LTLIBOBJS])
284AC_SUBST([MANPAGES])
285AC_SUBST([PACKAGE_VERSION])
286AC_SUBST([LIBTRACE_MAJOR])
287AC_SUBST([LIBTRACE_MID])
288AC_SUBST([LIBTRACE_MINOR])
289AC_SUBST([DAG_VERSION_NUM])
290AC_SUBST([HAVE_BPF_CAPTURE])
291AC_SUBST([HAVE_LIBGDC])
292dnl and finally, output our Makefiles
293AC_OUTPUT
294
295reportopt() {
296        if test x"$2" = xtrue -o x"$2" = xyes; then
297                AC_MSG_NOTICE([$1: Yes])
298        else
299                AC_MSG_NOTICE([$1: No])
300        fi
301}
302
303echo
304AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
305reportopt "Compiled with PCAP 0.8 support" $ac_cv_lib_pcap_pcap_next_ex
306reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_gzopen
307if test x"$libtrace_dag" = xtrue; then
308        if test "$libtrace_dag_version" = 24; then
309                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.4])
310        elif test "$libtrace_dag_version" = 30; then
311                AC_MSG_NOTICE([Compiled with DAG live capture support: 3.0])
312        else
313                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.5])
314        fi     
315else
316        AC_MSG_NOTICE([Compiled with DAG live capture support: No])
317fi
318reportopt "Building man pages/documentation" $libtrace_doxygen
319
Note: See TracBrowser for help on using the repository browser.