source: configure.in @ 470afa7

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

Always compile with -Wall

  • Property mode set to 100644
File size: 8.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.0-beta4],[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"
52fi
53
54AC_PROG_LIBTOOL
55
56AC_ARG_ENABLE(swig,
57[  --disable-swig               don't generate python bindings],
58lt_use_python=true,lt_use_python=false)
59
60if test "x$lt_use_python" = "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_open_live)
131AC_REPLACE_FUNCS(pcap_open_dead)
132AC_REPLACE_FUNCS(pcap_dump_flush)
133AC_REPLACE_FUNCS(pcap_next_ex)
134AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
135AC_CHECK_DECLS([BIOCSETIF],,,[
136#include <sys/types.h>
137#include <sys/time.h>
138#include <sys/ioctl.h>
139#include <net/bpf.h>
140])
141
142# configure time options for man pages
143AC_ARG_WITH(man,
144            AS_HELP_STRING(--with-man,install man pages by default),
145
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
156# configure time options for use of DAG cards
157# borrowed from libpcap!
158AC_ARG_WITH(dag,
159            AS_HELP_STRING(--with-dag[=DIR],include DAG support (located in directory DIR, if supplied)),
160[
161        if test "$withval" = no
162        then
163                want_dag=no
164        elif test "$withval" = yes
165        then
166                want_dag=yes
167                dag_root=/root/dag
168        else
169                want_dag=yes
170                dag_root=$withval
171        fi
172],[
173        #
174        # Use DAG API if present, otherwise don't
175        #
176        want_dag=ifpresent
177        dag_root=/root/dag/
178])
179
180# turn the test part of the next block into a function, so it can be
181# called multiple times for $dag_root, /root/dag, /usr/local/lib
182libtrace_dag=false
183libtrace_dag2_4=false
184if test "$with_dag" != no; then
185        AC_MSG_CHECKING(whether we have DAG API)
186
187        if test -r "$dag_root/lib"; then
188                dag_lib_dir="$dag_root/lib"
189        else
190                dag_lib_dir="$dag_root"
191        fi
192       
193        #if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
194        if test -r "$dag_root/include"; then
195                dag_tools_dir="$dag_root/tools"
196                dag_include_dir="$dag_root/include"
197        else
198                dag_tools_dir="$dag_root"
199                dag_include_dir="$dag_root"
200        fi
201
202        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
203        then
204                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
205                ADD_LIBS="$ADD_LIBS -ldag"
206                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
207                DAG_TOOLS_DIR=$dag_tools_dir
208                AC_SUBST([DAG_TOOLS_DIR])
209                libtrace_dag=true
210               
211                AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
212                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support])
213        else
214                if test "$want_dag" = yes; then
215                        AC_MSG_ERROR(DAG API not found under directory $dag_root
216; use --without-dag)
217                fi
218                libtrace_dag=false
219        fi
220        AC_MSG_RESULT($libtrace_dag)
221       
222        AC_MSG_CHECKING(if we are using DAG 2.4)
223        if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then
224                libtrace_dag2_4=true
225                AC_DEFINE(DAG_VERSION_2_4, 1, [define if using DAG 2.4])
226        else
227                libtrace_dag2_4=false
228        fi
229        AC_MSG_RESULT($libtrace_dag2_4)
230fi
231
232AC_CHECK_LIB(z, gzopen)
233
234libtrace_swig=false;
235if test -n "$SWIG"; then
236        libtrace_swig=true;
237fi
238libtrace_python=false;
239if test -n "$PYTHON"; then
240        libtrace_python=true;
241fi
242
243AM_CONDITIONAL([HAVE_BPF], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
244AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
245AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true])
246AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_gzopen" = yes])
247AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
248AM_CONDITIONAL([LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
249AM_CONDITIONAL([LIBTRACE_SWIG], [test "$libtrace_swig" = true])
250#AM_CONDITIONAL([HAVE_PYTHON], [test "$libtrace_python" = true])
251
252# Check for miscellaneous programs
253AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
254
255AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
256
257
258AC_SUBST([ADD_LIBS])
259AC_SUBST([ADD_LDFLAGS])
260AC_SUBST([ADD_INCLS])
261AC_SUBST([LTLIBOBJS])
262AC_SUBST([MANPAGES])
263AC_SUBST([PACKAGE_VERSION])
264AC_SUBST([LIBTRACE_MAJOR])
265AC_SUBST([LIBTRACE_MID])
266AC_SUBST([LIBTRACE_MINOR])
267
268dnl and finally, output our Makefiles
269AC_OUTPUT
270
271reportopt() {
272        if test x"$2" = xtrue -o x"$2" = xyes; then
273                AC_MSG_NOTICE([$1: Yes])
274        else
275                AC_MSG_NOTICE([$1: No])
276        fi
277}
278
279echo
280AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
281reportopt "Compiled with PCAP support" $ac_cv_lib_pcap_pcap_open_live
282reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_gzopen
283if test x"$libtrace_dag" = xtrue; then
284        if test x"$libtrace_dag2_4"; then
285                AC_MSG_NOTICE([Compiled with DAG support: 2.4])
286        else
287                AC_MSG_NOTICE([Compiled with DAG support: 2.5])
288        fi
289else
290        AC_MSG_NOTICE([Compiled with DAG support: No])
291fi
292reportopt "Building man pages/documentation" $libtrace_doxygen
293
294if test x"$libtrace_swig" = xtrue; then
295H
296        if test x"$libtrace_python" = xtrue; then
297                AC_MSG_NOTICE([Building swig bindings for: python])
298        else
299                AC_MSG_NOTICE([Building swig bindings for: Nothing])
300        fi
301else
302        AC_MSG_NOTICE([Not building swig bindings])
303fi
Note: See TracBrowser for help on using the repository browser.