Move to version 0.8.4.
[obnox/wireshark/wip.git] / configure.in
1 # $Id: configure.in,v 1.84 2000/03/03 03:53:08 gram 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.4)
17
18 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
19
20 dnl Check for CPU / vendor / OS
21 AC_CANONICAL_HOST
22
23 dnl Checks for programs.
24 AC_PROG_CC
25 AC_PROG_CPP
26 AC_PROG_RANLIB
27 AC_PROG_YACC
28 AM_PROG_LEX
29 AC_PATH_PROG(PERL_PATH, perl)
30 AC_PATH_PROG(LEX, flex)
31
32 AC_SUBST(PERL_PATH)
33 AC_SUBST(FLEX_PATH)
34
35
36 # If we're running gcc, add '-Wall' to CFLAGS.
37 AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS)
38 if test x$GCC != x ; then
39   CFLAGS="-Wall $CFLAGS"
40   AC_MSG_RESULT(yes)
41 else
42   AC_MSG_RESULT(no)
43 fi
44
45 #
46 # Add any platform-specific compiler flags needed.
47 #
48 AC_MSG_CHECKING(for platform-specific compiler flags)
49 if test "x$GCC" = x
50 then
51         #
52         # Not GCC - assume it's the vendor's compiler.
53         #
54         case "$host_os" in
55         hpux*)
56                 #
57                 # HP's ANSI C compiler; flags suggested by Jost Martin.
58                 # "-Aa" for ANSI C
59                 # "-Ae" for extensions to ANSI, for "long long".
60                 # "+O2", for optimization.  XXX - works with "-g"?
61                 #
62                 CFLAGS="-Aa -Ae +O2 $CFLAGS"
63                 AC_MSG_RESULT(HP ANSI C compiler - added -Aa -Ae +O2)
64                 ;;
65         *)
66                 AC_MSG_RESULT(none needed)
67                 ;;
68         esac
69 else
70         AC_MSG_RESULT(none needed)
71 fi
72
73 #
74 # Arrange that we search for header files in the source directory
75 # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
76 # as various packages we use ("libpcap", "zlib", an SNMP library)
77 # may have been installed under "/usr/local/include".
78 #
79 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I/usr/local/include"
80 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap -I/usr/local/include"
81
82 #
83 # Arrange that we search for libraries in "/usr/local/lib".
84 #
85 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
86
87 # Create DATAFILE_DIR #define for config.h
88 DATAFILE_DIR=$sysconfdir
89 DATAFILE_DIR=`(
90     test "x$prefix" = xNONE && prefix=$ac_default_prefix
91     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
92     eval echo "$DATAFILE_DIR"
93 )`
94 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
95 AC_SUBST(DATAFILE_DIR)
96
97 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
98 # link directory.
99 case "$host_os" in
100   solaris*)
101     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
102     if test x$LD_LIBRARY_PATH != x ; then
103       LIBS="$LIBS -R$LD_LIBRARY_PATH"
104       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
105     else
106       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
107     fi
108   ;;
109 esac
110
111 # GLib checks
112 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
113 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
114 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
115 # set when generating the Makefile, so we can make programs that require
116 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
117 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
118 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
119 # programs to be built with GLib.
120 #
121 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
122
123 # GTK checks
124 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
125 # programs to be built with GTK+.
126 #
127 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS",
128                    AC_MSG_ERROR(GTK+ distribution not found.))
129
130 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
131 dnl "gethostbyname()".
132 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
133
134 dnl Checks for "connect()", used as a proxy for "socket()" - and
135 dnl "-lsocket", if we need it to get "connect()".
136 AC_ETHEREAL_SOCKET_LIB_CHECK
137
138 dnl pcap check
139 AC_ARG_ENABLE(pcap,
140 [  --enable-pcap           use libpcap for packet capturing.  [default=yes]],,enable_pcap=yes)
141
142 AC_MSG_CHECKING(whether to use libpcap for packet capture)
143 if test "x$enable_pcap" = "xno" ; then
144         AC_MSG_RESULT(no)
145 else
146         AC_MSG_RESULT(yes)
147         AC_ETHEREAL_PCAP_CHECK
148 fi
149
150 dnl zlib check
151 AC_ARG_ENABLE(zlib,
152 [  --enable-zlib           use zlib to read compressed data.  [default=yes]],,enable_zlib=yes)
153
154 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
155 if test "x$enable_zlib" = "xno" ; then
156         AC_MSG_RESULT(no)
157 else
158         AC_MSG_RESULT(yes)
159         AC_ETHEREAL_ZLIB_CHECK
160         if test "x$enable_zlib" = "xno" ; then
161                 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
162         fi
163 fi
164
165
166 dnl ipv6 check
167 AC_ARG_ENABLE(ipv6,
168 [  --enable-ipv6           use ipv6 name resolution, if available.  [default=yes]],,enable_ipv6=yes)
169
170 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
171 if test "x$enable_ipv6" = "xno" ; then
172         AC_MSG_RESULT(no)
173 else
174         AC_MSG_RESULT(yes)
175         AC_ETHEREAL_IPV6_STACK
176 fi
177
178
179 dnl Check if ethereal should be installed setuid
180 AC_ARG_ENABLE(setuid-install,
181 [  --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
182
183 AC_MSG_CHECKING(whether to install ethereal setuid)
184 if test "x$enable_setuid_install" = "xno" ; then
185         AC_MSG_RESULT(no)
186 else
187         AC_MSG_RESULT(yes)
188 fi
189
190 dnl Checks for header files.
191 AC_HEADER_STDC
192 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h dirent.h)
193 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
194 AC_CHECK_HEADERS(sys/wait.h sys/param.h)
195 AC_CHECK_HEADERS(netinet/in.h net/if.h)
196 AC_CHECK_HEADERS(stddef.h)
197 AC_CHECK_HEADERS(dlfcn.h)
198 AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h)
199
200 dnl SNMP Check
201 AC_ARG_ENABLE(snmp,
202 [  --enable-snmp           use SNMP library, if available.  [default=yes]],,enable_snmp=yes)
203
204 SNMP_LIBS=''
205 AC_MSG_CHECKING(whether to use SNMP library if available)
206 if test "x$enable_snmp" = "xno" ; then
207         AC_MSG_RESULT(no)
208 else
209         AC_MSG_RESULT(yes)
210         AC_ETHEREAL_UCDSNMP_CHECK
211         AC_CHECK_HEADERS(ucd-snmp/snmp.h ucd-snmp/version.h snmp/snmp.h snmp/version.h)
212
213         #
214         # This may require "-lkstat" on Solaris, sigh.
215         #
216         AC_CHECK_LIB(snmp, sprint_objid,
217           SNMP_LIBS=-lsnmp,
218           [
219             #
220             # Throw away the cached "we didn't find it" answer.
221             #
222             unset ac_cv_lib_snmp_sprint_objid
223             AC_CHECK_LIB(snmp, sprint_objid,
224               [
225                 #
226                 # Throw away the cached "we found it" answer, so that if
227                 # we rerun "configure", we don't just blow off this check
228                 # and blithely assume that we don't need "-lkstat".
229                 #
230                 # XXX - autoconf really needs a way to test for a given
231                 # routine in a given library *and* to test whether additional
232                 # "-L"/"-R"/whatever flags are needed *before* the "-l"
233                 # flag for the library and to test whether additional libraries
234                 # are needed after the library *and* to cache all that
235                 # information.
236                 #
237                 unset ac_cv_lib_snmp_sprint_objid
238                 SNMP_LIBS="-lsnmp -lkstat"
239               ],,$SOCKET_LIBS $NSL_LIBS -lkstat
240             )
241           ], $SOCKET_LIBS $NSL_LIBS
242         )
243         
244 fi
245 AC_SUBST(SNMP_LIBS)
246
247 dnl Checks for typedefs, structures, and compiler characteristics.
248 # AC_C_CONST
249
250 # We need to know whether "struct sockaddr" has an "sa_len" member
251 # for get_interface_list().
252
253 AC_ETHEREAL_STRUCT_SA_LEN
254
255 # We must know our byte order
256 AC_C_BIGENDIAN
257
258 # Checks whether "-traditional" is needed when using "ioctl".
259 # XXX - do we need this?
260 AC_PROG_GCC_TRADITIONAL
261
262 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
263 # then this won't work.
264 SNPRINTF_C=""
265 SNPRINTF_O=""
266 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
267   SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
268 if test "$ac_cv_func_snprintf" = no ; then
269   SNPRINTF_C="snprintf.c"
270   SNPRINTF_O="snprintf.o"
271 fi
272 AC_SUBST(SNPRINTF_C)
273 AC_SUBST(SNPRINTF_O)
274
275 AC_CHECK_FUNC(strerror, STRERROR_O="",
276   STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
277 if test "$ac_cv_func_strerror" = no ; then
278   STRERROR_C="strerror.c"
279   STRERROR_O="strerror.o"
280 fi
281 AC_SUBST(STRERROR_C)
282 AC_SUBST(STRERROR_O)
283
284 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
285   STRNCASECMP_O="strncasecmp.o")
286 if test "$ac_cv_func_strncasecmp" = no ; then
287   STRNCASECMP_C="strncasecmp.c"
288   STRNCASECMP_O="strncasecmp.o"
289 fi
290 AC_SUBST(STRNCASECMP_C)
291 AC_SUBST(STRNCASECMP_O)
292
293 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
294   MKSTEMP_O="mkstemp.o")
295 if test "$ac_cv_func_mkstemp" = no ; then
296   MKSTEMP_C="mkstemp.c"
297   MKSTEMP_O="mkstemp.o"
298   AC_DEFINE(NEED_MKSTEMP)
299 fi
300 AC_SUBST(MKSTEMP_C)
301 AC_SUBST(MKSTEMP_O)
302
303 AC_CHECK_FUNC(inet_aton, INET_ATON_O="",
304   INET_ATON_O="inet_aton.o")
305 if test "$ac_cv_func_inet_aton" = no ; then
306   INET_ATON_C="inet_aton.c"
307   INET_ATON_O="inet_aton.o"
308 fi
309 AC_SUBST(INET_ATON_C)
310 AC_SUBST(INET_ATON_O)
311
312 AC_CHECK_FUNC(inet_pton, [
313   dnl check for pre-BIND82 inet_pton() bug.
314   AC_MSG_CHECKING(for broken inet_pton)
315   AC_TRY_RUN([#include <sys/types.h>
316 #include <sys/socket.h>
317 #include <netinet/in.h>
318 #include <arpa/inet.h>
319 int main()
320 {
321 #ifdef AF_INET6
322   char buf[16];
323   /* this should return 0 (error) */
324   return inet_pton(AF_INET6, "0:1:2:3:4:5:6:7:", buf);
325 #else
326   return 1;
327 #endif
328 }], [AC_MSG_RESULT(ok);
329 have_inet_pton=yes], [AC_MSG_RESULT(broken);
330 have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
331 have_inet_pton=no])],
332 have_inet_pton=no)
333 if test "$have_inet_pton" = no; then
334   INET_PTON_C="inet_pton.c"
335   INET_PTON_O="inet_pton.o"
336 else
337   INET_PTON_C=""
338   INET_PTON_O=""
339 fi
340 AC_SUBST(INET_PTON_C)
341 AC_SUBST(INET_PTON_O)
342
343 AC_CHECK_FUNC(inet_ntop, INET_NTOP_O="",
344   INET_NTOP_O="inet_ntop.o")
345 if test "$ac_cv_func_inet_ntop" = no ; then
346   INET_NTOP_C="inet_ntop.c"
347   INET_NTOP_O="inet_ntop.o"
348   AC_DEFINE(NEED_INET_V6DEFS_H)
349 fi
350 AC_SUBST(INET_NTOP_C)
351 AC_SUBST(INET_NTOP_O)
352
353 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
354
355 dnl blank for now, but will be used in future
356 AC_SUBST(ethereal_SUBDIRS)
357
358 dnl check for plugins directory - stolen from Amanda's configure.in
359 AC_ARG_WITH(plugindir,
360   [  --with-plugindir=DIR   install plugins in DIR],
361   [
362   case "$withval" in
363   "" | y | ye | yes | n | no)
364     AC_MSG_ERROR([*** You must supply an argument to the --with-plugindir option.])
365   ;;
366   *) PLUGIN_DIR="$withval"
367   esac
368   ],
369   : ${PLUGIN_DIR=$libdir/ethereal/plugins/0.8}
370 )
371
372 PLUGIN_DIR=`(
373   test "x$prefix" = xNONE && prefix=$ac_default_prefix
374   test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
375   eval echo "$PLUGIN_DIR"
376 )`
377 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
378 AC_SUBST(PLUGIN_DIR)
379
380 dnl libtool defs
381 AC_LIBTOOL_DLOPEN
382 AM_PROG_LIBTOOL
383 AC_SUBST(LIBTOOL_DEPS)
384
385 AM_CONFIG_HEADER(config.h)
386 AC_CONFIG_SUBDIRS(wiretap)
387 AC_OUTPUT(
388   Makefile
389   ethereal.spec
390   doc/Makefile
391   doc/dfilter2pod
392   gtk/Makefile
393   plugins/Makefile
394   plugins/gryphon/Makefile,
395         [chmod +x doc/dfilter2pod])