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