source: configure.in @ edca0b8

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

added libpacketdump:

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