Changeset e5c2bc4 for configure.in


Ignore:
Timestamp:
06/27/06 12:41:26 (14 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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.