source: configure.in @ f6879f3

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since f6879f3 was f6879f3, checked in by Shane Alcock <salcock@…>, 16 years ago

Fixed dag2.4 related code borrowing so that it actually works

  • Property mode set to 100644
File size: 8.8 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 dagapi.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
102# Checks for typedefs, structures, and compiler characteristics.
103AC_C_CONST
104AC_C_INLINE
105AC_C_BIGENDIAN
106AC_TYPE_SIZE_T
107AC_HEADER_TIME
108AC_SYS_LARGEFILE
109
110# Checks for library functions.
111AC_PROG_GCC_TRADITIONAL
112AC_CHECK_FUNCS(socket strdup)
113
114# configure time options for man pages
115AC_ARG_WITH(man,
116            AC_HELP_STRING([--with-man],
117                           [install man pages by default]),
118
119             if test "$withval" = yes
120             then
121                     MANPAGES="docs/man/man3/[a-zA-Z]*.3]"
122             else
123                     MANPAGES=""
124             fi
125)
126
127# configure time options for use of DAG cards
128# borrowed from libpcap!
129AC_ARG_WITH(dag,
130            AC_HELP_STRING([--with-dag[=DIR]],
131                           [include DAG support (located in directory DIR, if supplied)]),
132[
133        if test "$withval" = no
134        then
135                want_dag=no
136        elif test "$withval" = yes
137        then
138                want_dag=yes
139                dag_root=
140        else
141                want_dag=yes
142                dag_root=$withval
143        fi
144],[
145        #
146        # Use DAG API if present, otherwise don't
147        #
148        want_dag=ifpresent
149        dag_root=
150])
151
152ac_cv_lbl_dag_api=no
153dag2_4=false
154if test "$with_dag" != no; then
155        AC_MSG_CHECKING(whether we have DAG API)
156
157        if test -z "$dag_root"; then
158                dag_root=$srcdir/../dag
159        fi
160
161        if test -r "$dag_root/lib"; then
162                dag_lib_dir="$dag_root/lib"
163        else
164                dag_lib_dir="$dag_root"
165        fi
166
167        if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
168                dag_tools_dir="$dag_root/tools"
169                dag_include_dir="$dag_root/include"
170        else
171                dag_tools_dir="$dag_root"
172                dag_include_dir="$dag_root"
173        fi
174
175        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
176        then
177                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
178                ADD_LIBS="$ADD_LIBS -ldag"
179                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
180                DAG_TOOLS_DIR=$dag_tools_dir
181                AC_SUBST([DAG_TOOLS_DIR])
182                ac_cv_lbl_dag_api=yes
183                if test -r "$dag_lib_dir/libdag.so"; then
184                        dag2_4=false
185                else
186                        cp $dag_root/tools/dagopts.c lib/dagopts.c
187                        cp $dag_root/tools/dagapi.c lib/dagapi.c
188                        dag2_4=true
189                fi
190        else
191                ac_cv_lbl_dag_api=no
192        fi
193        AC_MSG_RESULT($ac_cv_lbl_dag_api)
194        if test $ac_cv_lbl_dag_api = no; then
195                if test "$want_dag" = yes; then
196                        AC_MSG_ERROR(DAG API not found under directory $dag_root
197; use --without-dag)
198                fi
199        else
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        fi
203else
204        AC_DEFINE(HAVE_DAG,0,[conditional for building with DAG support])
205fi
206
207AM_CONDITIONAL(HAVE_DAG, test x$ac_cv_lbl_dag_api = xyes)
208AM_CONDITIONAL(DAG2_4, test x$dag2_4 = xtrue)
209
210# The following is commented out because it seems you don't actually
211# need it. libpcap 'just works' with large files, even under woody,
212# although you probably need _FILE_OFFSET_BITS and LARGEFILE etc set
213# properly - libtrace handles this however.
214## configure time options for selecting which libpcap and libz to use
215## this is provided to allow for systems whose default libraries don't support
216## large files - you can build your own and link using these options
217#AC_ARG_WITH([pcap],
218#    AC_HELP_STRING([--with-pcap],
219#                                  [name of pcap library (default is pcap)]),
220#       [ac_cv_use_pcap=$withval],
221#    [ac_cv_use_pcap=pcap])
222#
223#
224#AC_ARG_WITH([pcap-path],
225#    AC_HELP_STRING([--with-pcap-path],
226#                                  [location of pcap library (default is /usr/lib)]),
227#       [ac_cv_use_pcap_path=$withval],
228#    [ac_cv_use_pcap_path=/usr/lib])
229#
230#if test x"$ac_cv_use_pcap" != xno; then
231#    ADD_LIBS="$ADD_LIBS  -l$ac_cv_use_pcap"
232#   
233#    pcap_lib_file="${ac_cv_use_pcap_path}/lib${ac_cv_use_pcap}.so"
234#   
235#    # if the library is in /usr/lib, then just use
236#    # AC_CHECK_LIB.
237#    if test x"${ac_cv_use_pcap_path}" == x"/usr/lib"; then
238#           AC_CHECK_LIB(${ac_cv_use_pcap},pcap_open_live,
239#                        have_libpcap=yes,
240#                        have_libpcap=no)
241#
242#           if test x"${have_libpcap}" == xno; then
243#               AC_MSG_NOTICE([Cannot find pcap library $pcap_lib_file.])
244#               AC_MSG_ERROR([Exiting]);
245#           fi
246#    else
247#       ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_pcap_path"
248#       # if it's not in /usr/lib/, check manually. This isn't nice,
249#       # and will probably break.
250#       if test ! -r "$ac_cv_use_pcap_path" -o ! -r "$pcap_lib_file"; then
251#               AC_MSG_NOTICE([Cannot find pcap library $pcap_lib_file.])
252#               AC_MSG_ERROR([Exiting]);
253#       fi 
254#    fi
255#    AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support])
256#else
257#    AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support])
258#fi
259
260
261AC_ARG_WITH([zlib],
262    AC_HELP_STRING([--with-zlib],
263                               [name of zlib library (default is z)]),
264        [ac_cv_use_zlib=$withval],
265    [ac_cv_use_zlib=z])
266
267AC_ARG_WITH([zlib-path],
268    AC_HELP_STRING([--with-zlib-path],
269                   [location of zlib library (default is /usr/lib)]),
270    [ac_cv_use_zlib_path=$withval],
271    [ac_cv_use_zlib_path=/usr/lib])
272
273if test "$ac_cv_use_zlib" != no; then
274    ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib"
275   
276    zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so"
277
278    # if the library is in /usr/lib/, then just use AC_CHECK_LIB
279    if test x"${ac_cv_use_zlib_path}" == x"/usr/lib"; then
280            AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen,
281                         have_libzlib=yes,
282                         have_libzlib=no)
283            if test x"{have_libzlib}" == xno; then
284                AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
285                AC_MSG_ERROR([Exiting]);
286            fi
287    else
288        ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path"
289        # if it's not in /usr/lib/, check manually. This isn't nice
290        # and will probably break.
291        if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then
292                AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
293                AC_MSG_ERROR([Exiting]);
294        fi
295    fi
296    AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support])
297else
298    AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support])   
299fi
300
301
302
303AC_SUBST([ADD_LIBS])
304AC_SUBST([ADD_LDFLAGS])
305AC_SUBST([ADD_INCLS])
306AC_SUBST([LTLIBOBJS])
307AC_SUBST([MANPAGES])
308
309dnl and finally, output our Makefiles
310AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.