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