source: configure.in @ f1ab057

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

Use -fvisibility=hidden only for libtrace

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