source: configure.in @ df6ae1f

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

During configuration / compilation libtrace will borrow the dagapi code if the user is compiling against dag2.4 libraries.

  • 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
153if test "$with_dag" != no; then
154        AC_MSG_CHECKING(whether we have DAG API)
155
156        if test -z "$dag_root"; then
157                dag_root=$srcdir/../dag
158        fi
159
160        if test -r "$dag_root/lib"; then
161                dag_lib_dir="$dag_root/lib"
162        else
163                dag_lib_dir="$dag_root"
164        fi
165
166        if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
167                dag_tools_dir="$dag_root/tools"
168                dag_include_dir="$dag_root/include"
169        else
170                dag_tools_dir="$dag_root"
171                dag_include_dir="$dag_root"
172        fi
173
174        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
175        then
176                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
177                ADD_LIBS="$ADD_LIBS -ldag"
178                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
179                DAG_TOOLS_DIR=$dag_tools_dir
180                AC_SUBST([DAG_TOOLS_DIR])
181                ac_cv_lbl_dag_api=yes
182                if test -r "$dag_lib_dir/libdag.so"; then
183                        dag2_4=false
184                else
185                        cp $dag_root/tools/dagopts.c lib/dagopts.c
186                        cp $dag_root/tools/dagapi.c lib/dagapi.c
187                        dag2_4=true
188                fi
189                AM_CONDITIONAL(DAG2_4, test x$dag2_4=xtrue)
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)
208
209# The following is commented out because it seems you don't actually
210# need it. libpcap 'just works' with large files, even under woody,
211# although you probably need _FILE_OFFSET_BITS and LARGEFILE etc set
212# properly - libtrace handles this however.
213## configure time options for selecting which libpcap and libz to use
214## this is provided to allow for systems whose default libraries don't support
215## large files - you can build your own and link using these options
216#AC_ARG_WITH([pcap],
217#    AC_HELP_STRING([--with-pcap],
218#                                  [name of pcap library (default is pcap)]),
219#       [ac_cv_use_pcap=$withval],
220#    [ac_cv_use_pcap=pcap])
221#
222#
223#AC_ARG_WITH([pcap-path],
224#    AC_HELP_STRING([--with-pcap-path],
225#                                  [location of pcap library (default is /usr/lib)]),
226#       [ac_cv_use_pcap_path=$withval],
227#    [ac_cv_use_pcap_path=/usr/lib])
228#
229#if test x"$ac_cv_use_pcap" != xno; then
230#    ADD_LIBS="$ADD_LIBS  -l$ac_cv_use_pcap"
231#   
232#    pcap_lib_file="${ac_cv_use_pcap_path}/lib${ac_cv_use_pcap}.so"
233#   
234#    # if the library is in /usr/lib, then just use
235#    # AC_CHECK_LIB.
236#    if test x"${ac_cv_use_pcap_path}" == x"/usr/lib"; then
237#           AC_CHECK_LIB(${ac_cv_use_pcap},pcap_open_live,
238#                        have_libpcap=yes,
239#                        have_libpcap=no)
240#
241#           if test x"${have_libpcap}" == xno; then
242#               AC_MSG_NOTICE([Cannot find pcap library $pcap_lib_file.])
243#               AC_MSG_ERROR([Exiting]);
244#           fi
245#    else
246#       ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_pcap_path"
247#       # if it's not in /usr/lib/, check manually. This isn't nice,
248#       # and will probably break.
249#       if test ! -r "$ac_cv_use_pcap_path" -o ! -r "$pcap_lib_file"; then
250#               AC_MSG_NOTICE([Cannot find pcap library $pcap_lib_file.])
251#               AC_MSG_ERROR([Exiting]);
252#       fi 
253#    fi
254#    AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support])
255#else
256#    AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support])
257#fi
258
259
260AC_ARG_WITH([zlib],
261    AC_HELP_STRING([--with-zlib],
262                               [name of zlib library (default is z)]),
263        [ac_cv_use_zlib=$withval],
264    [ac_cv_use_zlib=z])
265
266AC_ARG_WITH([zlib-path],
267    AC_HELP_STRING([--with-zlib-path],
268                   [location of zlib library (default is /usr/lib)]),
269    [ac_cv_use_zlib_path=$withval],
270    [ac_cv_use_zlib_path=/usr/lib])
271
272if test "$ac_cv_use_zlib" != no; then
273    ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib"
274   
275    zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so"
276
277    # if the library is in /usr/lib/, then just use AC_CHECK_LIB
278    if test x"${ac_cv_use_zlib_path}" == x"/usr/lib"; then
279            AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen,
280                         have_libzlib=yes,
281                         have_libzlib=no)
282            if test x"{have_libzlib}" == xno; then
283                AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
284                AC_MSG_ERROR([Exiting]);
285            fi
286    else
287        ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path"
288        # if it's not in /usr/lib/, check manually. This isn't nice
289        # and will probably break.
290        if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then
291                AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
292                AC_MSG_ERROR([Exiting]);
293        fi
294    fi
295    AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support])
296else
297    AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support])   
298fi
299
300
301
302AC_SUBST([ADD_LIBS])
303AC_SUBST([ADD_LDFLAGS])
304AC_SUBST([ADD_INCLS])
305AC_SUBST([LTLIBOBJS])
306AC_SUBST([MANPAGES])
307
308dnl and finally, output our Makefiles
309AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.