source: configure.in @ 97fcf28

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 97fcf28 was 97fcf28, checked in by Shane Alcock <salcock@…>, 10 years ago
  • Added a check for whether the compiler supports -fvisibility - this means we should be able to build on older versions of gcc again
  • Property mode set to 100644
File size: 11.8 KB
Line 
1# Process this file with autoconf to produce a configure script.
2
3# Now you only need to update the version number in two places - below,
4# and in the README
5
6AC_INIT([libtrace],[3.0.7],[contact@wand.net.nz],[libtrace])
7
8LIBTRACE_MAJOR=3
9LIBTRACE_MID=0
10LIBTRACE_MINOR=7
11
12AC_CONFIG_MACRO_DIR([m4])
13AC_CONFIG_SRCDIR(lib/trace.c)
14AM_INIT_AUTOMAKE
15m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
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])
20
21AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile
22        tools/Makefile tools/traceanon/Makefile tools/tracepktdump/Makefile
23        tools/tracemerge/Makefile tools/tracereport/Makefile
24        tools/tracertstats/Makefile tools/tracesplit/Makefile
25        tools/tracestats/Makefile tools/tracetop/Makefile
26        tools/tracereplay/Makefile tools/tracediff/Makefile
27        examples/Makefile examples/skeleton/Makefile examples/rate/Makefile
28        examples/stats/Makefile examples/tutorial/Makefile
29        docs/libtrace.doxygen
30        lib/libtrace.h
31        ])
32dnl GNU C library
33dnl AC_GNU_SOURCE
34
35
36AM_CONFIG_HEADER([config.h])
37dnl Checks for programs.
38AC_PROG_CC
39AC_PROG_CXX
40AC_PROG_INSTALL
41dnl AC_PROG_YACC
42AC_CHECK_PROGS(YACC, 'bison -y' byacc yacc)
43AM_PROG_LEX
44
45AC_CONFIG_LIBOBJ_DIR(lib)
46
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
55if test "$GCC" = "yes"; then
56       
57        gcc_version=`gcc -dumpversion`
58
59        # This is probably not the most reliable way to test whether our
60        # compiler supports visibility, but it's better than nothing
61        #
62        # According to the gcc wiki - http://gcc.gnu.org/wiki/Visibility -
63        # visibility is supported in gcc 4.0 or later, so we just need to
64        # check the major version number
65
66        major=${gcc_version%\.*\.*}
67
68        if test "$major" -lt 4; then
69                vis=no
70        else
71                vis=yes
72        fi
73       
74        CFLAGS="$CFLAGS -Wall -Wextra -Wmissing-prototypes -O2"
75        CXXFLAGS="$CXXFLAGS -Wall -Wextra -O2"
76        LIBCFLAGS="$CFLAGS"
77        LIBCFLAGS="$LIBCFLAGS -DLT_BUILDING_DLL=1"
78        LIBCXXFLAGS="$CXXFLAGS"
79        LIBCXXFLAGS="$CXXFLAGS -DLT_BUILDING_DLL=1"
80       
81        if test "$vis" = "yes"; then
82                LIBCFLAGS="$LIBCFLAGS -fvisibility=hidden"
83                LIBCXXFLAGS="$CXXFLAGS -fvisibility=hidden"
84        fi
85fi
86
87AC_PROG_LIBTOOL
88
89# Checks for library functions.
90AC_PROG_GCC_TRADITIONAL
91AC_CHECK_FUNCS(socket strdup strlcpy strcasecmp strncasecmp snprintf)
92
93AC_CHECK_SIZEOF([long int])
94
95
96
97# Check for various broken functions
98AC_FUNC_MALLOC
99AC_FUNC_REALLOC
100
101# *BSD doesn't have strndup. Currently provide our own.
102AC_REPLACE_FUNCS(strndup)
103
104# Checks for header files.
105AC_HEADER_STDC
106AC_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)
107
108AC_CHECK_HEADERS(netinet/in.h)
109AC_CHECK_HEADERS(netpacket/packet.h,[
110        libtrace_netpacket_packet_h=true
111        AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net])
112])
113AC_CHECK_HEADER(net/if.h,
114        AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[
115 #include <sys/types.h>
116 #include <sys/socket.h>
117])
118
119AC_CHECK_HEADER(netinet/ether.h,
120        AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[
121 #include <sys/types.h>
122 #include <sys/socket.h>
123 #include <netinet/in.h>
124 #include <net/if.h>
125])
126
127AC_CHECK_HEADER(netinet/if_ether.h,
128        AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[
129 #include <sys/types.h>
130 #include <sys/socket.h>
131 #include <netinet/in.h>
132 #include <net/if.h>
133])
134
135AC_CHECK_HEADER(net/if_arp.h,
136        AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[
137 #include <sys/types.h>
138 #include <sys/socket.h>
139 #include <netinet/in.h>
140 #include <net/if.h>
141])
142
143# Checking for the right bpf header to include
144AC_CHECK_HEADER(pcap-bpf.h)
145AC_CHECK_HEADER(net/bpf.h)
146AC_CHECK_HEADER(gdc.h,AC_DEFINE(HAVE_LIBGDC,1,[has gdc.h]))
147
148# Check to see if we have libdl - *BSD has built-in libdl
149AC_CHECK_LIB(dl, dlopen)
150# check pcap
151AC_CHECK_LIB(pcap,pcap_next_ex,pcapfound=1,pcapfound=0)
152#AC_CHECK_LIB(pcap,pcap_next_ex)
153#AC_REPLACE_FUNCS(pcap_open_dead)
154#AC_REPLACE_FUNCS(pcap_dump_flush)
155#AC_REPLACE_FUNCS(pcap_next_ex)
156AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
157AC_CHECK_DECLS([BIOCSETIF],,,[
158#include <sys/types.h>
159#include <sys/time.h>
160#include <sys/ioctl.h>
161#include <net/bpf.h>
162])
163
164# configure time options for man pages
165AC_ARG_WITH(man,
166            AS_HELP_STRING(--with-man,install man pages by default),[
167             if test "$withval" = yes
168             then
169                     MANPAGES="docs/man/man3/[a-zA-Z]*.3"
170             else
171                     MANPAGES=""
172             fi
173])
174
175AC_PROG_CXX
176
177if test "$pcapfound" = 0; then
178        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)
179else
180        ADD_LIBS="$ADD_LIBS -lpcap"
181        AC_DEFINE([HAVE_LIBPCAP],1,[compile with libpcap support])
182        AC_DEFINE([HAVE_BPF_FILTER],1,[compile with bpf filter support])
183fi
184
185# configure time options for use of DAG cards
186# borrowed from libpcap!
187AC_ARG_WITH(dag,
188            AS_HELP_STRING(--with-dag[=DIR],include DAG live capture support (located in directory DIR, if supplied)),
189[
190        if test "$withval" = no
191        then
192                want_dag=no
193        elif test "$withval" = yes
194        then
195                want_dag=yes
196                dag_root=/usr/local/dag
197        else
198                want_dag=yes
199                dag_root=$withval
200        fi
201],[
202        #
203        # Use DAG API if present, otherwise don't
204        #
205        want_dag=ifpresent
206        dag_root=/usr/local/dag
207])
208
209# DAG 3.0 actually puts header files and shared libraries into sensible
210# places now, so we should be able to do a simple CHECK_LIB to see if
211# they're there!
212
213# Addendum: It turns out DAG 2.5 does this too, so we'll match DAG2.5 in here
214# also. This isn't such a bad thing, the DAG2.5 API is essentially the same as
215# DAG 3.0 and libtrace will use the same format_dagXX source for both
216libtrace_dag=false
217libtrace_dag_version=none
218
219if test "$with_dag" != no; then
220        AC_CHECK_LIB(dag, dag_open, dag_found=1, dag_found=0)
221        if test "$dag_found" = 1; then
222                ADD_LIBS="$ADD_LIBS -ldag"
223                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
224                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
225                libtrace_dag=true
226               
227                AC_DEFINE(DAG_VERSION,30,[defines the DAG driver version])
228                libtrace_dag_version=30
229        fi
230fi
231
232# turn the test part of the next block into a function, so it can be
233# called multiple times for $dag_root, /root/dag, /usr/local/lib
234dag_drv_v="DAG not present"
235
236# Now check for 2.4 DAG drivers which don't install as cleanly!
237if test "$with_dag" != no -a "$libtrace_dag" = false; then
238        AC_MSG_CHECKING(whether we have DAG 2.4 API instead)
239
240        if test -r "$dag_root/lib"; then
241                dag_lib_dir="$dag_root/lib"
242        else
243                dag_lib_dir="$dag_root"
244        fi
245       
246        if test -r "$dag_root/include"; then
247                dag_tools_dir="$dag_root/tools"
248                dag_include_dir="$dag_root/include"
249        else
250                dag_tools_dir="$dag_root"
251                dag_include_dir="$dag_root"
252        fi
253
254        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
255        then
256                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
257                ADD_LIBS="$ADD_LIBS -ldag"
258                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
259                DAG_TOOLS_DIR=$dag_tools_dir
260                AC_SUBST([DAG_TOOLS_DIR])
261                libtrace_dag=true
262               
263                AC_DEFINE(HAVE_DAG_API, 1, [define if you have the DAG API])
264                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG live capture support])
265                AC_DEFINE(DAG_VERSION, 24, [defines the DAG driver version])
266                libtrace_dag_version=24
267        else
268                if test "$want_dag" = yes; then
269                        AC_MSG_ERROR(DAG API not found under directory $dag_root
270; use --without-dag)
271                fi
272                libtrace_dag=false
273        fi
274        AC_MSG_RESULT($libtrace_dag)
275
276fi
277
278# Try to determine the DAG driver version
279if test x"$libtrace_dag" = xtrue; then
280        dag_drv_v="Unknown"
281        files=`locate /usr/*dag*/VERSION`
282        file_count=0
283
284        for i in $files; do
285                if $file_count > 0; then
286                        dag_drv_v="Indeterminate"
287                        break
288                fi
289                dag_drv_v=`cat $i`
290                file_count=$file_count+1
291        done
292fi
293DAG_VERSION_NUM=$dag_drv_v
294
295
296AC_CHECK_LIB(z, deflate)
297AC_CHECK_LIB(bz2, BZ2_bzDecompressInit)
298AC_CHECK_LIB(lzo2, lzo1x_1_compress)
299AC_CHECK_LIB(pthread, pthread_create)
300AC_SEARCH_LIBS(mvprintw, ncurses, [], [ AC_MSG_ERROR([NCurses library not available]) ])
301
302AC_ARG_WITH([llvm],
303        [AC_HELP_STRING([--with-llvm],
304                [support Just In Time compiler])],
305        use_llvm="yes",
306        use_llvm="check")
307
308AC_PATH_PROG(llvm_config, llvm-config)
309
310if (test "$use_llvm" != "no"); then
311        AC_PATH_PROG(LLVM_CONFIG, llvm-config, no)
312        if test "$LLVM_CONFIG" = "no" ; then
313                AC_MSG_NOTICE([Unable to find llvm-config.  JIT support disabled.])
314                JIT=no
315        else
316                LIBCXXFLAGS="`$LLVM_CONFIG --cxxflags` $CXXFLAGS"
317                ADD_LIBS="$ADD_LIBS `$LLVM_CONFIG --libs all`";
318                LDFLAGS="`$LLVM_CONFIG --ldflags` $LDFLAGS";
319                JIT=yes
320                AC_DEFINE(HAVE_LLVM, 1, [Set to 1 if you have LLVM installed])
321        fi
322fi
323
324
325AM_CONDITIONAL([HAVE_BPF_CAPTURE], [test "$ac_cv_have_decl_BIOCSETIF" = yes ])
326AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
327AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag_version" = 24])
328AM_CONDITIONAL([DAG2_5], [test "$libtrace_dag_version" = 25])
329AM_CONDITIONAL([DAG3_0], [test "$libtrace_dag_version" = 30])
330AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_deflate" = yes])
331AM_CONDITIONAL([HAVE_BZLIB], [test "$ac_cv_lib_bz2_BZ2_bzDecompressInit" = yes])
332AM_CONDITIONAL([HAVE_LZO], [test "$ac_cv_lib_lzo2_lzo1x_1_compress" = yes])
333AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
334AM_CONDITIONAL([HAVE_LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
335AM_CONDITIONAL([HAVE_LLVM], [test "x$LLVM_CONFIG" != "xno" ])
336
337# Check for miscellaneous programs
338AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
339
340AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
341
342AC_SUBST([ADD_LIBS])
343AC_SUBST([ADD_LDFLAGS])
344AC_SUBST([ADD_INCLS])
345AC_SUBST([LTLIBOBJS])
346AC_SUBST([MANPAGES])
347AC_SUBST([PACKAGE_VERSION])
348AC_SUBST([LIBTRACE_MAJOR])
349AC_SUBST([LIBTRACE_MID])
350AC_SUBST([LIBTRACE_MINOR])
351AC_SUBST([DAG_VERSION_NUM])
352AC_SUBST([HAVE_BPF_CAPTURE])
353AC_SUBST([HAVE_LIBGDC])
354AC_SUBST([HAVE_LLVM])
355AC_SUBST([LIBCFLAGS])
356AC_SUBST([LIBCXXFLAGS])
357dnl and finally, output our Makefiles
358AC_OUTPUT
359
360reportopt() {
361        if test x"$2" = xtrue -o x"$2" = xyes; then
362                AC_MSG_NOTICE([$1: Yes])
363        else
364                AC_MSG_NOTICE([$1: No])
365        fi
366}
367
368echo
369AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
370reportopt "Compiled with PCAP 0.8 support" $ac_cv_lib_pcap_pcap_next_ex
371reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_deflate
372reportopt "Compiled with compressed trace (bz2) support" $ac_cv_lib_bz2_BZ2_bzDecompressInit
373reportopt "Compiled with compressed trace (lzo write only) support" $ac_cv_lib_lzo2_lzo1x_1_compress
374if test x"$libtrace_dag" = xtrue; then
375        if test "$libtrace_dag_version" = 24; then
376                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.4])
377        elif test "$libtrace_dag_version" = 30; then
378                AC_MSG_NOTICE([Compiled with DAG live capture support: 3.0])
379        else
380                AC_MSG_NOTICE([Compiled with DAG live capture support: 2.5])
381        fi     
382else
383        AC_MSG_NOTICE([Compiled with DAG live capture support: No])
384fi
385reportopt "Compiled with LLVM BPF JIT support" $JIT
386reportopt "Building man pages/documentation" $libtrace_doxygen
387
388echo
389ac_cv_errcount=0;
390if test -z "$YACC"; then
391        AC_MSG_WARN(bison or yacc not found. Please install bison before continuing)
392        ac_cv_errcount=$((ac_cv_errcount + 1))
393fi
394
395if test -z "$LEXLIB"; then
396        AC_MSG_WARN(flex or lex not found. Please install flex before continuing)
397        ac_cv_errcount=$((ac_cv_errcount + 1))
398fi
399
400if test $ac_cv_errcount -gt 0; then
401        AC_MSG_ERROR(Critical packages are missing and compilation will fail. Please install the packages listed above and rerun ./configure)
402fi
403
Note: See TracBrowser for help on using the repository browser.