source: configure.in @ 7050c10

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

updated new backend - libtrace_erf, libtrace_pcap all work

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