Merge in the final code to make Ethereal run on Win32, compiled
[obnox/wireshark/wip.git] / configure.in
1 # $Id: configure.in,v 1.73 2000/01/15 00:22:29 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.1)
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 # GLib checks
91 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
92 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
93 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
94 # set when generating the Makefile, so we can make programs that require
95 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
96 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
97 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
98 # programs to be built with GLib.
99 #
100 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.))
101
102 # GTK checks
103 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
104 # programs to be built with GTK+.
105 #
106 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS",
107                    AC_MSG_ERROR(GTK+ distribution not found.))
108
109 dnl pcap check
110 AC_ARG_ENABLE(pcap,
111 [  --enable-pcap           use libpcap for packet capturing.  [default=yes]],,enable_pcap=yes)
112
113 AC_MSG_CHECKING(whether to use libpcap for packet capture)
114 if test "x$enable_pcap" = "xno" ; then
115         AC_MSG_RESULT(no)
116 else
117         AC_MSG_RESULT(yes)
118         AC_ETHEREAL_PCAP_CHECK
119 fi
120
121 dnl zlib check
122 AC_ARG_ENABLE(zlib,
123 [  --enable-zlib           use zlib to read compressed data.  [default=yes]],, [dnl
124 case "$host_os" in
125 netbsd*)        enable_zlib=no;;
126 *)              enable_zlib=yes;;
127 esac])
128
129 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
130 if test "x$enable_zlib" = "xno" ; then
131         AC_MSG_RESULT(no)
132 else
133         AC_MSG_RESULT(yes)
134         AC_ETHEREAL_ZLIB_CHECK
135         if test "x$enable_zlib" = "xno" ; then
136                 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
137         fi
138 fi
139
140
141 dnl ipv6 check
142 AC_ARG_ENABLE(ipv6,
143 [  --enable-ipv6           use ipv6 name resolution, if available.  [default=yes]],,enable_ipv6=yes)
144
145 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
146 if test "x$enable_ipv6" = "xno" ; then
147         AC_MSG_RESULT(no)
148 else
149         AC_MSG_RESULT(yes)
150         AC_ETHEREAL_IPV6_STACK
151 fi
152
153
154 dnl Checks for header files.
155 AC_HEADER_STDC
156 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h dirent.h)
157 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
158 AC_CHECK_HEADERS(sys/wait.h sys/param.h)
159 AC_CHECK_HEADERS(netinet/in.h net/if.h)
160 AC_CHECK_HEADERS(stddef.h)
161 AC_CHECK_HEADERS(dlfcn.h)
162 AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h)
163
164 dnl SNMP Check
165 AC_ARG_ENABLE(snmp,
166 [  --enable-snmp           use SNMP library, if available.  [default=yes]],,enable_snmp=yes)
167
168 SNMP_A=''
169 AC_MSG_CHECKING(whether to use SNMP library if available)
170 if test "x$enable_snmp" = "xno" ; then
171         AC_MSG_RESULT(no)
172 else
173         AC_MSG_RESULT(yes)
174         AC_ETHEREAL_UCDSNMP_CHECK
175         AC_CHECK_HEADERS(ucd-snmp/snmp.h ucd-snmp/version.h snmp/snmp.h snmp/version.h)
176         AC_CHECK_LIB(snmp, sprint_objid,
177                 [
178                 SNMP_A=-lsnmp
179                 ], )
180 fi
181 AC_SUBST(SNMP_A)
182
183 dnl Checks for typedefs, structures, and compiler characteristics.
184 # AC_C_CONST
185
186 # We need to know whether "struct sockaddr" has an "sa_len" member
187 # for get_interface_list().
188
189 AC_ETHEREAL_STRUCT_SA_LEN
190
191 # We must know our byte order
192 AC_C_BIGENDIAN
193
194 dnl Checks for library functions.
195 AC_PROG_GCC_TRADITIONAL
196 AC_CHECK_FUNC(socket,, AC_MSG_ERROR(Function 'socket' not found.))
197
198 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
199 # then this won't work.
200 SNPRINTF_C=""
201 SNPRINTF_O=""
202 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
203   SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
204 if test "$ac_cv_func_snprintf" = no ; then
205   SNPRINTF_C="snprintf.c"
206   SNPRINTF_O="snprintf.o"
207 fi
208 AC_SUBST(SNPRINTF_C)
209 AC_SUBST(SNPRINTF_O)
210
211 AC_CHECK_FUNC(strerror, STRERROR_O="",
212   STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
213 if test "$ac_cv_func_strerror" = no ; then
214   STRERROR_C="strerror.c"
215   STRERROR_O="strerror.o"
216 fi
217 AC_SUBST(STRERROR_C)
218 AC_SUBST(STRERROR_O)
219
220 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
221   STRNCASECMP_O="strncasecmp.o")
222 if test "$ac_cv_func_strncasecmp" = no ; then
223   STRNCASECMP_C="strncasecmp.c"
224   STRNCASECMP_O="strncasecmp.o"
225 fi
226 AC_SUBST(STRNCASECMP_C)
227 AC_SUBST(STRNCASECMP_O)
228
229 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
230   MKSTEMP_O="mkstemp.o")
231 if test "$ac_cv_func_mkstemp" = no ; then
232   MKSTEMP_C="mkstemp.c"
233   MKSTEMP_O="mkstemp.o"
234   AC_DEFINE(NEED_MKSTEMP)
235 fi
236 AC_SUBST(MKSTEMP_C)
237 AC_SUBST(MKSTEMP_O)
238
239 AC_CHECK_FUNC(inet_aton, INET_ATON_O="",
240   INET_ATON_O="inet_aton.o")
241 if test "$ac_cv_func_inet_aton" = no ; then
242   INET_ATON_C="inet_aton.c"
243   INET_ATON_O="inet_aton.o"
244 fi
245 AC_SUBST(INET_ATON_C)
246 AC_SUBST(INET_ATON_O)
247
248 AC_CHECK_FUNC(inet_pton, [
249   dnl check for pre-BIND82 inet_pton() bug.
250   AC_MSG_CHECKING(for broken inet_pton)
251   AC_TRY_RUN([#include <sys/types.h>
252 #include <sys/socket.h>
253 #include <netinet/in.h>
254 #include <arpa/inet.h>
255 int main()
256 {
257 #ifdef AF_INET6
258   char buf[16];
259   /* this should return 0 (error) */
260   return inet_pton(AF_INET6, "0:1:2:3:4:5:6:7:", buf);
261 #else
262   return 1;
263 #endif
264 }], [AC_MSG_RESULT(ok);
265 have_inet_pton=yes], [AC_MSG_RESULT(broken);
266 have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
267 have_inet_pton=no])],
268 have_inet_pton=no)
269 if test "$have_inet_pton" = no; then
270   INET_PTON_C="inet_pton.c"
271   INET_PTON_O="inet_pton.o"
272 else
273   INET_PTON_C=""
274   INET_PTON_O=""
275 fi
276 AC_SUBST(INET_PTON_C)
277 AC_SUBST(INET_PTON_O)
278
279 AC_CHECK_FUNC(inet_ntop, INET_NTOP_O="",
280   INET_NTOP_O="inet_ntop.o")
281 if test "$ac_cv_func_inet_ntop" = no ; then
282   INET_NTOP_C="inet_ntop.c"
283   INET_NTOP_O="inet_ntop.o"
284   AC_DEFINE(NEED_INET_V6DEFS_H)
285 fi
286 AC_SUBST(INET_NTOP_C)
287 AC_SUBST(INET_NTOP_O)
288
289 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
290
291 dnl blank for now, but will be used in future
292 AC_SUBST(ethereal_SUBDIRS)
293
294 dnl check for plugins directory - stolen from Amanda's configure.in
295 AC_ARG_WITH(plugindir,
296   [  --with-plugindir=DIR   install plugins in DIR],
297   [
298   case "$withval" in
299   "" | y | ye | yes | n | no)
300     AC_MSG_ERROR([*** You must supply an argument to the --with-plugindir option.])
301   ;;
302   *) PLUGIN_DIR="$withval"
303   esac
304   ],
305   : ${PLUGIN_DIR=$libdir/ethereal/plugins/0.8}
306 )
307
308 PLUGIN_DIR=`(
309   test "x$prefix" = xNONE && prefix=$ac_default_prefix
310   test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
311   eval echo "$PLUGIN_DIR"
312 )`
313 AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
314 AC_SUBST(PLUGIN_DIR)
315
316 dnl libtool defs
317 AC_LIBLTDL_CONVENIENCE(libltdl)
318 AC_LIBTOOL_DLOPEN
319 AM_PROG_LIBTOOL
320 AC_SUBST(LIBLTDL)
321 AC_SUBST(LIBTOOL_DEPS)
322
323 AM_CONFIG_HEADER(config.h)
324 AC_CONFIG_SUBDIRS(wiretap libltdl)
325 AC_OUTPUT(
326   Makefile
327   ethereal.spec
328   doc/Makefile
329   doc/dfilter2pod
330   gtk/Makefile
331   plugins/Makefile
332   plugins/gryphon/Makefile,
333         [chmod +x doc/dfilter2pod])