source: configure.in @ 6e565d9

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

Have a quieter build on automake >=1.11

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