# Process this file with autoconf to produce a configure script. AC_INIT(libtrace,2.0.19,[libtrace@wand.net.nz],libtrace) AC_CONFIG_SRCDIR(lib/trace.c) AM_INIT_AUTOMAKE(libtrace,2.0.19) AC_CONFIG_FILES([Makefile lib/Makefile]) 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_INSTALL AC_PROG_LIBTOOL # 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 dagapi.h net/ethernet.h ) AC_CHECK_HEADERS(netinet/in.h) AC_CHECK_HEADER(net/if.h, AC_DEFINE(HAVE_NET_IF_H,1,[We have net/if.h]), [], [#include #include ]) AC_CHECK_HEADER(netinet/if_ether.h, AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[We have netinet/if_ether.h]), [], [ #include #include #include #include ]) AC_CHECK_HEADER(net/if_arp.h, AC_DEFINE(HAVE_NET_IF_ARP_H,1,[We have net/if_arp.h]), [], [ #include #include #include #include ]) # Checking for the right bpf header to include AC_MSG_CHECKING([where the bpf headers are kept]) echo "" bpfh=no AC_CHECK_HEADER(pcap-bpf.h, [AC_DEFINE([HAVE_PCAP_BPF_H]) bpfh=pcap-bpf.h]) if test $bpfh = no; then AC_CHECK_HEADER(net/bpf.h, [AC_DEFINE([HAVE_NET_BPF_H]) bpfh=net/bpf.h]) fi if test $bpfh = no; then AC_MSG_RESULT([No BPF headers, compiling without support for BPF filters]) AC_DEFINE(HAVE_BPF,0,[Conditional for building bpf support]) else AC_MSG_RESULT([Using $bpfh]) AC_DEFINE(HAVE_BPF,1,[Conditional for building bpf support]) fi # Check for various broken functions AC_FUNC_MALLOC AC_FUNC_REALLOC # *BSD doesn't have strndup. Currently provide our own. AC_REPLACE_FUNCS(strndup) # Check to see if we have libpcap AC_CHECK_LIB(pcap,pcap_open_live, have_pcap_open_live=true, have_pcap_open_live=false) if test "$have_pcap_open_live" = true; then AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support]) ADD_LIBS="$ADD_LIBS -lpcap" else AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support]) fi # Earlier versions of pcap don't have pcap_open_dead. EG: the one OpenBSD # ships with. Even Debian Woody is more up to date. AC_CHECK_LIB(pcap,pcap_open_dead, have_pcap_open_dead=true, have_pcap_open_dead=false) if test "$have_pcap_open_dead" = false; then AC_REPLACE_FUNCS(pcap_open_dead) fi # 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) # 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= else want_dag=yes dag_root=$withval fi ],[ # # Use DAG API if present, otherwise don't # want_dag=ifpresent dag_root= ]) ac_cv_lbl_dag_api=no if test "$with_dag" != no; then AC_MSG_CHECKING(whether we have DAG API) if test -z "$dag_root"; then dag_root=$srcdir/../dag fi 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]) ac_cv_lbl_dag_api=yes else ac_cv_lbl_dag_api=no fi AC_MSG_RESULT($ac_cv_lbl_dag_api) if test $ac_cv_lbl_dag_api = no; then if test "$want_dag" = yes; then AC_MSG_ERROR(DAG API not found under directory $dag_root ; use --without-dag) fi else AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API]) AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support]) fi else AC_DEFINE(HAVE_DAG,0,[conditional for building with DAG support]) fi AM_CONDITIONAL(HAVE_DAG, test x$ac_cv_lbl_dag_api = xyes) # The following is commented out because it seems you don't actually # need it. libpcap 'just works' with large files, even under woody, # although you probably need _FILE_OFFSET_BITS and LARGEFILE etc set # properly - libtrace handles this however. ## configure time options for selecting which libpcap and libz to use ## this is provided to allow for systems whose default libraries don't support ## large files - you can build your own and link using these options #AC_ARG_WITH([pcap], # AC_HELP_STRING([--with-pcap], # [name of pcap library (default is pcap)]), # [ac_cv_use_pcap=$withval], # [ac_cv_use_pcap=pcap]) # # #AC_ARG_WITH([pcap-path], # AC_HELP_STRING([--with-pcap-path], # [location of pcap library (default is /usr/lib)]), # [ac_cv_use_pcap_path=$withval], # [ac_cv_use_pcap_path=/usr/lib]) # #if test x"$ac_cv_use_pcap" != xno; then # ADD_LIBS="$ADD_LIBS -l$ac_cv_use_pcap" # # pcap_lib_file="${ac_cv_use_pcap_path}/lib${ac_cv_use_pcap}.so" # # # if the library is in /usr/lib, then just use # # AC_CHECK_LIB. # if test x"${ac_cv_use_pcap_path}" == x"/usr/lib"; then # AC_CHECK_LIB(${ac_cv_use_pcap},pcap_open_live, # have_libpcap=yes, # have_libpcap=no) # # if test x"${have_libpcap}" == xno; then # AC_MSG_NOTICE([Cannot find pcap library $pcap_lib_file.]) # AC_MSG_ERROR([Exiting]); # fi # else # ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_pcap_path" # # if it's not in /usr/lib/, check manually. This isn't nice, # # and will probably break. # if test ! -r "$ac_cv_use_pcap_path" -o ! -r "$pcap_lib_file"; then # AC_MSG_NOTICE([Cannot find pcap library $pcap_lib_file.]) # AC_MSG_ERROR([Exiting]); # fi # fi # AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support]) #else # AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support]) #fi AC_ARG_WITH([zlib], AC_HELP_STRING([--with-zlib], [name of zlib library (default is z)]), [ac_cv_use_zlib=$withval], [ac_cv_use_zlib=z]) AC_ARG_WITH([zlib-path], AC_HELP_STRING([--with-zlib-path], [location of zlib library (default is /usr/lib)]), [ac_cv_use_zlib_path=$withval], [ac_cv_use_zlib_path=/usr/lib]) if test "$ac_cv_use_zlib" != no; then ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib" zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so" # if the library is in /usr/lib/, then just use AC_CHECK_LIB if test x"${ac_cv_use_zlib_path}" == x"/usr/lib"; then AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen, have_libzlib=yes, have_libzlib=no) if test x"{have_libzlib}" == xno; then AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.]) AC_MSG_ERROR([Exiting]); fi else ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path" # if it's not in /usr/lib/, check manually. This isn't nice # and will probably break. if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.]) AC_MSG_ERROR([Exiting]); fi fi AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support]) else AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support]) fi AC_SUBST([ADD_LIBS]) AC_SUBST([ADD_LDFLAGS]) AC_SUBST([ADD_INCLS]) AC_SUBST([LTLIBOBJS]) dnl and finally, output our Makefiles AC_OUTPUT