Changeset c11c3ce for configure.in


Ignore:
Timestamp:
08/25/10 11:12:10 (10 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:
4c92c49
Parents:
4e94095
Message:
  • Tidy up and document configure script better, as it is pretty scary these days
File:
1 edited

Legend:

Unmodified
Added
Removed
  • configure.in

    ra1e177d rc11c3ce  
    2020AC_CONFIG_SRCDIR(lib/trace.c)
    2121AM_INIT_AUTOMAKE
     22
     23# Make sure we use the relatively silent automake output
    2224m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
    2325
     26# Define our libtrace version number externally so we can use it in the source
     27# as well, if needed.
    2428AC_DEFINE([LIBTRACE_MAJOR],${LIBTRACE_MAJOR},[libtrace major version])
    2529AC_DEFINE([LIBTRACE_MID],${LIBTRACE_MID},[libtrace mid version])
    2630AC_DEFINE([LIBTRACE_MINOR],${LIBTRACE_MINOR},[libtrace minor version])
    2731
     32# These are all the files we want to be built for us by configure
    2833AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile
    2934        tools/Makefile tools/traceanon/Makefile tools/tracepktdump/Makefile
     
    3742        lib/libtrace.h
    3843        ])
    39 dnl GNU C library
    40 dnl AC_GNU_SOURCE
     44
     45
     46# Function that checks if the C++ compiler actually works - there's a bit of
     47# oversight in autoconf that will set the C++ compiler to g++ if no compiler
     48# is found, even if g++ is not present! So we need an extra test to make sure
     49# that the compiler works :(
    4150
    4251AC_DEFUN([rw_PROG_CXX_WORKS],
     
    5160])
    5261
    53 
     62# Put all our automake definitions in config.h
    5463AM_CONFIG_HEADER([config.h])
    55 dnl Checks for programs.
     64
     65# Checks for C and C++ compilers
    5666AC_PROG_CC
    5767AC_PROG_CXX
     
    6272fi
    6373
    64 
    65 
     74# Checking for 'install'
    6675AC_PROG_INSTALL
    67 dnl AC_PROG_YACC
     76
     77# Checking for bison and flex
    6878AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc)
    6979AM_PROG_LEX
    7080
     81# All our source files for function replacements are in lib/
    7182AC_CONFIG_LIBOBJ_DIR(lib)
     83
     84# Check for various "replacement" functions
     85AC_FUNC_MALLOC
     86AC_FUNC_REALLOC
     87
     88# *BSD doesn't have strndup. Currently provide our own.
     89AC_REPLACE_FUNCS(strndup)
     90
    7291
    7392# Checks for typedefs, structures, and compiler characteristics.
     
    7998AC_SYS_LARGEFILE
    8099
     100# Set our C compiler flags based on the gcc version
    81101if test "$GCC" = "yes"; then
    82102       
     
    111131fi
    112132
     133# Check for libtool
    113134AC_PROG_LIBTOOL
    114135
    115136# Checks for library functions.
    116137AC_PROG_GCC_TRADITIONAL
     138
     139# Fail if any of these functions are missing
    117140AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf)
    118141
    119142AC_CHECK_SIZEOF([long int])
    120143
    121 
    122 
    123 # Check for various broken functions
    124 AC_FUNC_MALLOC
    125 AC_FUNC_REALLOC
    126 
    127 # *BSD doesn't have strndup. Currently provide our own.
    128 AC_REPLACE_FUNCS(strndup)
    129144
    130145# Checks for header files.
     
    132147AC_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 sys/prctl.h)
    133148
     149
     150# OpenSolaris puts ncurses.h in /usr/include/ncurses rather than /usr/include,
     151# so check for that
    134152AC_CHECK_HEADERS(ncurses.h,,[missing_ncurses=true])
    135153
     
    141159
    142160
     161# Check for the presence of various networking headers and define appropriate
     162# macros
    143163AC_CHECK_HEADERS(netinet/in.h)
    144164AC_CHECK_HEADERS(netpacket/packet.h,[
     
    176196])
    177197
     198# Check for sdl_len in sockaddr_dl - sockaddr_dl is used on BSD systems
    178199if test "$libtrace_netpacket_packet_h" != "true"; then
    179 # Check for sdl_len in sockaddr_dl
    180200        AC_CHECK_MEMBER([struct sockaddr_dl.sdl_len],
    181201                AC_DEFINE(HAVE_SDL_LEN,1,[Has sdl_len in sockaddr_dl]),,[
     
    186206fi
    187207
    188 
    189 
    190208# Checking for the right bpf header to include
    191209AC_CHECK_HEADER(pcap-bpf.h)
    192210AC_CHECK_HEADER(net/bpf.h)
     211
     212# Checking for libgdc
    193213AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h]))
    194214
    195215# Check to see if we have libdl - *BSD has built-in libdl
    196216AC_CHECK_LIB(dl, dlopen)
    197 # check pcap
     217
     218# Check for libpcap
    198219AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0)
    199 #AC_CHECK_LIB(pcap,pcap_next_ex)
    200 #AC_REPLACE_FUNCS(pcap_open_dead)
    201 #AC_REPLACE_FUNCS(pcap_dump_flush)
    202 #AC_REPLACE_FUNCS(pcap_next_ex)
    203220AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
    204221AC_CHECK_DECLS([BIOCSETIF],,,[
     
    209226])
    210227
    211 # configure time options for man pages
     228# Configure options for man pages
    212229AC_ARG_WITH(man,
    213230            AS_HELP_STRING(--with-man,install man pages by default),[
     
    220237])
    221238
    222 AC_PROG_CXX
    223 
     239# Complain if we didn't find a suitable libpcap
    224240if test "$pcapfound" = 0; then
    225241        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)
     
    230246fi
    231247
    232 # configure time options for use of DAG cards
    233 # borrowed from libpcap!
     248# Configure options for use of DAG cards
     249# Originally borrowed from libpcap, but extended quite a bit :)
     250# More details on how this check works:
     251#       http://wand.net.nz/trac/libtrace/wiki/DAGNotes
     252
    234253AC_ARG_WITH(dag,
    235254            AS_HELP_STRING(--with-dag[=DIR],include DAG live capture support (located in directory DIR, if supplied)),
     
    277296fi
    278297
    279 # turn the test part of the next block into a function, so it can be
     298# TODO: turn the test part of the next block into a function, so it can be
    280299# called multiple times for $dag_root, /root/dag, /usr/local/lib
    281300dag_drv_v="DAG not present"
     
    324343
    325344# Try to determine the DAG driver version
    326 if test x"$libtrace_dag" = xtrue; then
    327         dag_drv_v="Unknown"
    328         files=`locate /usr/*dag*/VERSION`
    329         file_count=0
    330 
    331         for i in $files; do
    332                 if $file_count > 0; then
    333                         dag_drv_v="Indeterminate"
    334                         break
    335                 fi
    336                 dag_drv_v=`cat $i`
    337                 file_count=$file_count+1
    338         done
    339 fi
    340 DAG_VERSION_NUM=$dag_drv_v
     345#if test x"$libtrace_dag" = xtrue; then
     346#       dag_drv_v="Unknown"
     347#       files=`locate /usr/*dag*/VERSION`
     348#       file_count=0
     349#
     350#       for i in $files; do
     351#                if $file_count > 0; then
     352#                        dag_drv_v="Indeterminate"
     353#                        break
     354#                fi
     355#                dag_drv_v=`cat $i`
     356#                file_count=$file_count+1
     357#        done
     358#fi
     359#DAG_VERSION_NUM=$dag_drv_v
    341360
    342361have_ncurses=yes
    343362
     363# Checks for various "optional" libraries
    344364AC_CHECK_LIB(z, deflate)
    345365AC_CHECK_LIB(bz2, BZ2_bzDecompressInit)
    346366AC_CHECK_LIB(lzo2, lzo1x_1_compress)
    347367AC_CHECK_LIB(pthread, pthread_create)
     368
     369# Check for ncurses
    348370AC_SEARCH_LIBS(mvprintw, ncurses, , have_ncurses=no)
     371
     372# These libraries have to be explicitly linked in OpenSolaris
    349373AC_SEARCH_LIBS(getservent, socket, [], [], -lnsl)               
    350374AC_SEARCH_LIBS(inet_ntop, nsl, [], [], -lsocket)
     
    360384JIT=no
    361385
     386# Search for LLVM and the libraries that it requires
    362387if (test "$use_llvm" != "no"); then
    363388        AC_PATH_PROG(LLVM_CONFIG, llvm-config, no)
     
    394419
    395420
     421# Define automake conditionals for use in our Makefile.am files
    396422AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
    397423AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
    398424AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24])
    399425AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25])
    400 #AM_CONDITIONAL([DAG3_0], [test "$libtrace_dag_version" = 30])
    401426AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_deflate" = yes])
    402427AM_CONDITIONAL([HAVE_BZLIB], [test "$ac_cv_lib_bz2_BZ2_bzDecompressInit" = yes])
     
    412437AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
    413438
     439# Set all our output variables
    414440AC_SUBST([ADD_LIBS])
    415441AC_SUBST([ADD_LDFLAGS])
     
    428454AC_SUBST([LIBCFLAGS])
    429455AC_SUBST([LIBCXXFLAGS])
    430 dnl and finally, output our Makefiles
     456
     457
     458# Finally, output our Makefiles
    431459AC_OUTPUT
    432460
     461# Function for reporting whether an option was set or not
    433462reportopt() {
    434463        if test x"$2" = xtrue -o x"$2" = xyes; then
     
    439468}
    440469
     470
     471# Report which configure options were set
    441472echo
    442473AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
     
    460491reportopt "Building tracetop (requires libncurses)" $have_ncurses
    461492
     493# Report any errors relating to missing bison, flex, etc.
    462494echo
    463495ac_cv_errcount=0;
Note: See TracChangeset for help on using the changeset viewer.