source: configure.in @ 22ce0d5

4.0.1-hotfixescachetimestampsdevelopdpdk-ndagetsilivegetfragoffhelplibtrace4ndag_formatpfringrc-4.0.1rc-4.0.2rc-4.0.3rc-4.0.4ringdecrementfixringperformanceringtimestampfixes
Last change on this file since 22ce0d5 was 22ce0d5, checked in by Perry Lorier <perry@…>, 14 years ago

AC_PROG_YACC vs AM_PROG_YACC

  • Property mode set to 100644
File size: 7.8 KB
Line 
1# Process this file with autoconf to produce a configure script.
2
3# Now you only need to update the version number in two places - below,
4# and in the README
5
6AC_INIT(libtrace,3.0.0-beta3,[contact@wand.net.nz],libtrace)
7
8LIBTRACE_MAJOR=3
9LIBTRACE_MID=0
10LIBTRACE_MINOR=0
11
12AC_CONFIG_SRCDIR(lib/trace.c)
13AM_INIT_AUTOMAKE
14
15AC_DEFINE([LIBTRACE_MAJOR],${LIBTRACE_MAJOR},[libtrace major version])
16AC_DEFINE([LIBTRACE_MID],${LIBTRACE_MID},[libtrace mid version])
17AC_DEFINE([LIBTRACE_MINOR],${LIBTRACE_MINOR},[libtrace minor version])
18
19AC_CONFIG_FILES([Makefile lib/Makefile docs/Makefile libpacketdump/Makefile
20        libpacketdump/parser/Makefile
21        tools/Makefile tools/traceanon/Makefile tools/tracedump/Makefile
22        tools/tracemerge/Makefile tools/tracereport/Makefile
23        tools/tracertstats/Makefile tools/tracesplit/Makefile
24        tools/tracestats/Makefile
25        docs/libtrace.doxygen
26        lib/libtrace.h
27        swig/Makefile])
28dnl GNU C library
29dnl AC_GNU_SOURCE
30
31
32AM_CONFIG_HEADER(config.h)
33#AC_CONFIG_HEADERS([config.h])
34dnl Checks for programs.
35AC_PROG_CC
36AC_PROG_CXX
37AC_PROG_INSTALL
38AC_PROG_LIBTOOL
39AC_PROG_YACC
40AM_PROG_LEX
41
42AC_CONFIG_LIBOBJ_DIR(lib)
43
44# Checks for typedefs, structures, and compiler characteristics.
45AC_C_CONST
46AC_C_INLINE
47AC_C_BIGENDIAN
48AC_TYPE_SIZE_T
49AC_HEADER_TIME
50AC_SYS_LARGEFILE
51
52AC_PROG_LIBTOOL
53
54
55AC_ARG_ENABLE(swig,
56[  --disable-swig               don't generate python bindings],
57lt_use_python=true,lt_use_python=false)
58
59if test "x$lt_use_python" = "xtrue"
60then
61        AM_PATH_PYTHON(2.3)
62        AC_PROG_SWIG(1.3.21)
63        SWIG_PYTHON
64fi
65
66# Checks for library functions.
67AC_PROG_GCC_TRADITIONAL
68AC_CHECK_FUNCS(socket strdup strlcpy)
69
70AC_CHECK_SIZEOF([long int])
71
72
73
74# Check for various broken functions
75AC_FUNC_MALLOC
76AC_FUNC_REALLOC
77
78# *BSD doesn't have strndup. Currently provide our own.
79AC_REPLACE_FUNCS(strndup)
80
81# Checks for header files.
82AC_HEADER_STDC
83dnl 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)
84AC_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 )
85
86AC_CHECK_HEADERS(netinet/in.h)
87AC_CHECK_HEADERS(netpacket/packet.h,[
88        libtrace_netpacket_packet_h=true
89        AC_DEFINE(HAVE_NETPACKET_PACKET_H,1,[has net])
90])
91AC_CHECK_HEADER(net/if.h,
92        AC_DEFINE(HAVE_NET_IF_H,1,[has net/if.h header]),,[
93 #include <sys/types.h>
94 #include <sys/socket.h>
95])
96
97AC_CHECK_HEADER(netinet/ether.h,
98        AC_DEFINE(HAVE_NETINET_ETHER_H,1,[has netinet/ether.h header]),,[
99 #include <sys/types.h>
100 #include <sys/socket.h>
101 #include <netinet/in.h>
102 #include <net/if.h>
103])
104
105AC_CHECK_HEADER(netinet/if_ether.h,
106        AC_DEFINE(HAVE_NETINET_IF_ETHER_H,1,[has netinet/if_ether.h]),,[
107 #include <sys/types.h>
108 #include <sys/socket.h>
109 #include <netinet/in.h>
110 #include <net/if.h>
111])
112
113AC_CHECK_HEADER(net/if_arp.h,
114        AC_DEFINE(HAVE_NET_IF_ARP_H,1,[has net/if_arp.h]),,[
115 #include <sys/types.h>
116 #include <sys/socket.h>
117 #include <netinet/in.h>
118 #include <net/if.h>
119])
120
121# Checking for the right bpf header to include
122AC_CHECK_HEADER(pcap-bpf.h)
123AC_CHECK_HEADER(net/bpf.h)
124AC_CHECK_HEADER(gdc.h)
125
126# Check to see if we have libdl - *BSD has built-in libdl
127AC_CHECK_LIB(dl, dlopen)
128# check pcap
129AC_CHECK_LIB(pcap,pcap_open_live)
130AC_REPLACE_FUNCS(pcap_open_dead)
131AC_REPLACE_FUNCS(pcap_dump_flush)
132AC_REPLACE_FUNCS(pcap_next_ex)
133AC_CHECK_FUNCS(pcap_inject pcap_sendpacket pcap_setnonblock)
134
135# configure time options for man pages
136AC_ARG_WITH(man,
137            AC_HELP_STRING([--with-man],
138                           [install man pages by default]),
139
140             if test "$withval" = yes
141             then
142                     MANPAGES="docs/man/man3/[a-zA-Z]*.3]"
143             else
144                     MANPAGES=""
145             fi
146)
147
148AC_PROG_CXX
149
150# configure time options for use of DAG cards
151# borrowed from libpcap!
152AC_ARG_WITH(dag,
153            AC_HELP_STRING([--with-dag[=DIR]],
154                           [include DAG support (located in directory DIR, if supplied)]),
155[
156        if test "$withval" = no
157        then
158                want_dag=no
159        elif test "$withval" = yes
160        then
161                want_dag=yes
162                dag_root=/root/dag
163        else
164                want_dag=yes
165                dag_root=$withval
166        fi
167],[
168        #
169        # Use DAG API if present, otherwise don't
170        #
171        want_dag=ifpresent
172        dag_root=/root/dag/
173])
174
175# turn the test part of the next block into a function, so it can be
176# called multiple times for $dag_root, /root/dag, /usr/local/lib
177libtrace_dag=false
178libtrace_dag2_4=false
179if test "$with_dag" != no; then
180        AC_MSG_CHECKING(whether we have DAG API)
181
182        if test -r "$dag_root/lib"; then
183                dag_lib_dir="$dag_root/lib"
184        else
185                dag_lib_dir="$dag_root"
186        fi
187       
188        if test -r "$dag_root/tools" -a -r "$dag_root/include"; then
189                dag_tools_dir="$dag_root/tools"
190                dag_include_dir="$dag_root/include"
191        else
192                dag_tools_dir="$dag_root"
193                dag_include_dir="$dag_root"
194        fi
195
196        if test -r "$dag_include_dir/dagapi.h" -a -r "$dag_lib_dir/libdag.a";
197        then
198                ADD_INCLS="$ADD_INCLS -I $dag_include_dir"
199                ADD_LIBS="$ADD_LIBS -ldag"
200                ADD_LDFLAGS="$ADD_LDFLAGS -L$dag_lib_dir"
201                DAG_TOOLS_DIR=$dag_tools_dir
202                AC_SUBST([DAG_TOOLS_DIR])
203                libtrace_dag=true
204               
205                AC_DEFINE(HAVE_DAG_API, 1, [define if you have a DAG API])
206                AC_DEFINE(HAVE_DAG,1,[conditional for building with DAG support])
207        else
208                if test "$want_dag" = yes; then
209                        AC_MSG_ERROR(DAG API not found under directory $dag_root
210; use --without-dag)
211                fi
212                libtrace_dag=false
213        fi
214        AC_MSG_RESULT($libtrace_dag)
215       
216        AC_MSG_CHECKING(if we are using DAG 2.4)
217        if grep '2.4.' $dag_root/VERSION > /dev/null 2>&1; then
218                libtrace_dag2_4=true
219                AC_DEFINE(DAG_VERSION_2_4, 1, [define if using DAG 2.4])
220        else
221                libtrace_dag2_4=false
222        fi
223        AC_MSG_RESULT($libtrace_dag2_4)
224fi
225
226AC_CHECK_LIB(z, gzopen)
227
228libtrace_swig=false;
229if test -n "$SWIG"; then
230        libtrace_swig=true;
231fi
232libtrace_python=false;
233if test -n "$PYTHON"; then
234        libtrace_python=true;
235fi
236
237AM_CONDITIONAL([HAVE_DAG], [test "$libtrace_dag" = true])
238AM_CONDITIONAL([DAG2_4], [test "$libtrace_dag2_4" = true])
239AM_CONDITIONAL([HAVE_ZLIB], [test "$ac_cv_lib_z_gzopen" = yes])
240AM_CONDITIONAL([HAVE_NETPACKET_PACKET_H], [test "$libtrace_netpacket_packet_h" = true])
241AM_CONDITIONAL([LIBGDC], [test "$ac_cv_header_gdc_h" = yes])
242AM_CONDITIONAL([LIBTRACE_SWIG], [test "$libtrace_swig" = true])
243#AM_CONDITIONAL([HAVE_PYTHON], [test "$libtrace_python" = true])
244
245# Check for miscellaneous programs
246AC_CHECK_PROG([libtrace_doxygen], [doxygen], [true], [false])
247
248AM_CONDITIONAL(HAS_DOXYGEN, [test x"$libtrace_doxygen" = xtrue])
249
250
251AC_SUBST([ADD_LIBS])
252AC_SUBST([ADD_LDFLAGS])
253AC_SUBST([ADD_INCLS])
254AC_SUBST([LTLIBOBJS])
255AC_SUBST([MANPAGES])
256AC_SUBST([PACKAGE_VERSION])
257AC_SUBST([LIBTRACE_MAJOR])
258AC_SUBST([LIBTRACE_MID])
259AC_SUBST([LIBTRACE_MINOR])
260
261dnl and finally, output our Makefiles
262AC_OUTPUT
263
264reportopt() {
265        if test x"$2" = xtrue -o x"$2" = xyes; then
266                AC_MSG_NOTICE([$1: Yes])
267        else
268                AC_MSG_NOTICE([$1: No])
269        fi
270}
271
272echo
273AC_MSG_NOTICE([Libtrace version $PACKAGE_VERSION])
274reportopt "Compiled with PCAP support" $ac_cv_lib_pcap_pcap_open_live
275reportopt "Compiled with compressed trace (zlib) support" $ac_cv_lib_z_gzopen
276if test x"$libtrace_dag" = xtrue; then
277        if test x"$libtrace_dag2_4"; then
278                AC_MSG_NOTICE([Compiled with DAG support: 2.4])
279        else
280                AC_MSG_NOTICE([Compiled with DAG support: 2.5])
281        fi
282else
283        AC_MSG_NOTICE([Compiled with DAG support: No])
284fi
285reportopt "Building man pages/documentation" $libtrace_doxygen
286
287if test x"$libtrace_swig" = xtrue; then
288        if test x"$libtrace_python" = xtrue; then
289                AC_MSG_NOTICE([Building swig bindings for: python])
290        else
291                AC_MSG_NOTICE([Building swig bindings for: Nothing])
292        fi
293else
294        AC_MSG_NOTICE([Not building swig bindings])
295fi
Note: See TracBrowser for help on using the repository browser.