source: configure.in @ 47de0aa

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 47de0aa was 47de0aa, checked in by Daniel Lawson <dlawson@…>, 14 years ago
  • Cosmetic changes to trace_help() output
  • inclusion of some m4 handlers to deal with swig and python, lifted from http://autoconf-archive.cryp.to/. These are GPLd, which needs to be taken into account if libtrace licensing changes!
  • updated the swig bindings for python. Mostly api compliant now. Still possibly a memory leak to do with displaying ip addresses - I haven't touched this particular part of the code yet.
  • Property mode set to 100644
File size: 7.5 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-beta2,[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        libpacketdump/parser/Makefile
21        tools/Makefile tools/traceanon/Makefile tools/tracedump/Makefile
22        tools/tracemerge/Makefile tools/tracereport/Makefile
23        tools/tracertstats/Makefile tools/tracesplit/Makefile
24        tools/tracestats/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)
33#AC_CONFIG_HEADERS([config.h])
34dnl Checks for programs.
35AC_PROG_CC
36AC_PROG_CXX
37AC_PROG_INSTALL
38AC_PROG_LIBTOOL
39AC_PROG_YACC
40AC_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
52AC_PROG_LIBTOOL
53AM_PATH_PYTHON(2.3)
54AC_PROG_SWIG(1.3.21)
55SWIG_PYTHON
56
57# Checks for library functions.
58AC_PROG_GCC_TRADITIONAL
59AC_CHECK_FUNCS(socket strdup strlcpy)
60
61AC_CHECK_SIZEOF([long int])
62
63
64
65# Check for various broken functions
66AC_FUNC_MALLOC
67AC_FUNC_REALLOC
68
69# *BSD doesn't have strndup. Currently provide our own.
70AC_REPLACE_FUNCS(strndup)
71
72# Checks for header files.
73AC_HEADER_STDC
74dnl 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)
75AC_CHECK_HEADERS(pcap.h pcap-int.h pcap-bpf.h net/bpf.h zlib.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)
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_open_live)
121AC_REPLACE_FUNCS(pcap_open_dead)
122AC_REPLACE_FUNCS(pcap_dump_flush)
123AC_REPLACE_FUNCS(pcap_next_ex)
124AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
125
126# configure time options for man pages
127AC_ARG_WITH(man,
128            AC_HELP_STRING([--with-man],
129                           [install man pages by default]),
130
131             if test "$withval" = yes
132             then
133                     MANPAGES="docs/man/man3/[a-zA-Z]*.3]"
134             else
135                     MANPAGES=""
136             fi
137)
138
139AC_PROG_CXX
140
141# configure time options for use of DAG cards
142# borrowed from libpcap!
143AC_ARG_WITH(dag,
144            AC_HELP_STRING([--with-dag[=DIR]],
145                           [include DAG support (located in directory DIR, if supplied)]),
146[
147        if test "$withval" = no
148        then
149                want_dag=no
150        elif test "$withval" = yes
151        then
152                want_dag=yes
153                dag_root=/root/dag
154        else
155                want_dag=yes
156                dag_root=$withval
157        fi
158],[
159        #
160        # Use DAG API if present, otherwise don't
161        #
162        want_dag=ifpresent
163        dag_root=/root/dag/
164])
165
166# turn the test part of the next block into a function, so it can be
167# called multiple times for $dag_root, /root/dag, /usr/local/lib
168libtrace_dag=false
169libtrace_dag2_4=false
170if test "$with_dag" != no; then
171        AC_MSG_CHECKING(whether we have DAG API)
172
173        if test -r "$dag_root/lib"; then
174                dag_lib_dir="$dag_root/lib"
175        else
176                dag_lib_dir="$dag_root"
177        fi
178       
179        if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
180                dag_tools_dir="$dag_root/tools"
181                dag_include_dir="$dag_root/include"
182        else
183                dag_tools_dir="$dag_root"
184                dag_include_dir="$dag_root"
185        fi
186
187        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
188        then
189                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
190                ADD_LIBS="$ADD_LIBS -ldag"
191                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
192                DAG_TOOLS_DIR=$dag_tools_dir
193                AC_SUBST([DAG_TOOLS_DIR])
194                libtrace_dag=true
195               
196                AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
197                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support])
198        else
199                if test "$want_dag" = yes; then
200                        AC_MSG_ERROR(DAG API not found under directory $dag_root
201; use --without-dag)
202                fi
203                libtrace_dag=false
204        fi
205        AC_MSG_RESULT($libtrace_dag)
206       
207        AC_MSG_CHECKING(if we are using DAG 2.4)
208        if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then
209                libtrace_dag2_4=true
210                AC_DEFINE(DAG_VERSION_2_4, 1, [define if using DAG 2.4])
211        else
212                libtrace_dag2_4=false
213        fi
214        AC_MSG_RESULT($libtrace_dag2_4)
215fi
216
217AC_CHECK_LIB(z, gzopen)
218
219libtrace_swig=false;
220if test -n $SWIG; then
221        libtrace_swig=true;
222fi
223libtrace_python=false;
224if test -n "$PYTHON"; then
225        libtrace_python=true;
226fi
227
228AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
229AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true])
230AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_gzopen" = yes])
231AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
232AM_CONDITIONAL([LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
233AM_CONDITIONAL([LIBTRACE_SWIG], [test "$libtrace_swig" = true])
234#AM_CONDITIONAL([HAVE_PYTHON], [test "$libtrace_python" = true])
235
236# Check for miscellaneous programs
237AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
238
239AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
240
241
242AC_SUBST([ADD_LIBS])
243AC_SUBST([ADD_LDFLAGS])
244AC_SUBST([ADD_INCLS])
245AC_SUBST([LTLIBOBJS])
246AC_SUBST([MANPAGES])
247AC_SUBST([PACKAGE_VERSION])
248AC_SUBST([LIBTRACE_MAJOR])
249AC_SUBST([LIBTRACE_MID])
250AC_SUBST([LIBTRACE_MINOR])
251
252dnl and finally, output our Makefiles
253AC_OUTPUT
254
255reportopt() {
256        if test x"$2" = xtrue -o x"$2" = xyes; then
257                AC_MSG_NOTICE([$1: Yes])
258        else
259                AC_MSG_NOTICE([$1: No])
260        fi
261}
262
263echo
264AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
265reportopt "Compiled with PCAP support" $ac_cv_lib_pcap_pcap_open_live
266reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_gzopen
267if test x"$libtrace_dag" = xtrue; then
268        if test x"$libtrace_dag2_4"; then
269                AC_MSG_NOTICE([Compiled with DAG support: 2.4])
270        else
271                AC_MSG_NOTICE([Compiled with DAG support: 2.5])
272        fi
273else
274        AC_MSG_NOTICE([Compiled with DAG support: No])
275fi
276reportopt "Building man pages/documentation" $libtrace_doxygen
277
278if test x"$libtrace_swig" = xtrue; then
279        if test x"$libtrace_python"; then
280                AC_MSG_NOTICE([Building swig bindings for: python])
281        fi
282else
283        AC_MSG_NOTICE([Building swig bindings for: Nothing])
284fi
Note: See TracBrowser for help on using the repository browser.