source: configure.in @ 5c88a60

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

added replacement function for pcap_dump_flush

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