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