source: configure.in @ a3505a8

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

removing old original Makefiles
adding Makefile.am in appropriate directories

modifying changelog, readme.

adding AC_PROG_CXX to configure.in
updated configure.in and tools/Makefile.am for the tools
fixed a bug in libpacketdump/Makefile.am

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