# 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],[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 tools/Makefile tools/traceanon/Makefile tools/tracedump/Makefile tools/tracemerge/Makefile tools/tracereport/Makefile tools/tracertstats/Makefile tools/tracesplit/Makefile tools/tracestats/Makefile examples/Makefile examples/skeleton/Makefile examples/rate/Makefile docs/libtrace.doxygen lib/libtrace.h ]) dnl GNU C library dnl AC_GNU_SOURCE AM_CONFIG_HEADER([config.h]) dnl Checks for programs. AC_PROG_CC AC_PROG_CXX AC_PROG_INSTALL AC_PROG_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 CFLAGS="$CFLAGS -Wall -W" 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 ) 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_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 #include #include #include ]) # 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]) fi # configure time options for use of DAG cards # borrowed from libpcap! AC_ARG_WITH(dag, AS_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=/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 ]) # 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/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_BPF], [test "$ac_cv_have_decl_BIOCSETIF" = yes ]) AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true]) AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true]) AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_gzopen" = yes]) AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true]) AM_CONDITIONAL([LIBGDC], [test "$ac_cv_header_gdc_h" = yes]) # 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 } 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_gzopen 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