When initializing a capture filter, assign a pointer to an empty string
[obnox/wireshark/wip.git] / configure.in
1 # $Id: configure.in,v 1.69 1999/12/28 09:04:26 guy Exp $
2 dnl
3 dnl Process this file with autoconf 2.13 or later to produce a
4 dnl configure script; 2.12 doesn't generate a "configure" script that
5 dnl defines SHELL, and "Makefile.in" has
6 dnl
7 dnl     SHELL = @SHELL@
8 dnl
9 dnl which requires it to be defined - and there may be other problems
10 dnl with pre-2.13 "autoconf" as well.
11 dnl
12 AC_INIT(etypes.h)
13
14 AC_PREREQ(2.13)
15
16 AM_INIT_AUTOMAKE(ethereal, 0.8.0)
17
18 dnl Check for CPU / vendor / OS
19 AC_CANONICAL_HOST
20
21 dnl Checks for programs.
22 AC_PROG_CC
23 AC_PROG_CPP
24 AC_PROG_RANLIB
25 AC_PROG_YACC
26 AM_PROG_LEX
27 AC_PATH_PROG(PERL_PATH, perl)
28 AC_PATH_PROG(LEX, flex)
29
30 AC_SUBST(PERL_PATH)
31 AC_SUBST(FLEX_PATH)
32
33
34 # If we're running gcc, add '-Wall' to CFLAGS.
35 AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS)
36 if test x$GCC != x ; then
37   CFLAGS="-Wall $CFLAGS"
38   AC_MSG_RESULT(yes)
39 else
40   AC_MSG_RESULT(no)
41 fi
42
43 #
44 # Arrange that we search for header files in the source directory
45 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
46 # as various packages we use ("libpcap", "zlib", an SNMP library)
47 # may have been installed under "/usr/local/include".
48 #
49 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I/usr/local/include"
50 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I/usr/local/include"
51
52 #
53 # Arrange that we search for libraries in "/usr/local/lib", and set
54 # a "-R" flag as appropriate.
55 #
56 # XXX - IRIX, and other OSes, may require some flag equivalent to
57 # "-R" here.
58 #
59 LIBS="$LIBS -L/usr/local/lib"
60 case "$host_os" in
61   solaris*)
62     LIBS="$LIBS -R/usr/local/lib"
63   ;;
64 esac
65
66 # Create DATAFILE_DIR #define for config.h
67 DATAFILE_DIR=$sysconfdir
68 DATAFILE_DIR=`(
69     test "x$prefix" = xNONE && prefix=$ac_default_prefix
70     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
71     eval echo "$DATAFILE_DIR"
72 )`
73 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
74 AC_SUBST(DATAFILE_DIR)
75
76 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
77 # link directory.
78 case "$host_os" in
79   solaris*)
80     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
81     if test x$LD_LIBRARY_PATH != x ; then
82       LIBS="$LIBS -R$LD_LIBRARY_PATH"
83       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
84     else
85       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
86     fi
87   ;;
88 esac
89
90 # GTK checks
91 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS",
92                    AC_MSG_ERROR(GTK+ distribution not found.))
93
94 dnl pcap check
95 AC_ARG_ENABLE(pcap,
96 [  --enable-pcap           use libpcap for packet capturing.  [default=yes]],,enable_pcap=yes)
97
98 AC_MSG_CHECKING(whether to use libpcap for packet capture)
99 if test "x$enable_pcap" = "xno" ; then
100         AC_MSG_RESULT(no)
101 else
102         AC_MSG_RESULT(yes)
103         AC_ETHEREAL_PCAP_CHECK
104 fi
105
106 dnl zlib check
107 AC_ARG_ENABLE(zlib,
108 [  --enable-zlib           use zlib to read compressed data.  [default=yes]],, [dnl
109 case "$host_os" in
110 netbsd*)        enable_zlib=no;;
111 *)              enable_zlib=yes;;
112 esac])
113
114 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
115 if test "x$enable_zlib" = "xno" ; then
116         AC_MSG_RESULT(no)
117 else
118         AC_MSG_RESULT(yes)
119         AC_ETHEREAL_ZLIB_CHECK
120         if test "x$enable_zlib" = "xno" ; then
121                 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
122         fi
123 fi
124
125
126 dnl ipv6 check
127 AC_ARG_ENABLE(ipv6,
128 [  --enable-ipv6           use ipv6 name resolution, if available.  [default=yes]],,enable_ipv6=yes)
129
130 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
131 if test "x$enable_ipv6" = "xno" ; then
132         AC_MSG_RESULT(no)
133 else
134         AC_MSG_RESULT(yes)
135         AC_ETHEREAL_IPV6_STACK
136 fi
137
138
139 dnl Checks for header files.
140 AC_HEADER_STDC
141 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
142 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h netinet/in.h sys/socket.h net/if.h)
143 AC_CHECK_HEADERS(sys/wait.h)
144 AC_CHECK_HEADERS(stddef.h)
145 AC_CHECK_HEADERS(dlfcn.h)
146
147 dnl SNMP Check
148 AC_ARG_ENABLE(snmp,
149 [  --enable-snmp           use SNMP library, if available.  [default=yes]],,enable_snmp=yes)
150
151 SNMP_A=''
152 AC_MSG_CHECKING(whether to use SNMP library if available)
153 if test "x$enable_snmp" = "xno" ; then
154         AC_MSG_RESULT(no)
155 else
156         AC_MSG_RESULT(yes)
157         AC_ETHEREAL_UCDSNMP_CHECK
158         AC_CHECK_HEADERS(ucd-snmp/snmp.h ucd-snmp/version.h snmp/snmp.h snmp/version.h)
159         AC_CHECK_LIB(snmp, sprint_objid,
160                 [
161                 SNMP_A=-lsnmp
162                 ], )
163 fi
164 AC_SUBST(SNMP_A)
165
166 dnl Checks for typedefs, structures, and compiler characteristics.
167 # AC_C_CONST
168
169 # We need to know whether "struct sockaddr" has an "sa_len" member
170 # for get_interface_list().
171
172 AC_ETHEREAL_STRUCT_SA_LEN
173
174 # We must know our byte order
175 AC_C_BIGENDIAN
176
177 dnl Checks for library functions.
178 AC_PROG_GCC_TRADITIONAL
179 AC_CHECK_FUNC(socket,, AC_MSG_ERROR(Function 'socket' not found.))
180
181 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
182 # then this won't work.
183 SNPRINTF_C=""
184 SNPRINTF_O=""
185 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
186   SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
187 if test "$ac_cv_func_snprintf" = no ; then
188   SNPRINTF_C="snprintf.c"
189   SNPRINTF_O="snprintf.o"
190 fi
191 AC_SUBST(SNPRINTF_C)
192 AC_SUBST(SNPRINTF_O)
193
194 AC_CHECK_FUNC(strerror, STRERROR_O="",
195   STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
196 if test "$ac_cv_func_strerror" = no ; then
197   STRERROR_C="strerror.c"
198   STRERROR_O="strerror.o"
199 fi
200 AC_SUBST(STRERROR_C)
201 AC_SUBST(STRERROR_O)
202
203 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
204   STRNCASECMP_O="strncasecmp.o")
205 if test "$ac_cv_func_strncasecmp" = no ; then
206   STRNCASECMP_C="strncasecmp.c"
207   STRNCASECMP_O="strncasecmp.o"
208 fi
209 AC_SUBST(STRNCASECMP_C)
210 AC_SUBST(STRNCASECMP_O)
211
212 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
213   MKSTEMP_O="mkstemp.o")
214 if test "$ac_cv_func_mkstemp" = no ; then
215   MKSTEMP_C="mkstemp.c"
216   MKSTEMP_O="mkstemp.o"
217 fi
218 AC_SUBST(MKSTEMP_C)
219 AC_SUBST(MKSTEMP_O)
220
221 AC_CHECK_FUNC(inet_aton, INET_ATON_O="",
222   INET_ATON_O="inet_aton.o")
223 if test "$ac_cv_func_inet_aton" = no ; then
224   INET_ATON_C="inet_aton.c"
225   INET_ATON_O="inet_aton.o"
226 fi
227 AC_SUBST(INET_ATON_C)
228 AC_SUBST(INET_ATON_O)
229
230 AC_CHECK_FUNC(inet_pton, [
231   dnl check for pre-BIND82 inet_pton() bug.
232   AC_MSG_CHECKING(for broken inet_pton)
233   AC_TRY_RUN([#include <sys/types.h>
234 #include <sys/socket.h>
235 #include <netinet/in.h>
236 #include <arpa/inet.h>
237 int main()
238 {
239 #ifdef AF_INET6
240   char buf[16];
241   /* this should return 0 (error) */
242   return inet_pton(AF_INET6, "0:1:2:3:4:5:6:7:", buf);
243 #else
244   return 1;
245 #endif
246 }], [AC_MSG_RESULT(ok);
247 have_inet_pton=yes], [AC_MSG_RESULT(broken);
248 have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
249 have_inet_pton=no])],
250 have_inet_pton=no)
251 if test "$have_inet_pton" = no; then
252   INET_PTON_C="inet_pton.c"
253   INET_PTON_O="inet_pton.o"
254 else
255   INET_PTON_C=""
256   INET_PTON_O=""
257 fi
258 AC_SUBST(INET_PTON_C)
259 AC_SUBST(INET_PTON_O)
260
261 AC_CHECK_FUNC(inet_ntop, INET_NTOP_O="",
262   INET_NTOP_O="inet_ntop.o")
263 if test "$ac_cv_func_inet_ntop" = no ; then
264   INET_NTOP_C="inet_ntop.c"
265   INET_NTOP_O="inet_ntop.o"
266   AC_DEFINE(NEED_INET_V6DEFS_H)
267 fi
268 AC_SUBST(INET_NTOP_C)
269 AC_SUBST(INET_NTOP_O)
270
271 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
272
273 dnl blank for now, but will be used in future
274 AC_SUBST(ethereal_SUBDIRS)
275
276 dnl check for plugins directory - stolen from Amanda's configure.in
277 AC_ARG_WITH(plugindir,
278   [  --with-plugindir=DIR   install plugins in DIR],
279   [
280   case "$withval" in
281   "" | y | ye | yes | n | no)
282     AC_MSG_ERROR([*** You must supply an argument to the --with-plugindir option.])
283   ;;
284   *) PLUGIN_DIR="$withval"
285   esac
286   ],
287   : ${PLUGIN_DIR=$libdir/ethereal/plugins/0.8}
288 )
289
290 PLUGIN_DIR=`(
291   test "x$prefix" = xNONE && prefix=$ac_default_prefix
292   test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
293   eval echo "$PLUGIN_DIR"
294 )`
295 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
296 AC_SUBST(PLUGIN_DIR)
297
298 dnl libtool defs
299 AC_LIBLTDL_CONVENIENCE(libltdl)
300 AC_LIBTOOL_DLOPEN
301 AM_PROG_LIBTOOL
302 AC_SUBST(LIBLTDL)
303 AC_SUBST(LIBTOOL_DEPS)
304
305 AM_CONFIG_HEADER(config.h)
306 AC_CONFIG_SUBDIRS(wiretap libltdl)
307 AC_OUTPUT(
308   Makefile
309   ethereal.spec
310   doc/Makefile
311   doc/dfilter2pod
312   gtk/Makefile
313   plugins/Makefile
314   plugins/gryphon/Makefile,
315         [chmod +x doc/dfilter2pod])