source: configure.in @ 7da2676

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 7da2676 was 7da2676, checked in by Shane Alcock <salcock@…>, 11 years ago
  • Added a new tool called tracediff that searches for packets that differ between two trace files and dumps them nicely using libpacketdump
  • Property mode set to 100644
File size: 10.3 KB
RevLine 
[dcc1343]1# Process this file with autoconf to produce a configure script.
[144fc8d]2
[e5f1431]3# Now you only need to update the version number in two places - below,
4# and in the README
5
[83be9fc]6AC_INIT([libtrace],[3.0.7],[contact@wand.net.nz],[libtrace])
[e5f1431]7
[14d8a63]8LIBTRACE_MAJOR=3
[144fc8d]9LIBTRACE_MID=0
[83be9fc]10LIBTRACE_MINOR=7
[144fc8d]11
[099c35e]12AC_CONFIG_MACRO_DIR([m4])
[3085992]13AC_CONFIG_SRCDIR(lib/trace.c)
[e5f1431]14AM_INIT_AUTOMAKE
[6e565d9]15m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
[e5f1431]16
17AC_DEFINE([LIBTRACE_MAJOR],${LIBTRACE_MAJOR},[libtrace major version])
18AC_DEFINE([LIBTRACE_MID],${LIBTRACE_MID},[libtrace mid version])
19AC_DEFINE([LIBTRACE_MINOR],${LIBTRACE_MINOR},[libtrace minor version])
[14e60c60]20
[e5f1431]21AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile
[83f2cbf]22        tools/Makefile tools/traceanon/Makefile tools/tracepktdump/Makefile
[896ad39]23        tools/tracemerge/Makefile tools/tracereport/Makefile
24        tools/tracertstats/Makefile tools/tracesplit/Makefile
[a6da077]25        tools/tracestats/Makefile tools/tracetop/Makefile
[7da2676]26        tools/tracereplay/Makefile tools/tracediff/Makefile
[6187a46]27        examples/Makefile examples/skeleton/Makefile examples/rate/Makefile
[7bd8f3d]28        examples/stats/Makefile
[47de0aa]29        docs/libtrace.doxygen
30        lib/libtrace.h
[d5a27e8]31        ])
[1f3696b]32dnl GNU C library
[e5d3718]33dnl AC_GNU_SOURCE
[3085992]34
[61ecfb6]35
[755e794]36AM_CONFIG_HEADER([config.h])
[14e60c60]37dnl Checks for programs.
38AC_PROG_CC
[a3505a8]39AC_PROG_CXX
[14e60c60]40AC_PROG_INSTALL
[66cf27f]41dnl AC_PROG_YACC
42AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc)
[22ce0d5]43AM_PROG_LEX
[14e60c60]44
[61ecfb6]45AC_CONFIG_LIBOBJ_DIR(lib)
[14e60c60]46
[5540efc]47# Checks for typedefs, structures, and compiler characteristics.
48AC_C_CONST
49AC_C_INLINE
50AC_C_BIGENDIAN
51AC_TYPE_SIZE_T
52AC_HEADER_TIME
53AC_SYS_LARGEFILE
54
[470afa7]55if test "$GCC" = "yes"; then
[0ca90be]56        CFLAGS="$CFLAGS -Wall -Wextra -Wmissing-prototypes -O2"
57# We assume that gcc knows about -fvisibility and friends, as I can't see
58# a good easy way of testing for it here.
59        CFLAGS="$CFLAGS -DLT_BUILDING_DLL=1"
60        CFLAGS="$CFLAGS -fvisibility=hidden -fvisibility-inlines-hidden"
[470afa7]61fi
62
[47de0aa]63AC_PROG_LIBTOOL
[858f07f]64
[5540efc]65# Checks for library functions.
66AC_PROG_GCC_TRADITIONAL
[e283596]67AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf)
[5540efc]68
[41b53c2]69AC_CHECK_SIZEOF([long int])
70
[fe3d755]71
72
[41b53c2]73# Check for various broken functions
74AC_FUNC_MALLOC
75AC_FUNC_REALLOC
76
77# *BSD doesn't have strndup. Currently provide our own.
78AC_REPLACE_FUNCS(strndup)
79
[dcc1343]80# Checks for header files.
[14e60c60]81AC_HEADER_STDC
[11346a5]82AC_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 )
[808a478]83
84AC_CHECK_HEADERS(netinet/in.h)
[e5c2bc4]85AC_CHECK_HEADERS(netpacket/packet.h,[
86        libtrace_netpacket_packet_h=true
87        AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net])
88])
[808a478]89AC_CHECK_HEADER(net/if.h,
[e5c2bc4]90        AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[
91 #include <sys/types.h>
[808a478]92 #include <sys/socket.h>
93])
94
[41b53c2]95AC_CHECK_HEADER(netinet/ether.h,
[e5c2bc4]96        AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[
[41b53c2]97 #include <sys/types.h>
98 #include <sys/socket.h>
99 #include <netinet/in.h>
100 #include <net/if.h>
101])
102
[808a478]103AC_CHECK_HEADER(netinet/if_ether.h,
[e5c2bc4]104        AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[
[808a478]105 #include <sys/types.h>
106 #include <sys/socket.h>
107 #include <netinet/in.h>
108 #include <net/if.h>
109])
110
[e5c2bc4]111AC_CHECK_HEADER(net/if_arp.h,
112        AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[
[808a478]113 #include <sys/types.h>
114 #include <sys/socket.h>
115 #include <netinet/in.h>
116 #include <net/if.h>
117])
118
[dcc1343]119# Checking for the right bpf header to include
[e5c2bc4]120AC_CHECK_HEADER(pcap-bpf.h)
121AC_CHECK_HEADER(net/bpf.h)
[530bcf0]122AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h]))
[5540efc]123
[4e65f42]124# Check to see if we have libdl - *BSD has built-in libdl
[e5c2bc4]125AC_CHECK_LIB(dl, dlopen)
126# check pcap
[544c680]127AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0)
128#AC_CHECK_LIB(pcap,pcap_next_ex)
129#AC_REPLACE_FUNCS(pcap_open_dead)
130#AC_REPLACE_FUNCS(pcap_dump_flush)
131#AC_REPLACE_FUNCS(pcap_next_ex)
[e5c2bc4]132AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
[755e794]133AC_CHECK_DECLS([BIOCSETIF],,,[
134#include <sys/types.h>
135#include <sys/time.h>
136#include <sys/ioctl.h>
137#include <net/bpf.h>
138])
[14e60c60]139
[da17570]140# configure time options for man pages
141AC_ARG_WITH(man,
[01bc623]142            AS_HELP_STRING(--with-man,install man pages by default),[
[da17570]143             if test "$withval" = yes
144             then
[4362100]145                     MANPAGES="docs/man/man3/[a-zA-Z]*.3"
[da17570]146             else
147                     MANPAGES=""
148             fi
[01bc623]149])
[97eadcc]150
[e5c2bc4]151AC_PROG_CXX
[4a605a9]152
[544c680]153if test "$pcapfound" = 0; then
154        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)
155else
156        ADD_LIBS="$ADD_LIBS -lpcap"
[d5a27e8]157        AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support])
[1c68a81]158        AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support])
[544c680]159fi
160
[dcc1343]161# configure time options for use of DAG cards
162# borrowed from libpcap!
[4fd12ac]163AC_ARG_WITH(dag,
[b282cf8]164            AS_HELP_STRING(--with-dag[=DIR],include DAG live capture support (located in directory DIR, if supplied)),
[4fd12ac]165[
166        if test "$withval" = no
167        then
168                want_dag=no
169        elif test "$withval" = yes
170        then
171                want_dag=yes
[df3bd99]172                dag_root=/usr/local/dag
[4fd12ac]173        else
174                want_dag=yes
175                dag_root=$withval
176        fi
177],[
178        #
179        # Use DAG API if present, otherwise don't
180        #
181        want_dag=ifpresent
[df3bd99]182        dag_root=/usr/local/dag
[4fd12ac]183])
184
[52656ed]185# DAG 3.0 actually puts header files and shared libraries into sensible
186# places now, so we should be able to do a simple CHECK_LIB to see if
187# they're there!
188
189# Addendum: It turns out DAG 2.5 does this too, so we'll match DAG2.5 in here
190# also. This isn't such a bad thing, the DAG2.5 API is essentially the same as
191# DAG 3.0 and libtrace will use the same format_dagXX source for both
[437d002]192libtrace_dag=false
[52656ed]193libtrace_dag_version=none
194
[4fd12ac]195if test "$with_dag" != no; then
[52656ed]196        AC_CHECK_LIB(dag, dag_open, dag_found=1, dag_found=0)
197        if test "$dag_found" = 1; then
198                ADD_LIBS="$ADD_LIBS -ldag"
[b282cf8]199                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
200                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
[52656ed]201                libtrace_dag=true
202               
203                AC_DEFINE(DAG_VERSION,30,[defines the DAG driver version])
204                libtrace_dag_version=30
205        fi
206fi
207
208# turn the test part of the next block into a function, so it can be
209# called multiple times for $dag_root, /root/dag, /usr/local/lib
[d8ed7e2]210dag_drv_v="DAG not present"
[52656ed]211
212# Now check for 2.4 DAG drivers which don't install as cleanly!
213if test "$with_dag" != no -a "$libtrace_dag" = false; then
[5798dc6]214        AC_MSG_CHECKING(whether we have DAG 2.4 API instead)
[4fd12ac]215
216        if test -r "$dag_root/lib"; then
217                dag_lib_dir="$dag_root/lib"
218        else
219                dag_lib_dir="$dag_root"
220        fi
[9f15cd1]221       
[e502f76]222        if test -r "$dag_root/include"; then
[dfc2673]223                dag_tools_dir="$dag_root/tools"
[4fd12ac]224                dag_include_dir="$dag_root/include"
225        else
226                dag_tools_dir="$dag_root"
227                dag_include_dir="$dag_root"
[e502f76]228        fi
[4fd12ac]229
230        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
[dcc1343]231        then
[4fd12ac]232                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
233                ADD_LIBS="$ADD_LIBS -ldag"
234                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
[caa8f99]235                DAG_TOOLS_DIR=$dag_tools_dir
236                AC_SUBST([DAG_TOOLS_DIR])
[437d002]237                libtrace_dag=true
[80a6589]238               
[b282cf8]239                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
240                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
[52656ed]241                AC_DEFINE(DAG_VERSION, 24, [defines the DAG driver version])
242                libtrace_dag_version=24
[4fd12ac]243        else
244                if test "$want_dag" = yes; then
245                        AC_MSG_ERROR(DAG API not found under directory $dag_root
246; use --without-dag)
247                fi
[437d002]248                libtrace_dag=false
[4fd12ac]249        fi
[437d002]250        AC_MSG_RESULT($libtrace_dag)
[0fd4ad6]251
[4fd12ac]252fi
[52656ed]253
[d8ed7e2]254# Try to determine the DAG driver version
255if test x"$libtrace_dag" = xtrue; then
256        dag_drv_v="Unknown"
257        files=`locate /usr/*dag*/VERSION`
258        file_count=0
259
260        for i in $files; do
261                if $file_count > 0; then
262                        dag_drv_v="Indeterminate"
263                        break
264                fi
265                dag_drv_v=`cat $i`
266                file_count=$file_count+1
267        done
268fi
269DAG_VERSION_NUM=$dag_drv_v
270
271
[c66068d]272AC_CHECK_LIB(z, deflate)
273AC_CHECK_LIB(bz2, BZ2_bzDecompressInit)
[f66a2dca]274AC_CHECK_LIB(pthread, pthread_create)
[a6da077]275AC_SEARCH_LIBS(mvprintw, ncurses, [], [ AC_MSG_ERROR([NCurses library not available]) ])
[7d31d26]276
[1c68a81]277AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
[4a605a9]278AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
[52656ed]279AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24])
280AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25])
281AM_CONDITIONAL([DAG3_0], [test "$libtrace_dag_version" = 30])
[c66068d]282AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_deflate" = yes])
[f66a2dca]283AM_CONDITIONAL([HAVE_BZLIB], [test "$ac_cv_lib_bz2_BZ2_bzDecompressInit" = yes])
[7b2a39b]284AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
[530bcf0]285AM_CONDITIONAL([HAVE_LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
[4a605a9]286
287# Check for miscellaneous programs
288AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
289
290AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
[dcc1343]291
[4fd12ac]292AC_SUBST([ADD_LIBS])
293AC_SUBST([ADD_LDFLAGS])
294AC_SUBST([ADD_INCLS])
[be40c18]295AC_SUBST([LTLIBOBJS])
[da17570]296AC_SUBST([MANPAGES])
[e5f1431]297AC_SUBST([PACKAGE_VERSION])
298AC_SUBST([LIBTRACE_MAJOR])
299AC_SUBST([LIBTRACE_MID])
300AC_SUBST([LIBTRACE_MINOR])
[0fd4ad6]301AC_SUBST([DAG_VERSION_NUM])
[1c68a81]302AC_SUBST([HAVE_BPF_CAPTURE])
[530bcf0]303AC_SUBST([HAVE_LIBGDC])
[dea6547]304dnl and finally, output our Makefiles
[6659ffb]305AC_OUTPUT
[437d002]306
[41b53c2]307reportopt() {
[ba0017c]308        if test x"$2" = xtrue -o x"$2" = xyes; then
[437d002]309                AC_MSG_NOTICE([$1: Yes])
310        else
311                AC_MSG_NOTICE([$1: No])
312        fi
313}
314
[306f91c]315echo
[e5f1431]316AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
[544c680]317reportopt "Compiled with PCAP 0.8 support" $ac_cv_lib_pcap_pcap_next_ex
[c66068d]318reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_deflate
319reportopt "Compiled with compressed trace (bz2) support" $ac_cv_lib_bz2_BZ2_bzDecompressInit
[01b2922]320if test x"$libtrace_dag" = xtrue; then
[52656ed]321        if test "$libtrace_dag_version" = 24; then
[b282cf8]322                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.4])
[52656ed]323        elif test "$libtrace_dag_version" = 30; then
[b282cf8]324                AC_MSG_NOTICE([Compiled with DAG live capture support: 3.0])
[01b2922]325        else
[b282cf8]326                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.5])
[52656ed]327        fi     
[01b2922]328else
[b282cf8]329        AC_MSG_NOTICE([Compiled with DAG live capture support: No])
[01b2922]330fi
[437d002]331reportopt "Building man pages/documentation" $libtrace_doxygen
332
[66cf27f]333echo
334ac_cv_errcount=0;
335if test -z "$YACC"; then
336        AC_MSG_WARN(bison or yacc not found. Please install bison before continuing)
337        ac_cv_errcount=$((ac_cv_errcount + 1))
338fi
339
340if test -z "$LEXLIB"; then
341        AC_MSG_WARN(flex or lex not found. Please install flex before continuing)
342        ac_cv_errcount=$((ac_cv_errcount + 1))
343fi
344
345if test $ac_cv_errcount -gt 0; then
346        AC_MSG_ERROR(Critical packages are missing and compilation will fail. Please install the packages listed above and rerun ./configure)
347fi
348
Note: See TracBrowser for help on using the repository browser.