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 | |
---|
6 | AC_INIT([libtrace],[3.0.0-beta5],[contact@wand.net.nz],[libtrace]) |
---|
7 | |
---|
8 | LIBTRACE_MAJOR=3 |
---|
9 | LIBTRACE_MID=0 |
---|
10 | LIBTRACE_MINOR=0 |
---|
11 | |
---|
12 | AC_CONFIG_SRCDIR(lib/trace.c) |
---|
13 | AM_INIT_AUTOMAKE |
---|
14 | |
---|
15 | AC_DEFINE([LIBTRACE_MAJOR],${LIBTRACE_MAJOR},[libtrace major version]) |
---|
16 | AC_DEFINE([LIBTRACE_MID],${LIBTRACE_MID},[libtrace mid version]) |
---|
17 | AC_DEFINE([LIBTRACE_MINOR],${LIBTRACE_MINOR},[libtrace minor version]) |
---|
18 | |
---|
19 | AC_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]) |
---|
28 | dnl GNU C library |
---|
29 | dnl AC_GNU_SOURCE |
---|
30 | |
---|
31 | |
---|
32 | AM_CONFIG_HEADER([config.h]) |
---|
33 | dnl Checks for programs. |
---|
34 | AC_PROG_CC |
---|
35 | AC_PROG_CXX |
---|
36 | AC_PROG_INSTALL |
---|
37 | AC_PROG_YACC |
---|
38 | AM_PROG_LEX |
---|
39 | |
---|
40 | AC_CONFIG_LIBOBJ_DIR(lib) |
---|
41 | |
---|
42 | # Checks for typedefs, structures, and compiler characteristics. |
---|
43 | AC_C_CONST |
---|
44 | AC_C_INLINE |
---|
45 | AC_C_BIGENDIAN |
---|
46 | AC_TYPE_SIZE_T |
---|
47 | AC_HEADER_TIME |
---|
48 | AC_SYS_LARGEFILE |
---|
49 | |
---|
50 | if test "$GCC" = "yes"; then |
---|
51 | CFLAGS="$CFLAGS -Wall -W" |
---|
52 | fi |
---|
53 | |
---|
54 | AC_PROG_LIBTOOL |
---|
55 | |
---|
56 | AC_ARG_ENABLE(swig, |
---|
57 | [ --disable-swig don't generate python bindings], |
---|
58 | lt_use_python=true,lt_use_python=false) |
---|
59 | |
---|
60 | if test "x$lt_use_python" = "xtrue" |
---|
61 | then |
---|
62 | AM_PATH_PYTHON(2.3) |
---|
63 | AC_PROG_SWIG(1.3.21) |
---|
64 | SWIG_PYTHON |
---|
65 | fi |
---|
66 | |
---|
67 | # Checks for library functions. |
---|
68 | AC_PROG_GCC_TRADITIONAL |
---|
69 | AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf) |
---|
70 | |
---|
71 | AC_CHECK_SIZEOF([long int]) |
---|
72 | |
---|
73 | |
---|
74 | |
---|
75 | # Check for various broken functions |
---|
76 | AC_FUNC_MALLOC |
---|
77 | AC_FUNC_REALLOC |
---|
78 | |
---|
79 | # *BSD doesn't have strndup. Currently provide our own. |
---|
80 | AC_REPLACE_FUNCS(strndup) |
---|
81 | |
---|
82 | # Checks for header files. |
---|
83 | AC_HEADER_STDC |
---|
84 | dnl 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) |
---|
85 | AC_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 | |
---|
87 | AC_CHECK_HEADERS(netinet/in.h) |
---|
88 | AC_CHECK_HEADERS(netpacket/packet.h,[ |
---|
89 | libtrace_netpacket_packet_h=true |
---|
90 | AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net]) |
---|
91 | ]) |
---|
92 | AC_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 | |
---|
98 | AC_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 | |
---|
106 | AC_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 | |
---|
114 | AC_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 |
---|
123 | AC_CHECK_HEADER(pcap-bpf.h) |
---|
124 | AC_CHECK_HEADER(net/bpf.h) |
---|
125 | AC_CHECK_HEADER(gdc.h) |
---|
126 | |
---|
127 | # Check to see if we have libdl - *BSD has built-in libdl |
---|
128 | AC_CHECK_LIB(dl, dlopen) |
---|
129 | # check pcap |
---|
130 | AC_CHECK_LIB(pcap,pcap_open_live) |
---|
131 | AC_REPLACE_FUNCS(pcap_open_dead) |
---|
132 | AC_REPLACE_FUNCS(pcap_dump_flush) |
---|
133 | AC_REPLACE_FUNCS(pcap_next_ex) |
---|
134 | AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock) |
---|
135 | AC_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 |
---|
143 | AC_ARG_WITH(man, |
---|
144 | AS_HELP_STRING(--with-man,install man pages by default),[ |
---|
145 | if test "$withval" = yes |
---|
146 | then |
---|
147 | MANPAGES="docs/man/man3/[a-zA-Z]*.3" |
---|
148 | else |
---|
149 | MANPAGES="" |
---|
150 | fi |
---|
151 | ]) |
---|
152 | |
---|
153 | AC_PROG_CXX |
---|
154 | |
---|
155 | # configure time options for use of DAG cards |
---|
156 | # borrowed from libpcap! |
---|
157 | AC_ARG_WITH(dag, |
---|
158 | AS_HELP_STRING(--with-dag[=DIR],include DAG support (located in directory DIR, if supplied)), |
---|
159 | [ |
---|
160 | if test "$withval" = no |
---|
161 | then |
---|
162 | want_dag=no |
---|
163 | elif test "$withval" = yes |
---|
164 | then |
---|
165 | want_dag=yes |
---|
166 | dag_root=/usr/local/dag |
---|
167 | else |
---|
168 | want_dag=yes |
---|
169 | dag_root=$withval |
---|
170 | fi |
---|
171 | ],[ |
---|
172 | # |
---|
173 | # Use DAG API if present, otherwise don't |
---|
174 | # |
---|
175 | want_dag=ifpresent |
---|
176 | dag_root=/usr/local/dag |
---|
177 | ]) |
---|
178 | |
---|
179 | # turn the test part of the next block into a function, so it can be |
---|
180 | # called multiple times for $dag_root, /root/dag, /usr/local/lib |
---|
181 | libtrace_dag=false |
---|
182 | libtrace_dag2_4=false |
---|
183 | if test "$with_dag" != no; then |
---|
184 | AC_MSG_CHECKING(whether we have DAG API) |
---|
185 | |
---|
186 | if test -r "$dag_root/lib"; then |
---|
187 | dag_lib_dir="$dag_root/lib" |
---|
188 | else |
---|
189 | dag_lib_dir="$dag_root" |
---|
190 | fi |
---|
191 | |
---|
192 | if test -r "$dag_root/include"; then |
---|
193 | dag_tools_dir="$dag_root/tools" |
---|
194 | dag_include_dir="$dag_root/include" |
---|
195 | else |
---|
196 | dag_tools_dir="$dag_root" |
---|
197 | dag_include_dir="$dag_root" |
---|
198 | fi |
---|
199 | |
---|
200 | if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a"; |
---|
201 | then |
---|
202 | ADD_INCLS="$ADD_INCLS -I $dag_include_dir" |
---|
203 | ADD_LIBS="$ADD_LIBS -ldag" |
---|
204 | ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir" |
---|
205 | DAG_TOOLS_DIR=$dag_tools_dir |
---|
206 | AC_SUBST([DAG_TOOLS_DIR]) |
---|
207 | libtrace_dag=true |
---|
208 | |
---|
209 | AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API]) |
---|
210 | AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support]) |
---|
211 | else |
---|
212 | if test "$want_dag" = yes; then |
---|
213 | AC_MSG_ERROR(DAG API not found under directory $dag_root |
---|
214 | ; use --without-dag) |
---|
215 | fi |
---|
216 | libtrace_dag=false |
---|
217 | fi |
---|
218 | AC_MSG_RESULT($libtrace_dag) |
---|
219 | |
---|
220 | AC_MSG_CHECKING(if we are using DAG 2.4) |
---|
221 | if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then |
---|
222 | libtrace_dag2_4=true |
---|
223 | AC_DEFINE(DAG_VERSION_2_4, 1, [define if using DAG 2.4]) |
---|
224 | else |
---|
225 | libtrace_dag2_4=false |
---|
226 | fi |
---|
227 | AC_MSG_RESULT($libtrace_dag2_4) |
---|
228 | fi |
---|
229 | |
---|
230 | AC_CHECK_LIB(z, gzopen) |
---|
231 | |
---|
232 | libtrace_swig=false; |
---|
233 | if test -n "$SWIG"; then |
---|
234 | libtrace_swig=true; |
---|
235 | fi |
---|
236 | libtrace_python=false; |
---|
237 | if test -n "$PYTHON"; then |
---|
238 | libtrace_python=true; |
---|
239 | fi |
---|
240 | |
---|
241 | AM_CONDITIONAL([HAVE_BPF], [test "$ac_cv_have_decl_BIOCSETIF" = yes ]) |
---|
242 | AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true]) |
---|
243 | AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true]) |
---|
244 | AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_gzopen" = yes]) |
---|
245 | AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true]) |
---|
246 | AM_CONDITIONAL([LIBGDC], [test "$ac_cv_header_gdc_h" = yes]) |
---|
247 | AM_CONDITIONAL([LIBTRACE_SWIG], [test "$libtrace_swig" = true]) |
---|
248 | #AM_CONDITIONAL([HAVE_PYTHON], [test "$libtrace_python" = true]) |
---|
249 | |
---|
250 | # Check for miscellaneous programs |
---|
251 | AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false]) |
---|
252 | |
---|
253 | AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue]) |
---|
254 | |
---|
255 | |
---|
256 | AC_SUBST([ADD_LIBS]) |
---|
257 | AC_SUBST([ADD_LDFLAGS]) |
---|
258 | AC_SUBST([ADD_INCLS]) |
---|
259 | AC_SUBST([LTLIBOBJS]) |
---|
260 | AC_SUBST([MANPAGES]) |
---|
261 | AC_SUBST([PACKAGE_VERSION]) |
---|
262 | AC_SUBST([LIBTRACE_MAJOR]) |
---|
263 | AC_SUBST([LIBTRACE_MID]) |
---|
264 | AC_SUBST([LIBTRACE_MINOR]) |
---|
265 | |
---|
266 | dnl and finally, output our Makefiles |
---|
267 | AC_OUTPUT |
---|
268 | |
---|
269 | reportopt() { |
---|
270 | if test x"$2" = xtrue -o x"$2" = xyes; then |
---|
271 | AC_MSG_NOTICE([$1: Yes]) |
---|
272 | else |
---|
273 | AC_MSG_NOTICE([$1: No]) |
---|
274 | fi |
---|
275 | } |
---|
276 | |
---|
277 | echo |
---|
278 | AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION]) |
---|
279 | reportopt "Compiled with PCAP support" $ac_cv_lib_pcap_pcap_open_live |
---|
280 | reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_gzopen |
---|
281 | if test x"$libtrace_dag" = xtrue; then |
---|
282 | if test x"$libtrace_dag2_4"; then |
---|
283 | AC_MSG_NOTICE([Compiled with DAG support: 2.4]) |
---|
284 | else |
---|
285 | AC_MSG_NOTICE([Compiled with DAG support: 2.5]) |
---|
286 | fi |
---|
287 | else |
---|
288 | AC_MSG_NOTICE([Compiled with DAG support: No]) |
---|
289 | fi |
---|
290 | reportopt "Building man pages/documentation" $libtrace_doxygen |
---|
291 | |
---|
292 | if test x"$libtrace_swig" = xtrue; then |
---|
293 | H |
---|
294 | if test x"$libtrace_python" = xtrue; then |
---|
295 | AC_MSG_NOTICE([Building swig bindings for: python]) |
---|
296 | else |
---|
297 | AC_MSG_NOTICE([Building swig bindings for: Nothing]) |
---|
298 | fi |
---|
299 | else |
---|
300 | AC_MSG_NOTICE([Not building swig bindings]) |
---|
301 | fi |
---|