source: configure.in @ 4b30586

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

fixes for configure.in

  • Property mode set to 100644
File size: 7.6 KB
Line 
1# Process this file with autoconf to produce a configure script.
2AC_INIT(libtrace,2.0.16,[libtrace@wand.net.nz],libtrace)
3AC_CONFIG_SRCDIR(lib/trace.c)
4AM_INIT_AUTOMAKE(libtrace,2.0.16)
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# *BSD doesn't have strndup. Currently provide our own.
73AC_REPLACE_FUNCS(strndup)
74
75# Earlier versions of pcap don't have pcap_open_dead. EG: the one OpenBSD
76# ships with. Even Debian Woody is more up to date.
77AC_CHECK_LIB(pcap,pcap_open_dead,
78        have_pcap_open_dead=true,
79        have_pcap_open_dead=false)
80
81if test "$have_pcap_open_dead" = false; then
82        AC_REPLACE_FUNCS(pcap_open_dead)
83fi
84   
85
86# Checks for typedefs, structures, and compiler characteristics.
87AC_C_CONST
88AC_C_INLINE
89AC_C_BIGENDIAN
90AC_TYPE_SIZE_T
91AC_HEADER_TIME
92AC_SYS_LARGEFILE
93
94# Checks for library functions.
95AC_PROG_GCC_TRADITIONAL
96AC_CHECK_FUNCS(socket strdup)
97
98
99# configure time options for use of DAG cards
100# borrowed from libpcap!
101AC_ARG_WITH(dag,
102            AC_HELP_STRING([--with-dag[=DIR]],
103                           [include DAG support (located in directory DIR, if supplied)]),
104[
105        if test "$withval" = no
106        then
107                want_dag=no
108        elif test "$withval" = yes
109        then
110                want_dag=yes
111                dag_root=
112        else
113                want_dag=yes
114                dag_root=$withval
115        fi
116],[
117        #
118        # Use DAG API if present, otherwise don't
119        #
120        want_dag=ifpresent
121        dag_root=
122])
123
124ac_cv_lbl_dag_api=no
125if test "$with_dag" != no; then
126        AC_MSG_CHECKING(whether we have DAG API)
127
128        if test -z "$dag_root"; then
129                dag_root=$srcdir/../dag
130        fi
131
132        if test -r "$dag_root/lib"; then
133                dag_lib_dir="$dag_root/lib"
134        else
135                dag_lib_dir="$dag_root"
136        fi
137
138        if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
139                dag_tools_dir="$dag_root/tools"
140                dag_include_dir="$dag_root/include"
141        else
142                dag_tools_dir="$dag_root"
143                dag_include_dir="$dag_root"
144        fi
145
146        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
147        then
148                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
149                ADD_LIBS="$ADD_LIBS -ldag"
150                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
151                DAG_TOOLS_DIR=$dag_tools_dir
152                AC_SUBST([DAG_TOOLS_DIR])
153                ac_cv_lbl_dag_api=yes
154        else
155                ac_cv_lbl_dag_api=no
156        fi
157        AC_MSG_RESULT($ac_cv_lbl_dag_api)
158        if test $ac_cv_lbl_dag_api = no; then
159                if test "$want_dag" = yes; then
160                        AC_MSG_ERROR(DAG API not found under directory $dag_root
161; use --without-dag)
162                fi
163        else
164                AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
165                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support])
166        fi
167else
168        AC_DEFINE(HAVE_DAG,0,[conditional for building with DAG support])
169fi
170
171AM_CONDITIONAL(HAVE_DAG, test x$ac_cv_lbl_dag_api = xyes)
172
173
174# configure time options for selecting which libpcap and libz to use
175# this is provided to allow for systems whose default libraries don't support
176# large files - you can build your own and link using these options
177AC_ARG_WITH([pcap],
178    AC_HELP_STRING([--with-pcap],
179                                   [name of pcap library (default is pcap)]),
180        [ac_cv_use_pcap=$withval],
181    [ac_cv_use_pcap=pcap])
182
183
184AC_ARG_WITH([pcap-path],
185    AC_HELP_STRING([--with-pcap-path],
186                                   [location of pcap library (default is /usr/lib)]),
187        [ac_cv_use_pcap_path=$withval],
188    [ac_cv_use_pcap_path=/usr/lib])
189
190if test x"$ac_cv_use_pcap" != xno; then
191    ADD_LIBS="$ADD_LIBS  -l$ac_cv_use_pcap"
192   
193    pcap_lib_file="${ac_cv_use_pcap_path}/lib${ac_cv_use_pcap}.so"
194   
195    # if the library is in /usr/lib, then just use
196    # AC_CHECK_LIB.
197    if test x"${ac_cv_use_pcap_path}" != x"/usr/lib"; then
198            AC_CHECK_LIB(${ac_cv_use_pcap},pcap_open_live,
199                         have_libpcap=yes,
200                         have_libpcap=no)
201
202            if test x"${have_libpcap}" != xno; then
203                AC_MSG_NOTICE([Cannot find pcap library $pcap_lib_file.])
204                AC_MSG_ERROR([Exiting]);
205            fi
206    else
207        ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_pcap_path"
208        # if it's not in /usr/lib/, check manually. This isn't nice,
209        # and will probably break.
210        if test ! -r "$ac_cv_use_pcap_path" -o ! -r "$pcap_lib_file"; then
211                AC_MSG_NOTICE([Cannot find pcap library $pcap_lib_file.])
212                AC_MSG_ERROR([Exiting]);
213        fi 
214    fi
215    AC_DEFINE(HAVE_PCAP,1,[Conditional for building PCAP support])
216else
217    AC_DEFINE(HAVE_PCAP,0,[Conditional for building PCAP support])
218fi
219
220
221AC_ARG_WITH([zlib],
222    AC_HELP_STRING([--with-zlib],
223                               [name of zlib library (default is z)]),
224        [ac_cv_use_zlib=$withval],
225    [ac_cv_use_zlib=z])
226
227AC_ARG_WITH([zlib-path],
228    AC_HELP_STRING([--with-zlib-path],
229                   [location of zlib library (default is /usr/lib)]),
230    [ac_cv_use_zlib_path=$withval],
231    [ac_cv_use_zlib_path=/usr/lib])
232
233if test "$ac_cv_use_zlib" != no; then
234    ADD_LIBS="$ADD_LIBS -l$ac_cv_use_zlib"
235   
236    zlib_lib_file="${ac_cv_use_zlib_path}/lib${ac_cv_use_zlib}.so"
237
238    # if the library is in /usr/lib/, then just use AC_CHECK_LIB
239    if test x"${ac_cv_use_zlib_path}" != x"/usr/lib"; then
240            AC_CHECK_LIB(${ac_cv_use_zlib}, gzopen,
241                         have_libzlib=yes,
242                         have_libzlib=no)
243            if test x"{have_libzlib}" != xno; then
244                AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
245                AC_MSG_ERROR([Exiting]);
246            fi
247    else
248        ADD_LDFLAGS="$ADD_LDFLAGS -L$ac_cv_use_zlib_path"
249        # if it's not in /usr/lib/, check manually. This isn't nice
250        # and will probably break.
251        if test ! -r "$ac_cv_use_zlib_path" -o ! -r "$zlib_lib_file"; then
252                AC_MSG_NOTICE([Cannot find zlib library $zlib_lib_file.])
253                AC_MSG_ERROR([Exiting]);
254        fi
255    fi
256    AC_DEFINE(HAVE_ZLIB,1,[Conditional for building zlib support])
257else
258    AC_DEFINE(HAVE_ZLIB,0,[Conditional for building zlib support])   
259fi
260
261
262
263AC_SUBST([ADD_LIBS])
264AC_SUBST([ADD_LDFLAGS])
265AC_SUBST([ADD_INCLS])
266
267dnl and finally, output our Makefiles
268AC_OUTPUT
Note: See TracBrowser for help on using the repository browser.