source: configure.in @ 144fc8d

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

versioning attempts in Makefile.am etc
notes in Changelog

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