1 | # Process this file with autoconf to produce a configure script. |
---|
2 | AC_INIT(libtrace,2.0.18[libtrace@wand.net.nz],libtrace) |
---|
3 | AC_CONFIG_SRCDIR(lib/trace.c) |
---|
4 | AM_INIT_AUTOMAKE(libtrace,2.0.18) |
---|
5 | |
---|
6 | AC_CONFIG_FILES([Makefile lib/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 dagapi.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 | # Earlier versions of pcap don't have pcap_open_dead. EG: the one OpenBSD |
---|
80 | # ships with. Even Debian Woody is more up to date. |
---|
81 | AC_CHECK_LIB(pcap,pcap_open_dead, |
---|
82 | have_pcap_open_dead=true, |
---|
83 | have_pcap_open_dead=false) |
---|
84 | |
---|
85 | if test "$have_pcap_open_dead" = false; then |
---|
86 | AC_REPLACE_FUNCS(pcap_open_dead) |
---|
87 | fi |
---|
88 | |
---|
89 | |
---|
90 | # Checks for typedefs, structures, and compiler characteristics. |
---|
91 | AC_C_CONST |
---|
92 | AC_C_INLINE |
---|
93 | AC_C_BIGENDIAN |
---|
94 | AC_TYPE_SIZE_T |
---|
95 | AC_HEADER_TIME |
---|
96 | AC_SYS_LARGEFILE |
---|
97 | |
---|
98 | # Checks for library functions. |
---|
99 | AC_PROG_GCC_TRADITIONAL |
---|
100 | AC_CHECK_FUNCS(socket strdup) |
---|
101 | |
---|
102 | |
---|
103 | # configure time options for use of DAG cards |
---|
104 | # borrowed from libpcap! |
---|
105 | AC_ARG_WITH(dag, |
---|
106 | AC_HELP_STRING([--with-dag[=DIR]], |
---|
107 | [include DAG support (located in directory DIR, if supplied)]), |
---|
108 | [ |
---|
109 | if test "$withval" = no |
---|
110 | then |
---|
111 | want_dag=no |
---|
112 | elif test "$withval" = yes |
---|
113 | then |
---|
114 | want_dag=yes |
---|
115 | dag_root= |
---|
116 | else |
---|
117 | want_dag=yes |
---|
118 | dag_root=$withval |
---|
119 | fi |
---|
120 | ],[ |
---|
121 | # |
---|
122 | # Use DAG API if present, otherwise don't |
---|
123 | # |
---|
124 | want_dag=ifpresent |
---|
125 | dag_root= |
---|
126 | ]) |
---|
127 | |
---|
128 | ac_cv_lbl_dag_api=no |
---|
129 | if test "$with_dag" != no; then |
---|
130 | AC_MSG_CHECKING(whether we have DAG API) |
---|
131 | |
---|
132 | if test -z "$dag_root"; then |
---|
133 | dag_root=$srcdir/../dag |
---|
134 | fi |
---|
135 | |
---|
136 | if test -r "$dag_root/lib"; then |
---|
137 | dag_lib_dir="$dag_root/lib" |
---|
138 | else |
---|
139 | dag_lib_dir="$dag_root" |
---|
140 | fi |
---|
141 | |
---|
142 | if test -r "$dag_root/tools" -a -r "$dag_root/include"; then |
---|
143 | dag_tools_dir="$dag_root/tools" |
---|
144 | dag_include_dir="$dag_root/include" |
---|
145 | else |
---|
146 | dag_tools_dir="$dag_root" |
---|
147 | dag_include_dir="$dag_root" |
---|
148 | fi |
---|
149 | |
---|
150 | if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a"; |
---|
151 | then |
---|
152 | ADD_INCLS="$ADD_INCLS -I $dag_include_dir" |
---|
153 | ADD_LIBS="$ADD_LIBS -ldag" |
---|
154 | ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir" |
---|
155 | DAG_TOOLS_DIR=$dag_tools_dir |
---|
156 | AC_SUBST([DAG_TOOLS_DIR]) |
---|
157 | ac_cv_lbl_dag_api=yes |
---|
158 | else |
---|
159 | ac_cv_lbl_dag_api=no |
---|
160 | fi |
---|
161 | AC_MSG_RESULT($ac_cv_lbl_dag_api) |
---|
162 | if test $ac_cv_lbl_dag_api = no; then |
---|
163 | if test "$want_dag" = yes; then |
---|
164 | AC_MSG_ERROR(DAG API not found under directory $dag_root |
---|
165 | ; use --without-dag) |
---|
166 | fi |
---|
167 | else |
---|
168 | AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API]) |
---|
169 | AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support]) |
---|
170 | fi |
---|
171 | else |
---|
172 | AC_DEFINE(HAVE_DAG,0,[conditional for building with DAG support]) |
---|
173 | fi |
---|
174 | |
---|
175 | AM_CONDITIONAL(HAVE_DAG, test x$ac_cv_lbl_dag_api = xyes) |
---|
176 | |
---|
177 | |
---|
178 | # configure time options for selecting which libpcap and libz to use |
---|
179 | # this is provided to allow for systems whose default libraries don't support |
---|
180 | # large files - you can build your own and link using these options |
---|
181 | AC_ARG_WITH([pcap], |
---|
182 | AC_HELP_STRING([--with-pcap], |
---|
183 | [name of pcap library (default is pcap)]), |
---|
184 | [ac_cv_use_pcap=$withval], |
---|
185 | [ac_cv_use_pcap=pcap]) |
---|
186 | |
---|
187 | |
---|
188 | AC_ARG_WITH([pcap-path], |
---|
189 | AC_HELP_STRING([--with-pcap-path], |
---|
190 | [location of pcap library (default is /usr/lib)]), |
---|
191 | [ac_cv_use_pcap_path=$withval], |
---|
192 | [ac_cv_use_pcap_path=/usr/lib]) |
---|
193 | |
---|
194 | if test x"$ac_cv_use_pcap" != xno; then |
---|
195 | ADD_LIBS="$ADD_LIBS -l$ac_cv_use_pcap" |
---|
196 | |
---|
197 | pcap_lib_file="${ac_cv_use_pcap_path}/lib${ac_cv_use_pcap}.so" |
---|
198 | |
---|
199 | # if the library is in /usr/lib, then just use |
---|
200 | # AC_CHECK_LIB. |
---|
201 | if test x"${ac_cv_use_pcap_path}" == x"/usr/lib"; then |
---|
202 | AC_CHECK_LIB(${ac_cv_use_pcap},pcap_open_live, |
---|
203 | have_libpcap=yes, |
---|
204 | have_libpcap=no) |
---|
205 | |
---|
206 | if test x"${have_libpcap}" == xno; then |
---|
207 | AC_MSG_NOTICE([Cannot find pcap library $pcap_lib_file.]) |
---|
208 | AC_MSG_ERROR([Exiting]); |
---|
209 | fi |
---|
210 | else |
---|
211 | ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_pcap_path" |
---|
212 | # if it's not in /usr/lib/, check manually. This isn't nice, |
---|
213 | # and will probably break. |
---|
214 | if test ! -r "$ac_cv_use_pcap_path" -o ! -r "$pcap_lib_file"; then |
---|
215 | AC_MSG_NOTICE([Cannot find pcap library $pcap_lib_file.]) |
---|
216 | AC_MSG_ERROR([Exiting]); |
---|
217 | fi |
---|
218 | fi |
---|
219 | AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support]) |
---|
220 | else |
---|
221 | AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support]) |
---|
222 | fi |
---|
223 | |
---|
224 | |
---|
225 | AC_ARG_WITH([zlib], |
---|
226 | AC_HELP_STRING([--with-zlib], |
---|
227 | [name of zlib library (default is z)]), |
---|
228 | [ac_cv_use_zlib=$withval], |
---|
229 | [ac_cv_use_zlib=z]) |
---|
230 | |
---|
231 | AC_ARG_WITH([zlib-path], |
---|
232 | AC_HELP_STRING([--with-zlib-path], |
---|
233 | [location of zlib library (default is /usr/lib)]), |
---|
234 | [ac_cv_use_zlib_path=$withval], |
---|
235 | [ac_cv_use_zlib_path=/usr/lib]) |
---|
236 | |
---|
237 | if test "$ac_cv_use_zlib" != no; then |
---|
238 | ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib" |
---|
239 | |
---|
240 | zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so" |
---|
241 | |
---|
242 | # if the library is in /usr/lib/, then just use AC_CHECK_LIB |
---|
243 | if test x"${ac_cv_use_zlib_path}" == x"/usr/lib"; then |
---|
244 | AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen, |
---|
245 | have_libzlib=yes, |
---|
246 | have_libzlib=no) |
---|
247 | if test x"{have_libzlib}" == xno; then |
---|
248 | AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.]) |
---|
249 | AC_MSG_ERROR([Exiting]); |
---|
250 | fi |
---|
251 | else |
---|
252 | ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path" |
---|
253 | # if it's not in /usr/lib/, check manually. This isn't nice |
---|
254 | # and will probably break. |
---|
255 | if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then |
---|
256 | AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.]) |
---|
257 | AC_MSG_ERROR([Exiting]); |
---|
258 | fi |
---|
259 | fi |
---|
260 | AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support]) |
---|
261 | else |
---|
262 | AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support]) |
---|
263 | fi |
---|
264 | |
---|
265 | |
---|
266 | |
---|
267 | AC_SUBST([ADD_LIBS]) |
---|
268 | AC_SUBST([ADD_LDFLAGS]) |
---|
269 | AC_SUBST([ADD_INCLS]) |
---|
270 | AC_SUBST([LTLIBOBJS]) |
---|
271 | |
---|
272 | dnl and finally, output our Makefiles |
---|
273 | AC_OUTPUT |
---|