Changeset e5c2bc4


Ignore:
Timestamp:
06/27/06 12:41:26 (15 years ago)
Author:
Perry Lorier <perry@…>
Branches:
4.0.1-hotfixes, cachetimestamps, develop, dpdk-ndag, etsilive, getfragoff, help, libtrace4, master, ndag_format, pfring, rc-4.0.1, rc-4.0.2, rc-4.0.3, rc-4.0.4, ringdecrementfix, ringperformance, ringtimestampfixes
Children:
496864e
Parents:
9461526
Message:

Redo the build system for libtrace3

Files:
18 edited

Legend:

Unmodified
Added
Removed
  • Makefile.am

    r9b8c7ad re5c2bc4  
    22LIBPACKETDUMP_DIR = libpacketdump
    33endif
    4 if LIBTRACE_TOOLS
    54TOOLS_DIR = tools
    6 endif
    75SUBDIRS = lib docs $(LIBPACKETDUMP_DIR) $(TOOLS_DIR)
    86
  • configure.in

    r01b2922 re5c2bc4  
    3333AC_PROG_CXX
    3434AC_PROG_INSTALL
    35 #AC_LIBTOOL_DLOPEN
    3635AC_PROG_LIBTOOL
    3736AC_PROG_YACC
     
    6968
    7069AC_CHECK_HEADERS(netinet/in.h)
    71 AC_CHECK_HEADER(netpacket/packet.h,
    72                 libtrace_netpacket_packet_h=true
    73                 AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[We have netpacket/packet.h]),
    74                 [libtrace_netpacket_packet_h=false])
    75 
     70AC_CHECK_HEADERS(netpacket/packet.h,[
     71        libtrace_netpacket_packet_h=true
     72        AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net])
     73])
    7674AC_CHECK_HEADER(net/if.h,
    77                 AC_DEFINE(HAVE_NET_IF_H,1,[We have net/if.h]), [],
    78 [#include <sys/types.h>
    79  #include <sys/socket.h>
    80 ])
    81 
     75        AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[
     76 #include <sys/types.h>
     77 #include <sys/socket.h>
     78])
    8279
    8380AC_CHECK_HEADER(netinet/ether.h,
    84                 AC_DEFINE(HAVE_NETINET_ETHER_H,1,[We have netinet/ether.h]
    85 ), [],
    86 [
     81        AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[
    8782 #include <sys/types.h>
    8883 #include <sys/socket.h>
     
    9287
    9388AC_CHECK_HEADER(netinet/if_ether.h,
    94                 AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[We have netinet/if_ether.h]), [],
    95 [
     89        AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[
    9690 #include <sys/types.h>
    9791 #include <sys/socket.h>
     
    10094])
    10195
    102 AC_CHECK_HEADER(net/if_arp.h,
    103                 AC_DEFINE(HAVE_NET_IF_ARP_H,1,[We have net/if_arp.h]), [],
    104 [
     96AC_CHECK_HEADER(net/if_arp.h,
     97        AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[
    10598 #include <sys/types.h>
    10699 #include <sys/socket.h>
     
    109102])
    110103
    111        
    112104# Checking for the right bpf header to include
    113 AC_MSG_CHECKING([where the bpf headers are kept])
    114 echo ""
    115 bpfh=no
    116 AC_CHECK_HEADER(pcap-bpf.h,
    117         [AC_DEFINE([HAVE_PCAP_BPF_H]) bpfh=pcap-bpf.h])
    118 if test $bpfh = no; then
    119 AC_CHECK_HEADER(net/bpf.h,
    120         [AC_DEFINE([HAVE_NET_BPF_H]) bpfh=net/bpf.h])
    121 fi
    122 
    123 if test $bpfh = no; then
    124   AC_MSG_RESULT([No BPF headers, compiling without support for BPF filters])
    125   AC_DEFINE(HAVE_BPF,0,[Conditional for building bpf support])
    126   libtrace_bpf=false
    127 else
    128   AC_MSG_RESULT([Using $bpfh])
    129   AC_DEFINE(HAVE_BPF,1,[Conditional for building bpf support])
    130   libtrace_bpf=true
    131 fi
    132 
    133 
    134 AC_CHECK_HEADER(gdc.h,
    135              [AC_DEFINE(HAVE_GDC_H,1,[Conditional for building with libGDC support]) libtrace_gdc=true],
    136              [AC_DEFINE(HAVE_GDC_H,0,[Conditional for building with libGDC support]) libtrace_gdc=false])
     105AC_CHECK_HEADER(pcap-bpf.h)
     106AC_CHECK_HEADER(net/bpf.h)
     107AC_CHECK_HEADER(gdc.h)
    137108
    138109# Check to see if we have libdl - *BSD has built-in libdl
    139 AC_CHECK_LIB(dl, dlopen, libtrace_dl=true, libtrace_dl=false)
    140 if test "$libtrace_dl" = true; then
    141         AC_DEFINE(HAVE_LIBDL,1,[Conditional for building with dynamic library support])
    142         ADD_LIBS="$ADD_LIBS -ldl"
    143 else
    144         AC_DEFINE(HAVE_LIBDL,0,[Conditional for building with dynamic library support])
    145 fi
    146 
    147 
    148 # Check to see if we have libpcap
    149 AC_CHECK_LIB(pcap,pcap_open_live,
    150              libtrace_pcap=true,
    151              libtrace_pcap=false)
    152 
    153 if test "$libtrace_pcap" = true; then
    154     AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support])
    155     ADD_LIBS="$ADD_LIBS  -lpcap"
    156 else
    157     AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support])
    158 fi     
    159 
    160 # Only test for these functions if we have PCAP installed
    161         if test "$libtrace_pcap" = true; then
    162         # Earlier versions of pcap don't have pcap_open_dead. EG: the one
    163         # OpenBSD ships with. Even Debian Woody is more up to date.
    164         AC_CHECK_LIB(pcap,pcap_open_dead,
    165                 have_pcap_open_dead=true,
    166                 have_pcap_open_dead=false)
    167 
    168         if test "$have_pcap_open_dead" = false; then
    169                 AC_REPLACE_FUNCS(pcap_open_dead)
    170         fi
    171    
    172         # Versions of libpcap earlier than 0.8 don't have pcap_dump_flush or
    173         # pcap_next_ex
    174         AC_CHECK_LIB(pcap,pcap_dump_flush,
    175                      have_pcap_dump_flush=true,
    176                      have_pcap_dump_flush=false)
    177 
    178         if test "$have_pcap_dump_flush" = false; then
    179                 AC_REPLACE_FUNCS(pcap_dump_flush)
    180         fi
    181        
    182         AC_CHECK_LIB(pcap,pcap_next_ex,
    183                      have_pcap_next_ex=true,
    184                      have_pcap_next_ex=false)
    185 
    186         if test "$have_pcap_next_ex" = false; then
    187                 AC_REPLACE_FUNCS(pcap_next_ex)
    188         fi
    189 
    190         AC_CHECK_LIB(pcap,pcap_inject,
    191                         AC_DEFINE(HAVE_PCAP_INJECT,1,[pcap has pcap_inject]),
    192                         have_pcap_inject=false)
    193 
    194         AC_CHECK_LIB(pcap,pcap_sendpacket,
    195                         AC_DEFINE(HAVE_PCAP_SENDPACKET,1,[pcap has pcap_sendpacket]),
    196                         have_pcap_sendpacket=false)
    197 
    198         AC_CHECK_LIB(pcap,pcap_setnonblock,
    199                         AC_DEFINE(HAVE_PCAP_SETNONBLOCK,1,[pcap has pcap_setnonblock]),
    200                         have_pcap_setnonblock=false)
    201 fi
    202 
     110AC_CHECK_LIB(dl, dlopen)
     111# check pcap
     112AC_CHECK_LIB(pcap,pcap_open_live)
     113AC_REPLACE_FUNCS(pcap_open_dead)
     114AC_REPLACE_FUNCS(pcap_dump_flush)
     115AC_REPLACE_FUNCS(pcap_next_ex)
     116AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
    203117
    204118# configure time options for man pages
     
    215129)
    216130
    217 # configure time option for building libpacketdump
    218 # libpacketdump needs a C++ compiler to build, so we should do some tests
    219 # at this point to see if one is installed
    220 libtrace_libpacketdump=true
    221 AC_ARG_ENABLE(libpacketdump,
    222               AC_HELP_STRING([--disable-libpacketdump],
    223                              [disable building of libpacketdump (enabled by default). libpacketdump needs a c++ compiler to build] ),
    224 [
    225         if test "$enableval" = no -o "$enableval" = false
    226         then
    227                 libtrace_libpacketdump=false
    228         else
    229                 libtrace_libpacketdump=true
    230         fi
    231 ],
    232 [
    233         libtrace_libpacketdump=true
    234 ])
    235 
    236 if test "$libtrace_libpacketdump" = true; then
    237         AC_LANG_PUSH(C++)
    238         AC_MSG_CHECKING([if we can compile C++ ])
    239         AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
    240                            [[
    241 #include <iostream>
    242                            ]])],
    243                 [AC_DEFINE(HAVE_CXX,1,[define to test for presence of a working C++ compiler]) libtrace_cxx=true],
    244                 [AC_DEFINE(HAVE_CXX,0,[define to test for presence of a working C++ compiler]) libtrace_cxx=false])
    245 
    246         AC_MSG_RESULT($libtrace_cxx)   
    247         AC_LANG_POP(C++)
    248 
    249         if test "$libtrace_cxx" = false; then
    250                 AC_MSG_ERROR([libpacketdump requested, but no C++ compiler found. Build with --disable-libpacketdump if you wish to continue anyway ])
    251         fi
    252 fi
    253 
    254 # configure time option for building the libtrace tools
    255 # one of the tools requires libpacketdump, so won't build if libpacketdump
    256 # hasn't also been built
    257 libtrace_tools=true
    258 AC_ARG_ENABLE(tools,
    259               AC_HELP_STRING([--disable-tools],
    260                              [disable building of the tools contained in the tools/ directory]),
    261 [
    262         if test "$enableval" = no -o "$enableval" = false
    263         then
    264                 libtrace_tools=false
    265         else
    266                 libtrace_tools=true
    267         fi
    268        
    269 ],
    270 [
    271         libtrace_tools=true
    272 ])
     131AC_PROG_CXX
    273132
    274133# configure time options for use of DAG cards
     
    346205        fi
    347206        AC_MSG_RESULT($libtrace_dag2_4)
    348 else
    349         AC_DEFINE(HAVE_DAG,0,[conditional for building with DAG support])
    350207fi
    351208
    352 
    353 
    354 
    355 
    356 AC_ARG_WITH([zlib],
    357     AC_HELP_STRING([--with-zlib],
    358                                [name of zlib library (default is z)]),
    359         [ac_cv_use_zlib=$withval],
    360     [ac_cv_use_zlib=z])
    361 
    362 AC_ARG_WITH([zlib-path],
    363     AC_HELP_STRING([--with-zlib-path],
    364                    [location of zlib library (default is /usr/lib)]),
    365     [ac_cv_use_zlib_path=$withval],
    366     [ac_cv_use_zlib_path=/usr/lib])
    367 
    368 libtrace_zlib=false
    369 if test "$ac_cv_use_zlib" != no; then
    370    
    371     zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so"
    372 
    373     # if the library is in /usr/lib/, then just use AC_CHECK_LIB
    374     if test x"${ac_cv_use_zlib_path}" == x"/usr/lib"; then
    375             AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen,
    376                          libtrace_zlib=true,
    377                          libtrace_zlib=false)
    378     else
    379         ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path"
    380         # if it's not in /usr/lib/, check manually. This isn't nice
    381         # and will probably break.
    382         if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then
    383                 AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
    384                 AC_MSG_ERROR([Exiting]);
    385         else
    386                 libtrace_zlib=true
    387         fi
    388     fi
    389 fi
    390 
    391 if test $libtrace_zlib = true; then
    392         ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib"
    393         AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support])
    394 else
    395         AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support])   
    396 fi
     209AC_CHECK_LIB(z, gzopen)
    397210
    398211AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
     
    402215AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
    403216AM_CONDITIONAL([LIBPACKETDUMP], [test "$libtrace_libpacketdump" = true])
    404 AM_CONDITIONAL([LIBTRACE_TOOLS], [test "$libtrace_tools" = true])
    405217AM_CONDITIONAL([LIBGDC], [test "$libtrace_gdc" = true])
    406218
     
    448260reportopt "Building man pages/documentation" $libtrace_doxygen
    449261reportopt "Building libpacketdump" $libtrace_libpacketdump
    450 reportopt "Building tools/ directory" $libtrace_tools
    451 
     262
  • lib/format_erf.c

    r362c5f2 re5c2bc4  
    4444#include <stdlib.h>
    4545
    46 #if HAVE_DAG
     46#ifdef HAVE_DAG
    4747#include <sys/mman.h>
    4848#endif
     
    6666static struct libtrace_format_t erf;
    6767static struct libtrace_format_t rtclient;
    68 #if HAVE_DAG
     68#ifdef HAVE_DAG
    6969static struct libtrace_format_t dag;
    7070#endif
     
    7676#define INPUT DATA(libtrace)->input
    7777#define OUTPUT DATAOUT(libtrace)->output
    78 #if HAVE_DAG
     78#ifdef HAVE_DAG
    7979#define DAG DATA(libtrace)->dag
    8080#define DUCK DATA(libtrace)->duck
     
    100100        } seek;
    101101
    102 #if HAVE_DAG
     102#ifdef HAVE_DAG
    103103        struct {
    104104                uint32_t last_duck;     
     
    464464#ifdef HAVE_DAG
    465465static int dag_pause_input(libtrace_t *libtrace) {
    466 #if DAG_VERSION_2_4
     466#ifdef DAG_VERSION_2_4
    467467        dag_stop(INPUT.fd);
    468468#else
     
    510510}
    511511 
    512 #if HAVE_DAG
    513 #if DAG_VERSION_2_4
     512#ifdef HAVE_DAG
     513#ifdef DAG_VERSION_2_4
    514514static int dag_get_duckinfo(libtrace_t *libtrace,
    515515                                libtrace_packet_t *packet) {
     
    667667
    668668static int dag_start_input(libtrace_t *libtrace) {
    669 #if DAG_VERSION_2_4
     669#ifdef DAG_VERSION_2_4
    670670        if(dag_start(INPUT.fd) < 0) {
    671671                trace_set_err(libtrace,errno,"Cannot start DAG %s",
     
    922922       
    923923        if (packet->trace->format == &erf 
    924 #if HAVE_DAG
     924#ifdef HAVE_DAG
    925925                        || packet->trace->format == &dag
    926926#endif
     
    10571057#endif
    10581058
    1059 #if HAVE_DAG
     1059#ifdef HAVE_DAG
    10601060static void dag_help() {
    10611061        printf("dag format module: $Revision$\n");
  • lib/format_helper.c

    re2aebe7 re5c2bc4  
    196196        assert(level<10);
    197197        assert(level>=0);
    198 #if HAVE_ZLIB
     198#ifdef HAVE_ZLIB
    199199        sprintf(filemode,"wb%d",level);
    200200#else
  • lib/format_legacy.c

    re6d963c re5c2bc4  
    6464
    6565#define INPUT DATA(libtrace)->input
    66 #if HAVE_DAG
    67 #define DAG DATA(libtrace)->dag
    68 #endif
    6966
    7067struct legacy_format_data_t {
  • lib/format_pcap.c

    rf875681 re5c2bc4  
    4242#include <errno.h>
    4343
    44 #if HAVE_PCAP_BPF_H
    45 #  include <pcap-bpf.h>
    46 #else
    47 #  ifdef HAVE_NET_BPF_H
    48 #    include <net/bpf.h>
    49 #  endif
    50 #endif
    51 
    52 #if HAVE_PCAP_H
     44#ifdef HAVE_PCAP_H
    5345#  include <pcap.h>
    5446#  ifdef HAVE_PCAP_INT_H
     
    5749#endif
    5850
    59 #if HAVE_PCAP
     51#ifdef HAVE_LIBPCAP
    6052static struct libtrace_format_t pcap;
    6153static struct libtrace_format_t pcapint;
     
    368360                        libtrace->uridata,65536,0,0,NULL);
    369361        }
    370 #if HAVE_PCAP_INJECT
     362#ifdef HAVE_PCAP_INJECT
    371363        err=pcap_inject(OUTPUT.trace.pcap,
    372364                        packet->payload,
     
    375367                err=-1;
    376368#else
    377 #if HAVE_PCAP_SENDPACKET
     369#ifdef HAVE_PCAP_SENDPACKET
    378370        err=pcap_sendpacket(OUTPUT.trace.pcap,
    379371                        packet->payload,
  • lib/format_wag.c

    r6fb4dbf re5c2bc4  
    161161                void *value) {
    162162        switch(option) {
    163 #if HAVE_ZLIB
     163#ifdef HAVE_ZLIB
    164164                case TRACE_OPTION_OUTPUT_COMPRESS:
    165165                        OPTIONS.zlib.level = *(int*)value;
  • lib/libtrace_int.h

    re2d5893 re5c2bc4  
    6363#include "rt_protocol.h"
    6464       
    65 #if HAVE_PCAP_BPF_H
     65#ifdef HAVE_PCAP_BPF_H
    6666#  include <pcap-bpf.h>
     67#  define HAVE_BPF 1
    6768#else
    6869#  ifdef HAVE_NET_BPF_H
    6970#    include <net/bpf.h>
     71#    define HAVE_BPF 1
    7072#  endif
    7173#endif
    7274
    73 #if HAVE_PCAP_H
     75#ifdef HAVE_PCAP_H
    7476#  include <pcap.h>
    7577#  ifdef HAVE_PCAP_INT_H
     
    7880#endif
    7981
    80 #if HAVE_ZLIB_H
     82#ifdef HAVE_ZLIB_H
    8183#  include <zlib.h>
    8284#endif
     
    359361bool demote_packet(libtrace_packet_t *packet);
    360362
    361 #if HAVE_BPF
     363#ifdef HAVE_BPF
    362364/* A type encapsulating a bpf filter
    363365 * This type covers the compiled bpf filter, as well as the original filter
     
    370372        char * filterstring;
    371373};
     374#else
     375struct libtrace_filter_t {};
    372376#endif
    373377
  • lib/libtraceio.h

    re2d5893 re5c2bc4  
    55#define LIBTRACEIO_H 1
    66#include "config.h"
    7 #if HAVE_ZLIB
     7#ifdef HAVE_ZLIB
    88#include <zlib.h>
    99#else
  • lib/linktypes.c

    r0ff6ddf re5c2bc4  
    11#include "libtrace.h"
    22#include "config.h"
    3 #ifdef HAVE_PCAP
    4 #include <pcap.h>
    5 #endif
    63
    74#include "rt_protocol.h"
  • lib/malloc.c

    re7bc155 re5c2bc4  
    1 #if HAVE_CONFIG_H
     1#ifdef HAVE_CONFIG_H
    22#  include <config.h>
    33#endif
  • lib/pcap_dump_flush.c

    r77285d9 re5c2bc4  
    44#include <stdio.h>
    55#include <pcap.h>
    6 #if HAVE_PCAP_INT_H
     6#ifdef HAVE_PCAP_INT_H
    77# include <pcap-int.h>
    88#else
  • lib/pcap_next_ex.c

    r77285d9 re5c2bc4  
    44#include <stdio.h>
    55#include <pcap.h>
    6 #if HAVE_PCAP_INT_H
     6#ifdef HAVE_PCAP_INT_H
    77# include <pcap-int.h>
    88#else
  • lib/pcap_open_dead.c

    rf2f47a7 re5c2bc4  
    44#include <stdio.h>
    55#include <pcap.h>
    6 #if HAVE_PCAP_INT_H
     6#ifdef HAVE_PCAP_INT_H
    77# include <pcap-int.h>
    88#else
  • lib/realloc.c

    r8afe034 re5c2bc4  
    1 #if HAVE_CONFIG_H
     1#ifdef HAVE_CONFIG_H
    22#  include <config.h>
    33#endif
  • lib/trace.c

    rc5ebbaa re5c2bc4  
    8888#include "parse_cmd.h"
    8989
    90 #if HAVE_PCAP_BPF_H
     90#ifdef HAVE_PCAP_BPF_H
    9191#  include <pcap-bpf.h>
    9292#else
     
    9595#  endif
    9696#endif
     97
    9798
    9899#include "libtrace_int.h"
     
    227228                linuxnative_constructor();
    228229#endif
    229 #ifdef HAVE_PCAP
     230#ifdef HAVE_LIBPCAP
    230231                pcap_constructor();
    231232#endif
     
    922923 */
    923924DLLEXPORT libtrace_filter_t *trace_create_filter(const char *filterstring) {
    924 #if HAVE_BPF
     925#ifdef HAVE_BPF
    925926        libtrace_filter_t *filter = (libtrace_filter_t*)
    926927                                malloc(sizeof(libtrace_filter_t));
     
    936937DLLEXPORT void trace_destroy_filter(libtrace_filter_t *filter)
    937938{
    938 #if HAVE_BPF
     939#ifdef HAVE_BPF
    939940        free(filter->filterstring);
    940941        if (filter->flag)
     
    953954int trace_bpf_compile(libtrace_filter_t *filter,
    954955                const libtrace_packet_t *packet ) {
    955 #if HAVE_BPF
     956#ifdef HAVE_BPF
    956957        void *linkptr = 0;
    957958        assert(filter);
     
    10031004DLLEXPORT int trace_apply_filter(libtrace_filter_t *filter,
    10041005                        const libtrace_packet_t *packet) {
    1005 #if HAVE_BPF
     1006#ifdef HAVE_BPF
    10061007        void *linkptr = 0;
    10071008        int clen = 0;
  • swig/Makefile

    r6f34090 re5c2bc4  
    1 CFLAGS=-g -Wall -I/usr/include/python2.1 -I../include -I /usr/lib/perl/5.6.1/CORE/
     1CFLAGS=-g -Wall -I/usr/include/python2.3 -I../include -I /usr/lib/perl/5.6.1/CORE/
    22LDDIRS=-L../lib
    33LDLIBS=-ltrace -lpcap -lz
  • tools/Makefile.am

    r0837e57 re5c2bc4  
    44endif
    55
    6 if LIBTRACE_TOOLS
    76SUBDIRS=traceanon tracemerge tracesplit $(TRACEDUMP_DIR) tracertstats tracestats
    87SUBDIRS+=tracereport
    9 else
    10 SUBDIRS=
    11 endif
    128
    139all-hook:
Note: See TracChangeset for help on using the changeset viewer.