1 | # Process this file with autoconf to produce a configure script. |
---|
2 | |
---|
3 | LIBTRACE_MAJOR=2 |
---|
4 | LIBTRACE_MID=0 |
---|
5 | LIBTRACE_MINOR=24 |
---|
6 | |
---|
7 | AC_INIT(libtrace,2.0.24,[contact@wand.net.nz],libtrace) |
---|
8 | AC_CONFIG_SRCDIR(lib/trace.c) |
---|
9 | AM_INIT_AUTOMAKE(libtrace,2.0.24) |
---|
10 | |
---|
11 | AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile tools/Makefile tools/traceanon/Makefile tools/tracedump/Makefile tools/tracemerge/Makefile tools/tracereport/Makefile tools/tracertstats/Makefile tools/tracesplit/Makefile ]) |
---|
12 | dnl GNU C library |
---|
13 | dnl AC_GNU_SOURCE |
---|
14 | |
---|
15 | |
---|
16 | AM_CONFIG_HEADER(config.h) |
---|
17 | #AC_CONFIG_HEADERS([config.h]) |
---|
18 | dnl Checks for programs. |
---|
19 | AC_PROG_CC |
---|
20 | AC_PROG_CXX |
---|
21 | AC_PROG_INSTALL |
---|
22 | AC_LIBTOOL_DLOPEN |
---|
23 | AC_PROG_LIBTOOL |
---|
24 | |
---|
25 | AC_CONFIG_LIBOBJ_DIR(lib) |
---|
26 | |
---|
27 | # Checks for header files. |
---|
28 | AC_HEADER_STDC |
---|
29 | 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) |
---|
30 | AC_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 ) |
---|
31 | |
---|
32 | AC_CHECK_HEADERS(netinet/in.h) |
---|
33 | |
---|
34 | AC_CHECK_HEADER(net/if.h, |
---|
35 | AC_DEFINE(HAVE_NET_IF_H,1,[We have net/if.h]), [], |
---|
36 | [#include <sys/types.h> |
---|
37 | #include <sys/socket.h> |
---|
38 | ]) |
---|
39 | |
---|
40 | |
---|
41 | AC_CHECK_HEADER(netinet/if_ether.h, |
---|
42 | AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[We have netinet/if_ether.h]), [], |
---|
43 | [ |
---|
44 | #include <sys/types.h> |
---|
45 | #include <sys/socket.h> |
---|
46 | #include <netinet/in.h> |
---|
47 | #include <net/if.h> |
---|
48 | ]) |
---|
49 | |
---|
50 | AC_CHECK_HEADER(net/if_arp.h, |
---|
51 | AC_DEFINE(HAVE_NET_IF_ARP_H,1,[We have net/if_arp.h]), [], |
---|
52 | [ |
---|
53 | #include <sys/types.h> |
---|
54 | #include <sys/socket.h> |
---|
55 | #include <netinet/in.h> |
---|
56 | #include <net/if.h> |
---|
57 | ]) |
---|
58 | |
---|
59 | |
---|
60 | # Checking for the right bpf header to include |
---|
61 | AC_MSG_CHECKING([where the bpf headers are kept]) |
---|
62 | echo "" |
---|
63 | bpfh=no |
---|
64 | AC_CHECK_HEADER(pcap-bpf.h, |
---|
65 | [AC_DEFINE([HAVE_PCAP_BPF_H]) bpfh=pcap-bpf.h]) |
---|
66 | if test $bpfh = no; then |
---|
67 | AC_CHECK_HEADER(net/bpf.h, |
---|
68 | [AC_DEFINE([HAVE_NET_BPF_H]) bpfh=net/bpf.h]) |
---|
69 | fi |
---|
70 | |
---|
71 | if test $bpfh = no; then |
---|
72 | AC_MSG_RESULT([No BPF headers, compiling without support for BPF filters]) |
---|
73 | AC_DEFINE(HAVE_BPF,0,[Conditional for building bpf support]) |
---|
74 | libtrace_bpf=false |
---|
75 | else |
---|
76 | AC_MSG_RESULT([Using $bpfh]) |
---|
77 | AC_DEFINE(HAVE_BPF,1,[Conditional for building bpf support]) |
---|
78 | libtrace_bpf=true |
---|
79 | fi |
---|
80 | |
---|
81 | |
---|
82 | # Check for various broken functions |
---|
83 | AC_FUNC_MALLOC |
---|
84 | AC_FUNC_REALLOC |
---|
85 | |
---|
86 | # *BSD doesn't have strndup. Currently provide our own. |
---|
87 | AC_REPLACE_FUNCS(strndup) |
---|
88 | |
---|
89 | # Check to see if we have libpcap |
---|
90 | AC_CHECK_LIB(pcap,pcap_open_live, |
---|
91 | libtrace_pcap=true, |
---|
92 | libtrace_pcap=false) |
---|
93 | |
---|
94 | if test "$libtrace_pcap" = true; then |
---|
95 | AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support]) |
---|
96 | ADD_LIBS="$ADD_LIBS -lpcap" |
---|
97 | else |
---|
98 | AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support]) |
---|
99 | fi |
---|
100 | |
---|
101 | # Only test for these functions if we have PCAP installed |
---|
102 | if test "$libtrace_pcap" = true; then |
---|
103 | # Earlier versions of pcap don't have pcap_open_dead. EG: the one |
---|
104 | # OpenBSD ships with. Even Debian Woody is more up to date. |
---|
105 | AC_CHECK_LIB(pcap,pcap_open_dead, |
---|
106 | have_pcap_open_dead=true, |
---|
107 | have_pcap_open_dead=false) |
---|
108 | |
---|
109 | if test "$have_pcap_open_dead" = false; then |
---|
110 | AC_REPLACE_FUNCS(pcap_open_dead) |
---|
111 | fi |
---|
112 | |
---|
113 | # Versions of libpcap earlier than 0.8 don't have pcap_dump_flush |
---|
114 | AC_CHECK_LIB(pcap,pcap_dump_flush, |
---|
115 | have_pcap_dump_flush=true, |
---|
116 | have_pcap_dump_flush=false) |
---|
117 | |
---|
118 | if test "$have_pcap_dump_flush" = false; then |
---|
119 | AC_REPLACE_FUNCS(pcap_dump_flush) |
---|
120 | fi |
---|
121 | fi |
---|
122 | |
---|
123 | # Checks for typedefs, structures, and compiler characteristics. |
---|
124 | AC_C_CONST |
---|
125 | AC_C_INLINE |
---|
126 | AC_C_BIGENDIAN |
---|
127 | AC_TYPE_SIZE_T |
---|
128 | AC_HEADER_TIME |
---|
129 | AC_SYS_LARGEFILE |
---|
130 | |
---|
131 | # Checks for library functions. |
---|
132 | AC_PROG_GCC_TRADITIONAL |
---|
133 | AC_CHECK_FUNCS(socket strdup) |
---|
134 | |
---|
135 | # configure time options for man pages |
---|
136 | AC_ARG_WITH(man, |
---|
137 | AC_HELP_STRING([--with-man], |
---|
138 | [install man pages by default]), |
---|
139 | |
---|
140 | if test "$withval" = yes |
---|
141 | then |
---|
142 | MANPAGES="docs/man/man3/[a-zA-Z]*.3]" |
---|
143 | else |
---|
144 | MANPAGES="" |
---|
145 | fi |
---|
146 | ) |
---|
147 | |
---|
148 | # configure time options for use of DAG cards |
---|
149 | # borrowed from libpcap! |
---|
150 | AC_ARG_WITH(dag, |
---|
151 | AC_HELP_STRING([--with-dag[=DIR]], |
---|
152 | [include DAG support (located in directory DIR, if supplied)]), |
---|
153 | [ |
---|
154 | if test "$withval" = no |
---|
155 | then |
---|
156 | want_dag=no |
---|
157 | elif test "$withval" = yes |
---|
158 | then |
---|
159 | want_dag=yes |
---|
160 | dag_root=/root/dag |
---|
161 | else |
---|
162 | want_dag=yes |
---|
163 | dag_root=$withval |
---|
164 | fi |
---|
165 | ],[ |
---|
166 | # |
---|
167 | # Use DAG API if present, otherwise don't |
---|
168 | # |
---|
169 | want_dag=ifpresent |
---|
170 | dag_root=/root/dag/ |
---|
171 | ]) |
---|
172 | |
---|
173 | # turn the test part of the next block into a function, so it can be |
---|
174 | # called multiple times for $dag_root, /root/dag, /usr/local/lib |
---|
175 | libtrace_dag=false |
---|
176 | libtrace_dag2_4=false |
---|
177 | if test "$with_dag" != no; then |
---|
178 | AC_MSG_CHECKING(whether we have DAG API) |
---|
179 | |
---|
180 | if test -r "$dag_root/lib"; then |
---|
181 | dag_lib_dir="$dag_root/lib" |
---|
182 | else |
---|
183 | dag_lib_dir="$dag_root" |
---|
184 | fi |
---|
185 | |
---|
186 | if test -r "$dag_root/tools" -a -r "$dag_root/include"; then |
---|
187 | dag_tools_dir="$dag_root/tools" |
---|
188 | dag_include_dir="$dag_root/include" |
---|
189 | else |
---|
190 | dag_tools_dir="$dag_root" |
---|
191 | dag_include_dir="$dag_root" |
---|
192 | fi |
---|
193 | |
---|
194 | if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a"; |
---|
195 | then |
---|
196 | ADD_INCLS="$ADD_INCLS -I $dag_include_dir" |
---|
197 | ADD_LIBS="$ADD_LIBS -ldag" |
---|
198 | ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir" |
---|
199 | DAG_TOOLS_DIR=$dag_tools_dir |
---|
200 | AC_SUBST([DAG_TOOLS_DIR]) |
---|
201 | libtrace_dag=true |
---|
202 | |
---|
203 | AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API]) |
---|
204 | AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support]) |
---|
205 | else |
---|
206 | if test "$want_dag" = yes; then |
---|
207 | AC_MSG_ERROR(DAG API not found under directory $dag_root |
---|
208 | ; use --without-dag) |
---|
209 | fi |
---|
210 | libtrace_dag=false |
---|
211 | fi |
---|
212 | AC_MSG_RESULT($libtrace_dag) |
---|
213 | |
---|
214 | AC_MSG_CHECKING(if we are using DAG 2.4) |
---|
215 | if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then |
---|
216 | libtrace_dag2_4=true |
---|
217 | else |
---|
218 | libtrace_dag2_4=false |
---|
219 | fi |
---|
220 | AC_MSG_RESULT($libtrace_dag2_4) |
---|
221 | else |
---|
222 | AC_DEFINE(HAVE_DAG,0,[conditional for building with DAG support]) |
---|
223 | fi |
---|
224 | |
---|
225 | AM_CONDITIONAL(HAVE_DAG, test x$libtrace_dag = xtrue) |
---|
226 | AM_CONDITIONAL(DAG2_4, test x$libtrace_dag2_4 = xtrue) |
---|
227 | |
---|
228 | |
---|
229 | # Check for miscellaneous programs |
---|
230 | AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false]) |
---|
231 | |
---|
232 | AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue]) |
---|
233 | |
---|
234 | |
---|
235 | |
---|
236 | |
---|
237 | AC_ARG_WITH([zlib], |
---|
238 | AC_HELP_STRING([--with-zlib], |
---|
239 | [name of zlib library (default is z)]), |
---|
240 | [ac_cv_use_zlib=$withval], |
---|
241 | [ac_cv_use_zlib=z]) |
---|
242 | |
---|
243 | AC_ARG_WITH([zlib-path], |
---|
244 | AC_HELP_STRING([--with-zlib-path], |
---|
245 | [location of zlib library (default is /usr/lib)]), |
---|
246 | [ac_cv_use_zlib_path=$withval], |
---|
247 | [ac_cv_use_zlib_path=/usr/lib]) |
---|
248 | |
---|
249 | libtrace_zlib=false |
---|
250 | if test "$ac_cv_use_zlib" != no; then |
---|
251 | |
---|
252 | zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so" |
---|
253 | |
---|
254 | # if the library is in /usr/lib/, then just use AC_CHECK_LIB |
---|
255 | if test x"${ac_cv_use_zlib_path}" == x"/usr/lib"; then |
---|
256 | AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen, |
---|
257 | libtrace_zlib=true, |
---|
258 | libtrace_zlib=false) |
---|
259 | else |
---|
260 | ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path" |
---|
261 | # if it's not in /usr/lib/, check manually. This isn't nice |
---|
262 | # and will probably break. |
---|
263 | if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then |
---|
264 | AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.]) |
---|
265 | AC_MSG_ERROR([Exiting]); |
---|
266 | else |
---|
267 | libtrace_zlib=true |
---|
268 | fi |
---|
269 | fi |
---|
270 | fi |
---|
271 | |
---|
272 | if test $libtrace_zlib = true; then |
---|
273 | ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib" |
---|
274 | AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support]) |
---|
275 | else |
---|
276 | AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support]) |
---|
277 | fi |
---|
278 | |
---|
279 | |
---|
280 | |
---|
281 | AC_SUBST([ADD_LIBS]) |
---|
282 | AC_SUBST([ADD_LDFLAGS]) |
---|
283 | AC_SUBST([ADD_INCLS]) |
---|
284 | AC_SUBST([LTLIBOBJS]) |
---|
285 | AC_SUBST([MANPAGES]) |
---|
286 | AC_SUBST([LIBTRACE_VERSION]) |
---|
287 | AC_SUBST(LIBTRACE_LT_VERSION) |
---|
288 | |
---|
289 | dnl and finally, output our Makefiles |
---|
290 | AC_OUTPUT |
---|
291 | |
---|
292 | function reportopt() { |
---|
293 | if test x"$2" = xtrue -o x"$2" = xyes; then |
---|
294 | AC_MSG_NOTICE([$1: Yes]) |
---|
295 | else |
---|
296 | AC_MSG_NOTICE([$1: No]) |
---|
297 | fi |
---|
298 | } |
---|
299 | |
---|
300 | reportopt "Compiled with BPF filter support" $libtrace_bpf |
---|
301 | reportopt "Compiled with PCAP support" $libtrace_pcap |
---|
302 | reportopt "Compiled with compressed trace (zlib) support" $libtrace_zlib |
---|
303 | reportopt "Compiled with DAG support (libdag)" $libtrace_dag |
---|
304 | reportopt "Compiled with DAG support (DAG 2.4)" $libtrace_dag2_4 |
---|
305 | reportopt "Building man pages/documentation" $libtrace_doxygen |
---|
306 | |
---|