source: configure.in @ 66cf27f

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

Changed AC_PROG_YACC test for AC_CHECK_PROGS, as AC_PROG_YACC assumes "yacc" is always installed

Added checks to see if $YACC and $LEXLIB are populated. If not, generate a warning saying the tools aren't installed but are required, and increment and error counter. Finally, check the errorcounter and generate a critical error if nonzero.

Test $LEXLIB because it will be empty if there's no lex installed - $LEX gets filled with a autoconf "missing" command instead, which simply results in deferred failure (eg, at the point it tries to use lex)

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