source: configure.in @ 5540efc

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 5540efc was 5540efc, checked in by Daniel Lawson <dlawson@…>, 15 years ago

makefile.am error -0 should use uninstall-local apparently
added checks for libgdc, which tracertstats requires

  • Property mode set to 100644
File size: 10.3 KB
Line 
1# Process this file with autoconf to produce a configure script.
2
3LIBTRACE_MAJOR=2
4LIBTRACE_MID=0
5LIBTRACE_MINOR=24
6
7AC_INIT(libtrace,2.0.24,[contact@wand.net.nz],libtrace)
8AC_CONFIG_SRCDIR(lib/trace.c)
9AM_INIT_AUTOMAKE(libtrace,2.0.24)
10
11AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile tools/Makefile tools/traceanon/Makefile tools/tracedump/Makefile tools/tracemerge/Makefile tools/tracereport/Makefile tools/tracertstats/Makefile tools/tracesplit/Makefile  ])
12dnl GNU C library
13dnl AC_GNU_SOURCE
14
15
16AM_CONFIG_HEADER(config.h)
17#AC_CONFIG_HEADERS([config.h])
18dnl Checks for programs.
19AC_PROG_CC
20AC_PROG_CXX
21AC_PROG_INSTALL
22AC_LIBTOOL_DLOPEN
23AC_PROG_LIBTOOL
24
25AC_CONFIG_LIBOBJ_DIR(lib)
26
27# Checks for typedefs, structures, and compiler characteristics.
28AC_C_CONST
29AC_C_INLINE
30AC_C_BIGENDIAN
31AC_TYPE_SIZE_T
32AC_HEADER_TIME
33AC_SYS_LARGEFILE
34
35# Checks for library functions.
36AC_PROG_GCC_TRADITIONAL
37AC_CHECK_FUNCS(socket strdup)
38
39# Checks for header files.
40AC_HEADER_STDC
41dnl AC_CHECK_HEADERS(errno.h stdlib.h stdio.h assert.h string.h netinet/in.h assert.h errno.h fcntl.h net/ethernet.h netdb.h pcap.h stdio.h stdlib.h string.h sys/stat.h sys/types.h sys/socket.h sys/un.h unistd.h time.h sys/ioctl.h net/bpf.h pcap.h zlib.h pcap-bpf.h)
42AC_CHECK_HEADERS(pcap.h pcap-int.h pcap-bpf.h net/bpf.h zlib.h sys/limits.h stddef.h inttypes.h limits.h net/ethernet.h )
43
44AC_CHECK_HEADERS(netinet/in.h)
45
46AC_CHECK_HEADER(net/if.h,
47                AC_DEFINE(HAVE_NET_IF_H,1,[We have net/if.h]), [],
48[#include <sys/types.h>
49 #include <sys/socket.h>
50])
51
52
53AC_CHECK_HEADER(netinet/if_ether.h,
54                AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[We have netinet/if_ether.h]), [],
55[
56 #include <sys/types.h>
57 #include <sys/socket.h>
58 #include <netinet/in.h>
59 #include <net/if.h>
60])
61
62AC_CHECK_HEADER(net/if_arp.h,
63                AC_DEFINE(HAVE_NET_IF_ARP_H,1,[We have net/if_arp.h]), [],
64[
65 #include <sys/types.h>
66 #include <sys/socket.h>
67 #include <netinet/in.h>
68 #include <net/if.h>
69])
70
71       
72# Checking for the right bpf header to include
73AC_MSG_CHECKING([where the bpf headers are kept])
74echo ""
75bpfh=no
76AC_CHECK_HEADER(pcap-bpf.h,
77        [AC_DEFINE([HAVE_PCAP_BPF_H]) bpfh=pcap-bpf.h])
78if test $bpfh = no; then
79AC_CHECK_HEADER(net/bpf.h,
80        [AC_DEFINE([HAVE_NET_BPF_H]) bpfh=net/bpf.h])
81fi
82
83if test $bpfh = no; then
84  AC_MSG_RESULT([No BPF headers, compiling without support for BPF filters])
85  AC_DEFINE(HAVE_BPF,0,[Conditional for building bpf support])
86  libtrace_bpf=false
87else
88  AC_MSG_RESULT([Using $bpfh])
89  AC_DEFINE(HAVE_BPF,1,[Conditional for building bpf support])
90  libtrace_bpf=true
91fi
92
93
94AC_CHECK_LIB(gdc,GDC_out_graph,
95             libtrace_gdc=true,
96             libtrace_gdc=false)
97
98# Check for various broken functions
99AC_FUNC_MALLOC
100AC_FUNC_REALLOC
101
102# *BSD doesn't have strndup. Currently provide our own.
103AC_REPLACE_FUNCS(strndup)
104
105# Check to see if we have libpcap
106AC_CHECK_LIB(pcap,pcap_open_live,
107             libtrace_pcap=true,
108             libtrace_pcap=false)
109
110if test "$libtrace_pcap" = true; then
111    AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support])
112    ADD_LIBS="$ADD_LIBS  -lpcap"
113else
114    AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support])
115fi     
116
117# Only test for these functions if we have PCAP installed
118        if test "$libtrace_pcap" = true; then
119        # Earlier versions of pcap don't have pcap_open_dead. EG: the one
120        # OpenBSD ships with. Even Debian Woody is more up to date.
121        AC_CHECK_LIB(pcap,pcap_open_dead,
122                have_pcap_open_dead=true,
123                have_pcap_open_dead=false)
124
125        if test "$have_pcap_open_dead" = false; then
126                AC_REPLACE_FUNCS(pcap_open_dead)
127        fi
128   
129        # Versions of libpcap earlier than 0.8 don't have pcap_dump_flush
130        AC_CHECK_LIB(pcap,pcap_dump_flush,
131                     have_pcap_dump_flush=true,
132                     have_pcap_dump_flush=false)
133
134        if test "$have_pcap_dump_flush" = false; then
135                AC_REPLACE_FUNCS(pcap_dump_flush)
136        fi
137fi
138
139
140# configure time options for man pages
141AC_ARG_WITH(man,
142            AC_HELP_STRING([--with-man],
143                           [install man pages by default]),
144
145             if test "$withval" = yes
146             then
147                     MANPAGES="docs/man/man3/[a-zA-Z]*.3]"
148             else
149                     MANPAGES=""
150             fi
151)
152
153# configure time option for building libpacketdump
154# libpacketdump needs a C++ compiler to build, so we should do some tests
155# at this point to see if one is installed
156libtrace_libpacketdump=true
157AC_ARG_ENABLE(libpacketdump,
158              AC_HELP_STRING([--disable-libpacketdump],
159                             [disable building of libpacketdump (enabled by default). libpacketdump needs a c++ compiler to build] ),
160[
161        if test "$enableval" = no -o "$enableval" = false
162        then
163                libtrace_libpacketdump=false
164        else
165                libtrace_libpacketdump=true
166        fi
167],
168[
169        libtrace_libpacketdump=true
170])
171
172if test "$libtrace_libpacketdump" = true; then
173        AC_LANG_PUSH(C++)
174        AC_MSG_CHECKING([if we can compile C++ ])
175        AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
176                           [[
177#include <iostream>
178                           ]])],
179                [AC_DEFINE(HAVE_CXX,1,[define to test for presence of a working C++ compiler]) libtrace_cxx=true],
180                [AC_DEFINE(HAVE_CXX,0,[define to test for presence of a working C++ compiler]) libtrace_cxx=false])
181
182        AC_MSG_RESULT($libtrace_cxx)   
183        AC_LANG_POP(C++)
184
185        if test "$libtrace_cxx" = false; then
186                AC_MSG_ERROR([libpacketdump requested, but no C++ compiler found. Build with --disable-libpacketdump if you wish to continue anyway ])
187        fi
188fi
189
190# configure time option for building the libtrace tools
191# one of the tools requires libpacketdump, so won't build if libpacketdump
192# hasn't also been built
193libtrace_tools=true
194AC_ARG_ENABLE(tools,
195              AC_HELP_STRING([--disable-tools],
196                             [disable building of the tools contained in the tools/ directory]),
197[
198        if test "$enableval" = no -o "$enableval" = false
199        then
200                libtrace_tools=false
201        else
202                libtrace_tools=true
203        fi
204       
205],
206[
207        libtrace_tools=true
208])
209
210# configure time options for use of DAG cards
211# borrowed from libpcap!
212AC_ARG_WITH(dag,
213            AC_HELP_STRING([--with-dag[=DIR]],
214                           [include DAG support (located in directory DIR, if supplied)]),
215[
216        if test "$withval" = no
217        then
218                want_dag=no
219        elif test "$withval" = yes
220        then
221                want_dag=yes
222                dag_root=/root/dag
223        else
224                want_dag=yes
225                dag_root=$withval
226        fi
227],[
228        #
229        # Use DAG API if present, otherwise don't
230        #
231        want_dag=ifpresent
232        dag_root=/root/dag/
233])
234
235# turn the test part of the next block into a function, so it can be
236# called multiple times for $dag_root, /root/dag, /usr/local/lib
237libtrace_dag=false
238libtrace_dag2_4=false
239if test "$with_dag" != no; then
240        AC_MSG_CHECKING(whether we have DAG API)
241
242        if test -r "$dag_root/lib"; then
243                dag_lib_dir="$dag_root/lib"
244        else
245                dag_lib_dir="$dag_root"
246        fi
247       
248        if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
249                dag_tools_dir="$dag_root/tools"
250                dag_include_dir="$dag_root/include"
251        else
252                dag_tools_dir="$dag_root"
253                dag_include_dir="$dag_root"
254        fi
255
256        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
257        then
258                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
259                ADD_LIBS="$ADD_LIBS -ldag"
260                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
261                DAG_TOOLS_DIR=$dag_tools_dir
262                AC_SUBST([DAG_TOOLS_DIR])
263                libtrace_dag=true
264               
265                AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
266                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support])
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       
276        AC_MSG_CHECKING(if we are using DAG 2.4)
277        if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then
278                libtrace_dag2_4=true
279        else
280                libtrace_dag2_4=false
281        fi
282        AC_MSG_RESULT($libtrace_dag2_4)
283else
284        AC_DEFINE(HAVE_DAG,0,[conditional for building with DAG support])
285fi
286
287
288
289
290
291AC_ARG_WITH([zlib],
292    AC_HELP_STRING([--with-zlib],
293                               [name of zlib library (default is z)]),
294        [ac_cv_use_zlib=$withval],
295    [ac_cv_use_zlib=z])
296
297AC_ARG_WITH([zlib-path],
298    AC_HELP_STRING([--with-zlib-path],
299                   [location of zlib library (default is /usr/lib)]),
300    [ac_cv_use_zlib_path=$withval],
301    [ac_cv_use_zlib_path=/usr/lib])
302
303libtrace_zlib=false
304if test "$ac_cv_use_zlib" != no; then
305   
306    zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so"
307
308    # if the library is in /usr/lib/, then just use AC_CHECK_LIB
309    if test x"${ac_cv_use_zlib_path}" == x"/usr/lib"; then
310            AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen,
311                         libtrace_zlib=true,
312                         libtrace_zlib=false)
313    else
314        ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path"
315        # if it's not in /usr/lib/, check manually. This isn't nice
316        # and will probably break.
317        if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then
318                AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
319                AC_MSG_ERROR([Exiting]);
320        else
321                libtrace_zlib=true
322        fi
323    fi
324fi
325
326if test $libtrace_zlib = true; then
327        ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib"
328        AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support])
329else
330        AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support])   
331fi
332
333AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
334AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true])
335AM_CONDITIONAL([HAVE_CXX], [test "$libtrace_cxx" = true])
336AM_CONDITIONAL([LIBPACKETDUMP], [test "$libtrace_libpacketdump" = true])
337AM_CONDITIONAL([LIBTRACE_TOOLS], [test "$libtrace_tools" = true])
338AM_CONDITIONAL([LIBGDC], [test "$libtrace_gdc" = true])
339
340
341# Check for miscellaneous programs
342AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
343
344AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
345
346
347AC_SUBST([ADD_LIBS])
348AC_SUBST([ADD_LDFLAGS])
349AC_SUBST([ADD_INCLS])
350AC_SUBST([LTLIBOBJS])
351AC_SUBST([MANPAGES])
352
353dnl and finally, output our Makefiles
354AC_OUTPUT
355
356function reportopt() {
357        if test x"$2" = xtrue -o x"$2" = xyes; then
358                AC_MSG_NOTICE([$1: Yes])
359        else
360                AC_MSG_NOTICE([$1: No])
361        fi
362}
363
364reportopt "Compiled with BPF filter support" $libtrace_bpf
365reportopt "Compiled with PCAP support" $libtrace_pcap
366reportopt "Compiled with compressed trace (zlib) support" $libtrace_zlib
367reportopt "Compiled with DAG support (libdag)" $libtrace_dag
368reportopt "Compiled with DAG support (DAG 2.4)" $libtrace_dag2_4
369reportopt "Building man pages/documentation" $libtrace_doxygen
370reportopt "Building libpacketdump" $libtrace_libpacketdump
371reportopt "Building tools/ directory" $libtrace_tools
372
Note: See TracBrowser for help on using the repository browser.