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.11],[contact@wand.net.nz],[libtrace]) |
---|
7 | |
---|
8 | LIBTRACE_MAJOR=3 |
---|
9 | LIBTRACE_MID=0 |
---|
10 | LIBTRACE_MINOR=11 |
---|
11 | |
---|
12 | # OpenSolaris hides libraries like libncurses in /usr/gnu/lib, which is not |
---|
13 | # searched by default - add it to LDFLAGS so we at least have a chance of |
---|
14 | # finding it |
---|
15 | if test -d "/usr/gnu/lib"; then |
---|
16 | LDFLAGS+=" -L/usr/gnu/lib" |
---|
17 | fi |
---|
18 | |
---|
19 | AC_CONFIG_MACRO_DIR([m4]) |
---|
20 | AC_CONFIG_SRCDIR(lib/trace.c) |
---|
21 | AM_INIT_AUTOMAKE |
---|
22 | |
---|
23 | # Make sure we use the relatively silent automake output |
---|
24 | m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])]) |
---|
25 | |
---|
26 | # Define our libtrace version number externally so we can use it in the source |
---|
27 | # as well, if needed. |
---|
28 | AC_DEFINE([LIBTRACE_MAJOR],${LIBTRACE_MAJOR},[libtrace major version]) |
---|
29 | AC_DEFINE([LIBTRACE_MID],${LIBTRACE_MID},[libtrace mid version]) |
---|
30 | AC_DEFINE([LIBTRACE_MINOR],${LIBTRACE_MINOR},[libtrace minor version]) |
---|
31 | |
---|
32 | # These are all the files we want to be built for us by configure |
---|
33 | AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile |
---|
34 | tools/Makefile tools/traceanon/Makefile tools/tracepktdump/Makefile |
---|
35 | tools/tracemerge/Makefile tools/tracereport/Makefile |
---|
36 | tools/tracertstats/Makefile tools/tracesplit/Makefile |
---|
37 | tools/tracestats/Makefile tools/tracetop/Makefile |
---|
38 | tools/tracereplay/Makefile tools/tracediff/Makefile |
---|
39 | examples/Makefile examples/skeleton/Makefile examples/rate/Makefile |
---|
40 | examples/stats/Makefile examples/tutorial/Makefile |
---|
41 | docs/libtrace.doxygen |
---|
42 | lib/libtrace.h |
---|
43 | ]) |
---|
44 | |
---|
45 | |
---|
46 | # Function that checks if the C++ compiler actually works - there's a bit of |
---|
47 | # oversight in autoconf that will set the C++ compiler to g++ if no compiler |
---|
48 | # is found, even if g++ is not present! So we need an extra test to make sure |
---|
49 | # that the compiler works :( |
---|
50 | |
---|
51 | AC_DEFUN([rw_PROG_CXX_WORKS], |
---|
52 | [AC_REQUIRE([AC_PROG_CXX])dnl |
---|
53 | AC_CACHE_CHECK([whether the C++ compiler works], |
---|
54 | [rw_cv_prog_cxx_works], |
---|
55 | [AC_LANG_PUSH([C++]) |
---|
56 | AC_LINK_IFELSE([AC_LANG_PROGRAM([], [])], |
---|
57 | [rw_cv_prog_cxx_works=yes], |
---|
58 | [rw_cv_prog_cxx_works=no]) |
---|
59 | AC_LANG_POP([C++])]) |
---|
60 | ]) |
---|
61 | |
---|
62 | # Put all our automake definitions in config.h |
---|
63 | AM_CONFIG_HEADER([config.h]) |
---|
64 | |
---|
65 | # Checks for C and C++ compilers |
---|
66 | AC_PROG_CC |
---|
67 | AC_PROG_CXX |
---|
68 | rw_PROG_CXX_WORKS |
---|
69 | |
---|
70 | if test "$rw_cv_prog_cxx_works" = "no"; then |
---|
71 | AC_MSG_ERROR("Failed to find working C++ compiler") |
---|
72 | fi |
---|
73 | |
---|
74 | # Checking for 'install' |
---|
75 | AC_PROG_INSTALL |
---|
76 | |
---|
77 | # Checking for bison and flex |
---|
78 | AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc) |
---|
79 | AM_PROG_LEX |
---|
80 | |
---|
81 | # All our source files for function replacements are in lib/ |
---|
82 | AC_CONFIG_LIBOBJ_DIR(lib) |
---|
83 | |
---|
84 | # Check for various "replacement" functions |
---|
85 | AC_FUNC_MALLOC |
---|
86 | AC_FUNC_REALLOC |
---|
87 | |
---|
88 | # *BSD doesn't have strndup. Currently provide our own. |
---|
89 | AC_REPLACE_FUNCS(strndup) |
---|
90 | |
---|
91 | |
---|
92 | # Checks for typedefs, structures, and compiler characteristics. |
---|
93 | AC_C_CONST |
---|
94 | AC_C_INLINE |
---|
95 | AC_C_BIGENDIAN |
---|
96 | AC_TYPE_SIZE_T |
---|
97 | AC_HEADER_TIME |
---|
98 | AC_SYS_LARGEFILE |
---|
99 | |
---|
100 | LIBPKTDUMP_LIBS="-ltrace " |
---|
101 | ADD_LDFLAGS="$ADD_LDFLAGS -L\$(abs_top_srcdir)/lib" |
---|
102 | LIBTRACE_LIBS="" |
---|
103 | TOOLS_LIBS="" |
---|
104 | |
---|
105 | # Set our C compiler flags based on the gcc version |
---|
106 | if test "$GCC" = "yes"; then |
---|
107 | |
---|
108 | gcc_version=`gcc -dumpversion` |
---|
109 | |
---|
110 | # This is probably not the most reliable way to test whether our |
---|
111 | # compiler supports visibility, but it's better than nothing |
---|
112 | # |
---|
113 | # According to the gcc wiki - http://gcc.gnu.org/wiki/Visibility - |
---|
114 | # visibility is supported in gcc 4.0 or later, so we just need to |
---|
115 | # check the major version number |
---|
116 | |
---|
117 | major=${gcc_version%\.*\.*} |
---|
118 | |
---|
119 | if test "$major" -lt 4; then |
---|
120 | vis=no |
---|
121 | else |
---|
122 | vis=yes |
---|
123 | fi |
---|
124 | |
---|
125 | CFLAGS="$CFLAGS -Wall -Wmissing-prototypes" |
---|
126 | CXXFLAGS="$CXXFLAGS -Wall" |
---|
127 | LIBCFLAGS="$CFLAGS" |
---|
128 | LIBCFLAGS="$LIBCFLAGS -DLT_BUILDING_DLL=1" |
---|
129 | LIBCXXFLAGS="$CXXFLAGS" |
---|
130 | LIBCXXFLAGS="$CXXFLAGS -DLT_BUILDING_DLL=1" |
---|
131 | |
---|
132 | if test "$vis" = "yes"; then |
---|
133 | LIBCFLAGS="$LIBCFLAGS -Wextra -fvisibility=hidden" |
---|
134 | LIBCXXFLAGS="$CXXFLAGS -Wextra -fvisibility=hidden" |
---|
135 | fi |
---|
136 | fi |
---|
137 | |
---|
138 | # Check for libtool |
---|
139 | AC_PROG_LIBTOOL |
---|
140 | |
---|
141 | # Checks for library functions. |
---|
142 | AC_PROG_GCC_TRADITIONAL |
---|
143 | |
---|
144 | # Fail if any of these functions are missing |
---|
145 | AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf vsnprintf) |
---|
146 | |
---|
147 | AC_CHECK_SIZEOF([long int]) |
---|
148 | |
---|
149 | |
---|
150 | # Checks for header files. |
---|
151 | AC_HEADER_STDC |
---|
152 | 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 sys/prctl.h) |
---|
153 | |
---|
154 | |
---|
155 | # OpenSolaris puts ncurses.h in /usr/include/ncurses rather than /usr/include, |
---|
156 | # so check for that |
---|
157 | AC_CHECK_HEADERS(ncurses.h,,[missing_ncurses=true]) |
---|
158 | |
---|
159 | if test "x$missing_ncurses" = xtrue; then |
---|
160 | if test -f "/usr/include/ncurses/ncurses.h"; then |
---|
161 | AC_DEFINE(HAVE_NCURSES_NCURSES_H,1,[Has nested ncurses header]) |
---|
162 | fi |
---|
163 | fi |
---|
164 | |
---|
165 | |
---|
166 | # Check for the presence of various networking headers and define appropriate |
---|
167 | # macros |
---|
168 | AC_CHECK_HEADERS(netinet/in.h) |
---|
169 | AC_CHECK_HEADERS(netpacket/packet.h,[ |
---|
170 | libtrace_netpacket_packet_h=true |
---|
171 | AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net]) |
---|
172 | ]) |
---|
173 | AC_CHECK_HEADER(net/if.h, |
---|
174 | AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[ |
---|
175 | #include <sys/types.h> |
---|
176 | #include <sys/socket.h> |
---|
177 | ]) |
---|
178 | |
---|
179 | AC_CHECK_HEADER(netinet/ether.h, |
---|
180 | AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[ |
---|
181 | #include <sys/types.h> |
---|
182 | #include <sys/socket.h> |
---|
183 | #include <netinet/in.h> |
---|
184 | #include <net/if.h> |
---|
185 | ]) |
---|
186 | |
---|
187 | AC_CHECK_HEADER(netinet/if_ether.h, |
---|
188 | AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[ |
---|
189 | #include <sys/types.h> |
---|
190 | #include <sys/socket.h> |
---|
191 | #include <netinet/in.h> |
---|
192 | #include <net/if.h> |
---|
193 | ]) |
---|
194 | |
---|
195 | AC_CHECK_HEADER(net/if_arp.h, |
---|
196 | AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[ |
---|
197 | #include <sys/types.h> |
---|
198 | #include <sys/socket.h> |
---|
199 | #include <netinet/in.h> |
---|
200 | #include <net/if.h> |
---|
201 | ]) |
---|
202 | |
---|
203 | # Check for sdl_len in sockaddr_dl - sockaddr_dl is used on BSD systems |
---|
204 | if test "$libtrace_netpacket_packet_h" != "true"; then |
---|
205 | AC_CHECK_MEMBER([struct sockaddr_dl.sdl_len], |
---|
206 | AC_DEFINE(HAVE_SDL_LEN,1,[Has sdl_len in sockaddr_dl]),,[ |
---|
207 | #include <sys/types.h> |
---|
208 | #include <sys/socket.h> |
---|
209 | #include <net/if_dl.h> |
---|
210 | ]) |
---|
211 | fi |
---|
212 | |
---|
213 | # Checking for the right bpf header to include |
---|
214 | AC_CHECK_HEADER(pcap-bpf.h) |
---|
215 | AC_CHECK_HEADER(net/bpf.h) |
---|
216 | |
---|
217 | # Checking for libgdc |
---|
218 | AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h])) |
---|
219 | |
---|
220 | # Check for libpcap |
---|
221 | AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0) |
---|
222 | AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock) |
---|
223 | AC_CHECK_DECLS([BIOCSETIF],,,[ |
---|
224 | #include <sys/types.h> |
---|
225 | #include <sys/time.h> |
---|
226 | #include <sys/ioctl.h> |
---|
227 | #include <net/bpf.h> |
---|
228 | ]) |
---|
229 | |
---|
230 | # Configure options for man pages |
---|
231 | AC_ARG_WITH(man, |
---|
232 | AS_HELP_STRING(--with-man,install man pages by default),[ |
---|
233 | if test "$withval" = yes |
---|
234 | then |
---|
235 | MANPAGES="docs/man/man3/[a-zA-Z]*.3" |
---|
236 | else |
---|
237 | MANPAGES="" |
---|
238 | fi |
---|
239 | ]) |
---|
240 | |
---|
241 | # Complain if we didn't find a suitable libpcap |
---|
242 | if test "$pcapfound" = 0; then |
---|
243 | AC_MSG_ERROR(libpcap0.8 or greater is required to compile libtrace. If you have installed it in a non-standard location please use LDFLAGS to specify the location of the library) |
---|
244 | else |
---|
245 | TOOL_LIBS="$TOOL_LIBS -lpcap" |
---|
246 | LIBTRACE_LIBS="$LIBTRACE_LIBS -lpcap" |
---|
247 | AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support]) |
---|
248 | AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support]) |
---|
249 | fi |
---|
250 | |
---|
251 | # Configure options for use of DAG cards |
---|
252 | # Originally borrowed from libpcap, but extended quite a bit :) |
---|
253 | # More details on how this check works: |
---|
254 | # http://wand.net.nz/trac/libtrace/wiki/DAGNotes |
---|
255 | |
---|
256 | AC_ARG_WITH(dag, |
---|
257 | AS_HELP_STRING(--with-dag[=DIR],include DAG live capture support (located in directory DIR, if supplied)), |
---|
258 | [ |
---|
259 | if test "$withval" = no |
---|
260 | then |
---|
261 | want_dag=no |
---|
262 | elif test "$withval" = yes |
---|
263 | then |
---|
264 | want_dag=yes |
---|
265 | dag_root=/usr/local/dag |
---|
266 | else |
---|
267 | want_dag=yes |
---|
268 | dag_root=$withval |
---|
269 | fi |
---|
270 | ],[ |
---|
271 | # |
---|
272 | # Use DAG API if present, otherwise don't |
---|
273 | # |
---|
274 | want_dag=ifpresent |
---|
275 | dag_root=/usr/local/dag |
---|
276 | ]) |
---|
277 | |
---|
278 | # DAG 3.0 actually puts header files and shared libraries into sensible |
---|
279 | # places now, so we should be able to do a simple CHECK_LIB to see if |
---|
280 | # they're there! |
---|
281 | |
---|
282 | # Addendum: It turns out DAG 2.5 does this too, so we'll match DAG2.5 in here |
---|
283 | # also. This isn't such a bad thing, the DAG2.5 API is essentially the same as |
---|
284 | # DAG 3.0 and libtrace will use the same format_dagXX source for both |
---|
285 | libtrace_dag=false |
---|
286 | libtrace_dag_version=none |
---|
287 | |
---|
288 | if test "$with_dag" != no; then |
---|
289 | AC_CHECK_LIB(dag, dag_open, dag_found=1, dag_found=0) |
---|
290 | if test "$dag_found" = 1; then |
---|
291 | ADD_LIBS="$ADD_LIBS -ldag" |
---|
292 | LIBTRACE_LIBS="$LIBTRACE_LIBS -ldag" |
---|
293 | AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) |
---|
294 | AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support]) |
---|
295 | libtrace_dag=true |
---|
296 | |
---|
297 | AC_DEFINE(DAG_VERSION,25,[defines the DAG driver version]) |
---|
298 | libtrace_dag_version=25 |
---|
299 | fi |
---|
300 | fi |
---|
301 | |
---|
302 | # TODO: turn the test part of the next block into a function, so it can be |
---|
303 | # called multiple times for $dag_root, /root/dag, /usr/local/lib |
---|
304 | dag_drv_v="DAG not present" |
---|
305 | |
---|
306 | # Now check for 2.4 DAG drivers which don't install as cleanly! |
---|
307 | if test "$with_dag" != no -a "$libtrace_dag" = false; then |
---|
308 | AC_MSG_CHECKING(whether we have DAG 2.4 API instead) |
---|
309 | |
---|
310 | if test -r "$dag_root/lib"; then |
---|
311 | dag_lib_dir="$dag_root/lib" |
---|
312 | else |
---|
313 | dag_lib_dir="$dag_root" |
---|
314 | fi |
---|
315 | |
---|
316 | if test -r "$dag_root/include"; then |
---|
317 | dag_tools_dir="$dag_root/tools" |
---|
318 | dag_include_dir="$dag_root/include" |
---|
319 | else |
---|
320 | dag_tools_dir="$dag_root" |
---|
321 | dag_include_dir="$dag_root" |
---|
322 | fi |
---|
323 | |
---|
324 | if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a"; |
---|
325 | then |
---|
326 | ADD_INCLS="$ADD_INCLS -I $dag_include_dir" |
---|
327 | ADD_LIBS="$ADD_LIBS -ldag" |
---|
328 | ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir" |
---|
329 | DAG_TOOLS_DIR=$dag_tools_dir |
---|
330 | AC_SUBST([DAG_TOOLS_DIR]) |
---|
331 | libtrace_dag=true |
---|
332 | |
---|
333 | AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API]) |
---|
334 | AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support]) |
---|
335 | AC_DEFINE(DAG_VERSION, 24, [defines the DAG driver version]) |
---|
336 | libtrace_dag_version=24 |
---|
337 | else |
---|
338 | if test "$want_dag" = yes; then |
---|
339 | AC_MSG_ERROR(DAG API not found under directory $dag_root |
---|
340 | ; use --without-dag) |
---|
341 | fi |
---|
342 | libtrace_dag=false |
---|
343 | fi |
---|
344 | AC_MSG_RESULT($libtrace_dag) |
---|
345 | |
---|
346 | fi |
---|
347 | |
---|
348 | # Try to determine the DAG driver version |
---|
349 | #if test x"$libtrace_dag" = xtrue; then |
---|
350 | # dag_drv_v="Unknown" |
---|
351 | # files=`locate /usr/*dag*/VERSION` |
---|
352 | # file_count=0 |
---|
353 | # |
---|
354 | # for i in $files; do |
---|
355 | # if $file_count > 0; then |
---|
356 | # dag_drv_v="Indeterminate" |
---|
357 | # break |
---|
358 | # fi |
---|
359 | # dag_drv_v=`cat $i` |
---|
360 | # file_count=$file_count+1 |
---|
361 | # done |
---|
362 | #fi |
---|
363 | #DAG_VERSION_NUM=$dag_drv_v |
---|
364 | |
---|
365 | have_ncurses=yes |
---|
366 | |
---|
367 | # Checks for various "optional" libraries |
---|
368 | AC_CHECK_LIB(z, deflate, have_zlib=1, have_zlib=0) |
---|
369 | AC_CHECK_LIB(bz2, BZ2_bzDecompressInit, have_bzip=1, have_bzip=0) |
---|
370 | AC_CHECK_LIB(lzo2, lzo1x_1_compress, have_lzo=1, have_lzo=0) |
---|
371 | AC_CHECK_LIB(pthread, pthread_create, have_pthread=1, have_pthread=0) |
---|
372 | |
---|
373 | # Check for ncurses |
---|
374 | AC_SEARCH_LIBS(mvprintw, ncurses, have_ncurses=yes, have_ncurses=no) |
---|
375 | LIBS= |
---|
376 | |
---|
377 | # These libraries have to be explicitly linked in OpenSolaris |
---|
378 | AC_SEARCH_LIBS(getservent, socket, have_socket=1, have_socket=0, -lnsl) |
---|
379 | LIBS= |
---|
380 | |
---|
381 | AC_SEARCH_LIBS(inet_ntop, nsl, have_nsl=1, have_nsl=0, -lsocket) |
---|
382 | LIBS= |
---|
383 | |
---|
384 | # Check to see if we have libdl - *BSD has built-in libdl |
---|
385 | AC_SEARCH_LIBS(dlopen,dl, dlfound=1,dlfound=0 ) |
---|
386 | LIBS= |
---|
387 | |
---|
388 | if test "$dlfound" = 0; then |
---|
389 | AC_MSG_ERROR("Unable to find dlopen. Please use LDFLAGS to specify the location of libdl and re-run configure") |
---|
390 | fi |
---|
391 | |
---|
392 | if test "$ac_cv_search_dlopen" != "none required"; then |
---|
393 | LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_dlopen" |
---|
394 | fi |
---|
395 | |
---|
396 | |
---|
397 | if test "$have_zlib" = 1; then |
---|
398 | LIBTRACE_LIBS="$LIBTRACE_LIBS -lz" |
---|
399 | AC_DEFINE(HAVE_LIBZ, 1, [Set to 1 if zlib is supported]) |
---|
400 | fi |
---|
401 | |
---|
402 | if test "$have_bzip" = 1; then |
---|
403 | LIBTRACE_LIBS="$LIBTRACE_LIBS -lbz2" |
---|
404 | AC_DEFINE(HAVE_LIBBZ2, 1, [Set to 1 if bzip2 is supported]) |
---|
405 | fi |
---|
406 | |
---|
407 | if test "$have_lzo" = 1; then |
---|
408 | LIBTRACE_LIBS="$LIBTRACE_LIBS -llzo2" |
---|
409 | AC_DEFINE(HAVE_LIBLZO2, 1, [Set to 1 if lzo2 is supported]) |
---|
410 | fi |
---|
411 | |
---|
412 | if test "$have_pthread" = 1; then |
---|
413 | LIBTRACE_LIBS="$LIBTRACE_LIBS -lpthread" |
---|
414 | AC_DEFINE(HAVE_LIBPTHREAD, 1, [Set to 1 if pthreads are supported]) |
---|
415 | fi |
---|
416 | |
---|
417 | if test "$have_ncurses" = "yes"; then |
---|
418 | if test "$ac_cv_search_mvprintw" != "none required"; then |
---|
419 | TOOLS_LIBS="$TOOLS_LIBS $ac_cv_search_mvprintw" |
---|
420 | fi |
---|
421 | fi |
---|
422 | |
---|
423 | if test "$have_nsl" = 1; then |
---|
424 | if test "$ac_cv_search_inet_ntop" != "none required"; then |
---|
425 | LIBTRACE_LIBS="$LIBTRACE_LIBS $ac_cv_search_inet_ntop" |
---|
426 | LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_inet_ntop" |
---|
427 | fi |
---|
428 | fi |
---|
429 | |
---|
430 | if test "$have_socket" = 1; then |
---|
431 | if test "$ac_cv_search_getservent" != "none required"; then |
---|
432 | LIBTRACE_LIBS="$LIBTRACE_LIBS $ac_cv_search_getservent" |
---|
433 | LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_getservent" |
---|
434 | fi |
---|
435 | fi |
---|
436 | |
---|
437 | |
---|
438 | # Stupid AC_SEARCH_LIB appends stuff to LIBS even when I don't want it to, so |
---|
439 | # just set libs to null here to avoid linking against them by default |
---|
440 | LIBS= |
---|
441 | |
---|
442 | |
---|
443 | # For now, the user has to explicitly ask for the LLVM stuff, as it's a bit |
---|
444 | # rough around the edges :( |
---|
445 | AC_ARG_WITH([llvm], |
---|
446 | [AC_HELP_STRING([--with-llvm], |
---|
447 | [support Just In Time compiler])], |
---|
448 | use_llvm="yes", |
---|
449 | use_llvm="no") |
---|
450 | JIT=no |
---|
451 | |
---|
452 | # Search for LLVM and the libraries that it requires |
---|
453 | if (test "$use_llvm" != "no"); then |
---|
454 | AC_PATH_PROG(LLVM_CONFIG, llvm-config, no) |
---|
455 | |
---|
456 | # XXX Hard coding the path is REALLY bad. |
---|
457 | # llvm-gcc is installed in a stupid place in Debian / Ubuntu. Hard luck |
---|
458 | # if you've installed it somewhere custom. |
---|
459 | # Hopefully in future we can replace this with clang, which may or may |
---|
460 | # not be installed somewhere intelligent. |
---|
461 | AC_PATH_PROG(LLVM_GCC, llvm-gcc, no, /usr/lib/llvm/llvm/gcc-4.2/bin) |
---|
462 | |
---|
463 | AC_LANG_PUSH([C++]) |
---|
464 | AC_CHECK_HEADERS([boost/lexical_cast.hpp], boost="yes", boost="no") |
---|
465 | AC_LANG_POP([C++]) |
---|
466 | |
---|
467 | |
---|
468 | if test "$boost" = "no"; then |
---|
469 | AC_MSG_NOTICE([Unabled to find boost libraries. JIT support disabled.]) |
---|
470 | JIT=no |
---|
471 | elif test "$LLVM_CONFIG" = "no" ; then |
---|
472 | AC_MSG_NOTICE([Unable to find llvm-config. JIT support disabled.]) |
---|
473 | JIT=no |
---|
474 | elif test "$LLVM_GCC" = "no"; then |
---|
475 | AC_MSG_NOTICE([Unable to find llvm-gcc. JIT support disabled.]) |
---|
476 | JIT=no |
---|
477 | else |
---|
478 | LIBCXXFLAGS="`$LLVM_CONFIG --cxxflags` $CXXFLAGS" |
---|
479 | LIBTRACE_LIBS="$LIBRACE_LIBS `$LLVM_CONFIG --libs all`"; |
---|
480 | LDFLAGS="`$LLVM_CONFIG --ldflags` $LDFLAGS"; |
---|
481 | JIT=yes |
---|
482 | AC_DEFINE(HAVE_LLVM, 1, [Set to 1 if you have LLVM installed]) |
---|
483 | fi |
---|
484 | fi |
---|
485 | |
---|
486 | |
---|
487 | # Define automake conditionals for use in our Makefile.am files |
---|
488 | AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ]) |
---|
489 | AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true]) |
---|
490 | AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24]) |
---|
491 | AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25]) |
---|
492 | AM_CONDITIONAL([HAVE_ZLIB], [test "$have_zlib" = 1]) |
---|
493 | AM_CONDITIONAL([HAVE_BZLIB], [test "$have_bzip" = 1]) |
---|
494 | AM_CONDITIONAL([HAVE_LZO], [test "$have_lzo" = 1]) |
---|
495 | AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true]) |
---|
496 | AM_CONDITIONAL([HAVE_LIBGDC], [test "$ac_cv_header_gdc_h" = yes]) |
---|
497 | AM_CONDITIONAL([HAVE_LLVM], [test "x$JIT" != "xno" ]) |
---|
498 | AM_CONDITIONAL([HAVE_NCURSES], [test "x$have_ncurses" = "xyes"]) |
---|
499 | |
---|
500 | # Check for miscellaneous programs |
---|
501 | AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false]) |
---|
502 | |
---|
503 | AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue]) |
---|
504 | |
---|
505 | # Set all our output variables |
---|
506 | AC_SUBST([LIBTRACE_LIBS]) |
---|
507 | AC_SUBST([LIBPKTDUMP_LIBS]) |
---|
508 | AC_SUBST([TOOLS_LIBS]) |
---|
509 | #AC_SUBST([ADD_LIBS]) |
---|
510 | AC_SUBST([ADD_LDFLAGS]) |
---|
511 | AC_SUBST([ADD_INCLS]) |
---|
512 | AC_SUBST([LTLIBOBJS]) |
---|
513 | AC_SUBST([MANPAGES]) |
---|
514 | AC_SUBST([PACKAGE_VERSION]) |
---|
515 | AC_SUBST([LIBTRACE_MAJOR]) |
---|
516 | AC_SUBST([LIBTRACE_MID]) |
---|
517 | AC_SUBST([LIBTRACE_MINOR]) |
---|
518 | AC_SUBST([DAG_VERSION_NUM]) |
---|
519 | AC_SUBST([HAVE_BPF_CAPTURE]) |
---|
520 | AC_SUBST([HAVE_LIBGDC]) |
---|
521 | AC_SUBST([HAVE_LLVM]) |
---|
522 | AC_SUBST([HAVE_NCURSES]) |
---|
523 | AC_SUBST([LIBCFLAGS]) |
---|
524 | AC_SUBST([LIBCXXFLAGS]) |
---|
525 | |
---|
526 | |
---|
527 | # Finally, output our Makefiles |
---|
528 | AC_OUTPUT |
---|
529 | |
---|
530 | # Function for reporting whether an option was set or not |
---|
531 | reportopt() { |
---|
532 | if test x"$2" = xtrue -o x"$2" = xyes; then |
---|
533 | AC_MSG_NOTICE([$1: Yes]) |
---|
534 | else |
---|
535 | AC_MSG_NOTICE([$1: No]) |
---|
536 | fi |
---|
537 | } |
---|
538 | |
---|
539 | |
---|
540 | # Report which configure options were set |
---|
541 | echo |
---|
542 | AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION]) |
---|
543 | reportopt "Compiled with PCAP 0.8 support" $ac_cv_lib_pcap_pcap_next_ex |
---|
544 | reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_deflate |
---|
545 | reportopt "Compiled with compressed trace (bz2) support" $ac_cv_lib_bz2_BZ2_bzDecompressInit |
---|
546 | reportopt "Compiled with compressed trace (lzo write only) support" $ac_cv_lib_lzo2_lzo1x_1_compress |
---|
547 | if test x"$libtrace_dag" = xtrue; then |
---|
548 | if test "$libtrace_dag_version" = 24; then |
---|
549 | AC_MSG_NOTICE([Compiled with DAG live capture support: 2.4]) |
---|
550 | elif test "$libtrace_dag_version" = 30; then |
---|
551 | AC_MSG_NOTICE([Compiled with DAG live capture support: 3.0]) |
---|
552 | else |
---|
553 | AC_MSG_NOTICE([Compiled with DAG live capture support: 2.5]) |
---|
554 | fi |
---|
555 | else |
---|
556 | AC_MSG_NOTICE([Compiled with DAG live capture support: No]) |
---|
557 | fi |
---|
558 | reportopt "Compiled with LLVM BPF JIT support" $JIT |
---|
559 | reportopt "Building man pages/documentation" $libtrace_doxygen |
---|
560 | reportopt "Building tracetop (requires libncurses)" $have_ncurses |
---|
561 | |
---|
562 | # Report any errors relating to missing bison, flex, etc. |
---|
563 | echo |
---|
564 | ac_cv_errcount=0; |
---|
565 | if test -z "$YACC"; then |
---|
566 | AC_MSG_WARN(bison or yacc not found. Please install bison before continuing) |
---|
567 | ac_cv_errcount=$((ac_cv_errcount + 1)) |
---|
568 | fi |
---|
569 | |
---|
570 | if test -z "$LEXLIB"; then |
---|
571 | AC_MSG_WARN(flex or lex not found. Please install flex before continuing) |
---|
572 | ac_cv_errcount=$((ac_cv_errcount + 1)) |
---|
573 | fi |
---|
574 | |
---|
575 | if test $ac_cv_errcount -gt 0; then |
---|
576 | AC_MSG_ERROR(Critical packages are missing and compilation will fail. Please install the packages listed above and rerun ./configure) |
---|
577 | fi |
---|
578 | |
---|