source: configure.in @ 544c680

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 544c680 was 544c680, checked in by Shane Alcock <salcock@…>, 14 years ago

libpcap0.8 is now REQUIRED for libtrace to build - updated configure to do a proper check for pcap0.8 and to fail if it is not present

  • Property mode set to 100644
File size: 8.3 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.0beta7],[contact@wand.net.nz],[libtrace])
7
8LIBTRACE_MAJOR=3
9LIBTRACE_MID=0
10LIBTRACE_MINOR=0
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/tracedump/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        docs/libtrace.doxygen
26        lib/libtrace.h
27        swig/Makefile])
28dnl GNU C library
29dnl AC_GNU_SOURCE
30
31
32AM_CONFIG_HEADER([config.h])
33dnl Checks for programs.
34AC_PROG_CC
35AC_PROG_CXX
36AC_PROG_INSTALL
37AC_PROG_YACC
38AM_PROG_LEX
39
40AC_CONFIG_LIBOBJ_DIR(lib)
41
42# Checks for typedefs, structures, and compiler characteristics.
43AC_C_CONST
44AC_C_INLINE
45AC_C_BIGENDIAN
46AC_TYPE_SIZE_T
47AC_HEADER_TIME
48AC_SYS_LARGEFILE
49
50if test "$GCC" = "yes"; then
51        CFLAGS="$CFLAGS -Wall -W"
52fi
53
54AC_PROG_LIBTOOL
55
56AC_ARG_ENABLE(swig,
57[  --disable-swig               don't generate swig bindings],
58lt_use_swig=true,lt_use_swig=false)
59
60if test "x$lt_use_swig" = "xtrue"
61then
62        AM_PATH_PYTHON(2.3)
63        AC_PROG_SWIG(1.3.21)
64        SWIG_PYTHON
65fi
66
67# Checks for library functions.
68AC_PROG_GCC_TRADITIONAL
69AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf)
70
71AC_CHECK_SIZEOF([long int])
72
73
74
75# Check for various broken functions
76AC_FUNC_MALLOC
77AC_FUNC_REALLOC
78
79# *BSD doesn't have strndup. Currently provide our own.
80AC_REPLACE_FUNCS(strndup)
81
82# Checks for header files.
83AC_HEADER_STDC
84dnl 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)
85AC_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 )
86
87AC_CHECK_HEADERS(netinet/in.h)
88AC_CHECK_HEADERS(netpacket/packet.h,[
89        libtrace_netpacket_packet_h=true
90        AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net])
91])
92AC_CHECK_HEADER(net/if.h,
93        AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[
94 #include <sys/types.h>
95 #include <sys/socket.h>
96])
97
98AC_CHECK_HEADER(netinet/ether.h,
99        AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[
100 #include <sys/types.h>
101 #include <sys/socket.h>
102 #include <netinet/in.h>
103 #include <net/if.h>
104])
105
106AC_CHECK_HEADER(netinet/if_ether.h,
107        AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[
108 #include <sys/types.h>
109 #include <sys/socket.h>
110 #include <netinet/in.h>
111 #include <net/if.h>
112])
113
114AC_CHECK_HEADER(net/if_arp.h,
115        AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[
116 #include <sys/types.h>
117 #include <sys/socket.h>
118 #include <netinet/in.h>
119 #include <net/if.h>
120])
121
122# Checking for the right bpf header to include
123AC_CHECK_HEADER(pcap-bpf.h)
124AC_CHECK_HEADER(net/bpf.h)
125AC_CHECK_HEADER(gdc.h)
126
127# Check to see if we have libdl - *BSD has built-in libdl
128AC_CHECK_LIB(dl, dlopen)
129# check pcap
130AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0)
131#AC_CHECK_LIB(pcap,pcap_next_ex)
132#AC_REPLACE_FUNCS(pcap_open_dead)
133#AC_REPLACE_FUNCS(pcap_dump_flush)
134#AC_REPLACE_FUNCS(pcap_next_ex)
135AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
136AC_CHECK_DECLS([BIOCSETIF],,,[
137#include <sys/types.h>
138#include <sys/time.h>
139#include <sys/ioctl.h>
140#include <net/bpf.h>
141])
142
143# configure time options for man pages
144AC_ARG_WITH(man,
145            AS_HELP_STRING(--with-man,install man pages by default),[
146             if test "$withval" = yes
147             then
148                     MANPAGES="docs/man/man3/[a-zA-Z]*.3"
149             else
150                     MANPAGES=""
151             fi
152])
153
154AC_PROG_CXX
155
156if test "$pcapfound" = 0; then
157        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)
158else
159        ADD_LIBS="$ADD_LIBS -lpcap"
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 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# turn the test part of the next block into a function, so it can be
187# called multiple times for $dag_root, /root/dag, /usr/local/lib
188libtrace_dag=false
189libtrace_dag2_4=false
190if test "$with_dag" != no; then
191        AC_MSG_CHECKING(whether we have DAG API)
192
193        if test -r "$dag_root/lib"; then
194                dag_lib_dir="$dag_root/lib"
195        else
196                dag_lib_dir="$dag_root"
197        fi
198       
199        if test -r "$dag_root/include"; then
200                dag_tools_dir="$dag_root/tools"
201                dag_include_dir="$dag_root/include"
202        else
203                dag_tools_dir="$dag_root"
204                dag_include_dir="$dag_root"
205        fi
206
207        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
208        then
209                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
210                ADD_LIBS="$ADD_LIBS -ldag"
211                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
212                DAG_TOOLS_DIR=$dag_tools_dir
213                AC_SUBST([DAG_TOOLS_DIR])
214                libtrace_dag=true
215               
216                AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
217                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support])
218        else
219                if test "$want_dag" = yes; then
220                        AC_MSG_ERROR(DAG API not found under directory $dag_root
221; use --without-dag)
222                fi
223                libtrace_dag=false
224        fi
225        AC_MSG_RESULT($libtrace_dag)
226       
227        AC_MSG_CHECKING(if we are using DAG 2.4)
228        if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then
229                libtrace_dag2_4=true
230                AC_DEFINE(DAG_VERSION_2_4, 1, [define if using DAG 2.4])
231        else
232                libtrace_dag2_4=false
233        fi
234        AC_MSG_RESULT($libtrace_dag2_4)
235fi
236
237AC_CHECK_LIB(z, gzopen)
238
239libtrace_swig=false;
240if test -n "$SWIG"; then
241        libtrace_swig=true;
242fi
243libtrace_python=false;
244if test -n "$PYTHON"; then
245        libtrace_python=true;
246fi
247
248AM_CONDITIONAL([HAVE_BPF], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
249AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
250AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true])
251AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_gzopen" = yes])
252AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
253AM_CONDITIONAL([LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
254AM_CONDITIONAL([LIBTRACE_SWIG], [test "$libtrace_swig" = true])
255#AM_CONDITIONAL([HAVE_PYTHON], [test "$libtrace_python" = true])
256
257# Check for miscellaneous programs
258AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
259
260AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
261
262
263AC_SUBST([ADD_LIBS])
264AC_SUBST([ADD_LDFLAGS])
265AC_SUBST([ADD_INCLS])
266AC_SUBST([LTLIBOBJS])
267AC_SUBST([MANPAGES])
268AC_SUBST([PACKAGE_VERSION])
269AC_SUBST([LIBTRACE_MAJOR])
270AC_SUBST([LIBTRACE_MID])
271AC_SUBST([LIBTRACE_MINOR])
272
273dnl and finally, output our Makefiles
274AC_OUTPUT
275
276reportopt() {
277        if test x"$2" = xtrue -o x"$2" = xyes; then
278                AC_MSG_NOTICE([$1: Yes])
279        else
280                AC_MSG_NOTICE([$1: No])
281        fi
282}
283
284echo
285AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
286reportopt "Compiled with PCAP 0.8 support" $ac_cv_lib_pcap_pcap_next_ex
287reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_gzopen
288if test x"$libtrace_dag" = xtrue; then
289        if test x"$libtrace_dag2_4"; then
290                AC_MSG_NOTICE([Compiled with DAG support: 2.4])
291        else
292                AC_MSG_NOTICE([Compiled with DAG support: 2.5])
293        fi
294else
295        AC_MSG_NOTICE([Compiled with DAG support: No])
296fi
297reportopt "Building man pages/documentation" $libtrace_doxygen
298
299if test x"$libtrace_swig" = xtrue; then
300        if test x"$libtrace_python" = xtrue; then
301                AC_MSG_NOTICE([Building swig bindings for: python])
302        else
303                AC_MSG_NOTICE([Building swig bindings for: Nothing])
304        fi
305else
306        AC_MSG_NOTICE([Not building swig bindings])
307fi
Note: See TracBrowser for help on using the repository browser.