Changeset 9589941 for configure.in


Ignore:
Timestamp:
05/04/11 14:25:06 (9 years ago)
Author:
Shane Alcock <salcock@…>
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:
b6664e8
Parents:
3787331
Message:
  • Separated the libraries to link against into 3 separate categories: one for libtrace itself, one for libpacketdump and one for the tools. This means that each component only links against libraries that are actually used by something within it, reducing dependencies and keeping our Debian maintainer happy.
  • Also fixed a similar issue where libpacketdump did not explicitly link against libtrace
File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure.in

    rcd4e06c r9589941  
    9898AC_SYS_LARGEFILE
    9999
     100LIBPKTDUMP_LIBS="-ltrace "
     101LIBTRACE_LIBS=""
     102TOOLS_LIBS=""
     103
    100104# Set our C compiler flags based on the gcc version
    101105if test "$GCC" = "yes"; then
     
    213217AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h]))
    214218
    215 # Check to see if we have libdl - *BSD has built-in libdl
    216 AC_SEARCH_LIBS(dlopen,dl, dlfound=1,dlfound=0 )
    217 
    218 if test "$dlfound" = 0; then
    219         AC_MSG_ERROR("Unable to find dlopen. Please use LDFLAGS to specify the location of libdl and re-run configure")
    220 fi
    221 
    222219# Check for libpcap
    223220AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0)
     
    245242        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)
    246243else
    247         ADD_LIBS="$ADD_LIBS -lpcap"
     244        TOOL_LIBS="$TOOL_LIBS -lpcap"
     245        LIBTRACE_LIBS="$LIBTRACE_LIBS -lpcap"
    248246        AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support])
    249247        AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support])
     
    291289        if test "$dag_found" = 1; then
    292290                ADD_LIBS="$ADD_LIBS -ldag"
     291                LIBTRACE_LIBS="$LIBTRACE_LIBS -ldag"
    293292                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
    294293                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
     
    366365
    367366# Checks for various "optional" libraries
    368 AC_CHECK_LIB(z, deflate)
    369 AC_CHECK_LIB(bz2, BZ2_bzDecompressInit)
    370 AC_CHECK_LIB(lzo2, lzo1x_1_compress)
    371 AC_CHECK_LIB(pthread, pthread_create)
     367AC_CHECK_LIB(z, deflate, have_zlib=1, have_zlib=0)
     368AC_CHECK_LIB(bz2, BZ2_bzDecompressInit, have_bzip=1, have_bzip=0)
     369AC_CHECK_LIB(lzo2, lzo1x_1_compress, have_lzo=1, have_lzo=0)
     370AC_CHECK_LIB(pthread, pthread_create, have_pthread=1, have_pthread=0)
    372371
    373372# Check for ncurses
    374 AC_SEARCH_LIBS(mvprintw, ncurses, , have_ncurses=no)
     373AC_SEARCH_LIBS(mvprintw, ncurses, have_ncurses=yes, have_ncurses=no)
     374LIBS=
    375375
    376376# These libraries have to be explicitly linked in OpenSolaris
    377 AC_SEARCH_LIBS(getservent, socket, [], [], -lnsl)               
    378 AC_SEARCH_LIBS(inet_ntop, nsl, [], [], -lsocket)
     377AC_SEARCH_LIBS(getservent, socket, have_socket=1, have_socket=0, -lnsl)         
     378LIBS=
     379
     380AC_SEARCH_LIBS(inet_ntop, nsl, have_nsl=1, have_nsl=0, -lsocket)
     381LIBS=
     382
     383# Check to see if we have libdl - *BSD has built-in libdl
     384AC_SEARCH_LIBS(dlopen,dl, dlfound=1,dlfound=0 )
     385LIBS=
     386
     387if test "$dlfound" = 0; then
     388        AC_MSG_ERROR("Unable to find dlopen. Please use LDFLAGS to specify the location of libdl and re-run configure")
     389fi
     390
     391if test "$ac_cv_search_dlopen" != "none required"; then
     392        LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_dlopen"
     393fi
     394
     395
     396if test "$have_zlib" = 1; then
     397        LIBTRACE_LIBS="$LIBTRACE_LIBS -lz"
     398        AC_DEFINE(HAVE_LIBZ, 1, [Set to 1 if zlib is supported])
     399fi
     400
     401if test "$have_bzip" = 1; then
     402        LIBTRACE_LIBS="$LIBTRACE_LIBS -lbz2"
     403        AC_DEFINE(HAVE_LIBBZ2, 1, [Set to 1 if bzip2 is supported])
     404fi
     405
     406if test "$have_lzo" = 1; then
     407        LIBTRACE_LIBS="$LIBTRACE_LIBS -llzo2"
     408        AC_DEFINE(HAVE_LIBLZO2, 1, [Set to 1 if lzo2 is supported])
     409fi
     410
     411if test "$have_pthread" = 1; then
     412        LIBTRACE_LIBS="$LIBTRACE_LIBS -lpthread"
     413        AC_DEFINE(HAVE_LIBPTHREAD, 1, [Set to 1 if pthreads are supported])
     414fi
     415
     416if test "$have_ncurses" = "yes"; then
     417        if test "$ac_cv_search_mvprintw" != "none required"; then
     418                TOOLS_LIBS="$TOOLS_LIBS $ac_cv_search_mvprintw"
     419        fi
     420fi
     421
     422if test "$have_nsl" = 1; then
     423        if test "$ac_cv_search_inet_ntop" != "none required"; then
     424                LIBTRACE_LIBS="$LIBTRACE_LIBS $ac_cv_search_inet_ntop"
     425                LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_inet_ntop"
     426        fi
     427fi
     428
     429if test "$have_socket" = 1; then
     430        if test "$ac_cv_search_getservent" != "none required"; then
     431                LIBTRACE_LIBS="$LIBTRACE_LIBS $ac_cv_search_getservent"
     432                LIBPKTDUMP_LIBS="$LIBPKTDUMP_LIBS $ac_cv_search_getservent"
     433        fi
     434fi
     435
     436
     437# Stupid AC_SEARCH_LIB appends stuff to LIBS even when I don't want it to, so
     438# just set libs to null here to avoid linking against them by default
     439LIBS=
     440
    379441
    380442# For now, the user has to explicitly ask for the LLVM stuff, as it's a bit
     
    414476        else
    415477                LIBCXXFLAGS="`$LLVM_CONFIG --cxxflags` $CXXFLAGS"
    416                 ADD_LIBS="$ADD_LIBS `$LLVM_CONFIG --libs all`";
     478                LIBTRACE_LIBS="$LIBRACE_LIBS `$LLVM_CONFIG --libs all`";
    417479                LDFLAGS="`$LLVM_CONFIG --ldflags` $LDFLAGS";
    418480                JIT=yes
     
    427489AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24])
    428490AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25])
    429 AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_deflate" = yes])
    430 AM_CONDITIONAL([HAVE_BZLIB], [test "$ac_cv_lib_bz2_BZ2_bzDecompressInit" = yes])
    431 AM_CONDITIONAL([HAVE_LZO], [test "$ac_cv_lib_lzo2_lzo1x_1_compress" = yes])
     491AM_CONDITIONAL([HAVE_ZLIB], [test "$have_zlib" = 1])
     492AM_CONDITIONAL([HAVE_BZLIB], [test "$have_bzip" = 1])
     493AM_CONDITIONAL([HAVE_LZO], [test "$have_lzo" = 1])
    432494AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
    433495AM_CONDITIONAL([HAVE_LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
    434496AM_CONDITIONAL([HAVE_LLVM], [test "x$JIT" != "xno" ])
    435 AM_CONDITIONAL([HAVE_NCURSES], [test "x$have_ncurses" = "xyes"])
     497AM_CONDITIONAL([HAVE_NCURSES], [test "$xhave_ncurses" = "xyes"])
    436498
    437499# Check for miscellaneous programs
     
    441503
    442504# Set all our output variables
    443 AC_SUBST([ADD_LIBS])
     505AC_SUBST([LIBTRACE_LIBS])
     506AC_SUBST([LIBPKTDUMP_LIBS])
     507AC_SUBST([TOOLS_LIBS])
     508#AC_SUBST([ADD_LIBS])
    444509AC_SUBST([ADD_LDFLAGS])
    445510AC_SUBST([ADD_INCLS])
Note: See TracChangeset for help on using the changeset viewer.