# 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.0-beta2,[contact@wand.net.nz],libtrace) LIBTRACE_MAJOR=3 LIBTRACE_MID=0 LIBTRACE_MINOR=0 AC_CONFIG_SRCDIR(lib/trace.c) AM_INIT_AUTOMAKE 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 libpacketdump/parser/Makefile tools/Makefile tools/traceanon/Makefile tools/tracedump/Makefile tools/tracemerge/Makefile tools/tracereport/Makefile tools/tracertstats/Makefile tools/tracesplit/Makefile tools/tracestats/Makefile docs/libtrace.doxygen lib/libtrace.h]) dnl GNU C library dnl AC_GNU_SOURCE AM_CONFIG_HEADER(config.h) #AC_CONFIG_HEADERS([config.h]) dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL AC_PROG_LIBTOOL AC_PROG_YACC AC_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 # Checks for library functions. AC_PROG_GCC_TRADITIONAL AC_CHECK_FUNCS(socket strdup strlcpy) 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 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) 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 ) 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 #include ]) AC_CHECK_HEADER(netinet/ether.h, AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[ #include #include #include #include ]) AC_CHECK_HEADER(netinet/if_ether.h, AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[ #include #include #include #include ]) AC_CHECK_HEADER(net/if_arp.h, AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[ #include #include #include #include ]) # 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) # Check to see if we have libdl - *BSD has built-in libdl AC_CHECK_LIB(dl, dlopen) # check pcap AC_CHECK_LIB(pcap,pcap_open_live) 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) # configure time options for man pages AC_ARG_WITH(man, AC_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 # configure time options for use of DAG cards # borrowed from libpcap! AC_ARG_WITH(dag, AC_HELP_STRING([--with-dag[=DIR]], [include DAG 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=/root/dag else want_dag=yes dag_root=$withval fi ],[ # # Use DAG API if present, otherwise don't # want_dag=ifpresent dag_root=/root/dag/ ]) # 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 libtrace_dag=false libtrace_dag2_4=false if test "$with_dag" != no; then AC_MSG_CHECKING(whether we have DAG API) 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/tools" -a -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 a DAG API]) AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support]) 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) AC_MSG_CHECKING(if we are using DAG 2.4) if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then libtrace_dag2_4=true AC_DEFINE(DAG_VERSION_2_4, 1, [define if using DAG 2.4]) else libtrace_dag2_4=false fi AC_MSG_RESULT($libtrace_dag2_4) fi AC_CHECK_LIB(z, gzopen) AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true]) AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true]) AM_CONDITIONAL([HAVE_CXX], [test "$libtrace_cxx" = true]) AM_CONDITIONAL([HAVE_ZLIB], [test "$libtrace_zlib" = true]) AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true]) AM_CONDITIONAL([LIBPACKETDUMP], [test "$libtrace_libpacketdump" = true]) AM_CONDITIONAL([LIBGDC], [test "$libtrace_gdc" = true]) # 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]) 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 } AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION]) reportopt "Compiled with BPF filter support" $libtrace_bpf reportopt "Compiled with PCAP support" $libtrace_pcap reportopt "Compiled with compressed trace (zlib) support" $libtrace_zlib if test x"$libtrace_dag" = xtrue; then if test x"$libtrace_dag2_4"; then AC_MSG_NOTICE([Compiled with DAG support: 2.4]) else AC_MSG_NOTICE([Compiled with DAG support: 2.5]) fi else AC_MSG_NOTICE([Compiled with DAG support: No]) fi reportopt "Building man pages/documentation" $libtrace_doxygen reportopt "Building libpacketdump" $libtrace_libpacketdump