Oops! A missing checkin from the recent update by Kojak to the ICQ
[obnox/wireshark/wip.git] / configure.in
1 # $Id: configure.in,v 1.56 1999/10/27 05:34:39 guy Exp $
2 dnl Process this file with autoconf to produce a configure script.
3 AC_INIT(etypes.h)
4
5 AM_INIT_AUTOMAKE(ethereal, 0.7.7)
6
7 dnl Check for CPU / vendor / OS
8 AC_CANONICAL_HOST
9
10 dnl Checks for programs.
11 AC_PROG_CC
12 AC_PROG_CPP
13 AC_PROG_RANLIB
14 AC_PROG_YACC
15 AM_PROG_LEX
16 AC_PATH_PROG(PERL_PATH, perl)
17 AC_PATH_PROG(LEX, flex)
18
19 AC_SUBST(PERL_PATH)
20 AC_SUBST(FLEX_PATH)
21
22
23 # If we're running gcc, add '-Wall' to CFLAGS.
24 AC_MSG_CHECKING(to see if we can add '-Wall' to CFLAGS)
25 if test x$GCC != x ; then
26   CFLAGS="-Wall $CFLAGS"
27   AC_MSG_RESULT(yes)
28 else
29   AC_MSG_RESULT(no)
30 fi
31
32 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
33
34 # Create DATAFILE_DIR #define for config.h
35 DATAFILE_DIR=$sysconfdir
36 DATAFILE_DIR=`(
37     test "x$prefix" = xNONE && prefix=$ac_default_prefix
38     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
39     eval echo "$DATAFILE_DIR"
40 )`
41 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
42 AC_SUBST(DATAFILE_DIR)
43
44 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
45 # link directory.
46 case "$host_os" in
47   solaris*)
48     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
49     if test x$LD_LIBRARY_PATH != x ; then
50       LIBS="$LIBS -R$LD_LIBRARY_PATH"
51       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
52     else
53       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
54     fi
55   ;;
56 esac
57
58 # GTK checks
59 AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS" LIBS="$LIBS $GTK_LIBS",
60                    AC_MSG_ERROR(GTK+ distribution not found.))
61
62 dnl pcap check
63 AC_ARG_ENABLE(pcap,
64 [  --enable-pcap           use libpcap for packet capturing.  [default=yes]],,enable_pcap=yes)
65
66 AC_MSG_CHECKING(whether to use libpcap for packet capture)
67 if test "x$enable_pcap" = "xno" ; then
68         AC_MSG_RESULT(no)
69 else
70         AC_MSG_RESULT(yes)
71         AC_ETHEREAL_PCAP_CHECK
72 fi
73
74 dnl zlib check
75 AC_ARG_ENABLE(zlib,
76 [  --enable-zlib           use zlib to read compressed data.  [default=yes]],, [dnl
77 case "$host_os" in
78 netbsd*)        enable_zlib=no;;
79 *)              enable_zlib=yes;;
80 esac])
81
82 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
83 if test "x$enable_zlib" = "xno" ; then
84         AC_MSG_RESULT(no)
85 else
86         AC_MSG_RESULT(yes)
87         AC_ETHEREAL_ZLIB_CHECK
88         if test "x$enable_zlib" = "xno" ; then
89                 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
90         fi
91 fi
92
93
94 dnl ipv6 check
95 AC_ARG_ENABLE(ipv6,
96 [  --enable-ipv6           use ipv6 name resolution, if available.  [default=yes]],,enable_ipv6=yes)
97
98 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
99 if test "x$enable_ipv6" = "xno" ; then
100         AC_MSG_RESULT(no)
101 else
102         AC_MSG_RESULT(yes)
103         AC_ETHEREAL_IPV6_STACK
104 fi
105
106
107 dnl Checks for header files.
108 AC_HEADER_STDC
109 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
110 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h netinet/in.h sys/socket.h net/if.h)
111 AC_CHECK_HEADERS(sys/wait.h)
112 AC_CHECK_HEADERS(stddef.h)
113
114 dnl SNMP Check
115 AC_ARG_ENABLE(snmp,
116 [  --enable-snmp           use SNMP library, if available.  [default=yes]],,enable_snmp=yes)
117
118 SNMP_A=''
119 SNMP_C=''
120 SNMP_O=''
121 AC_MSG_CHECKING(whether to use SNMP library if available)
122 if test "x$enable_snmp" = "xno" ; then
123         AC_MSG_RESULT(no)
124 else
125         AC_MSG_RESULT(yes)
126         AC_ETHEREAL_UCDSNMP_CHECK
127         AC_CHECK_HEADERS(ucd-snmp/snmp.h snmp/snmp.h)
128         AC_CHECK_LIB(snmp, asn_parse_header,
129                 [
130                 SNMP_A=-lsnmp
131                 SNMP_C=packet-snmp.c
132                 SNMP_O=packet-snmp.o
133                 ], )
134 fi
135 AC_SUBST(SNMP_A)
136 AC_SUBST(SNMP_C)
137 AC_SUBST(SNMP_O)
138
139 dnl Checks for typedefs, structures, and compiler characteristics.
140 # AC_C_CONST
141
142 # We need to know whether "struct sockaddr" has an "sa_len" member
143 # for get_interface_list().
144
145 AC_ETHEREAL_STRUCT_SA_LEN
146
147 # We must know our byte order
148 AC_C_BIGENDIAN
149
150 dnl Checks for library functions.
151 AC_PROG_GCC_TRADITIONAL
152 AC_CHECK_FUNC(socket,, AC_MSG_ERROR(Function 'socket' not found.))
153
154 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
155 # then this won't work.
156 SNPRINTF_C=""
157 SNPRINTF_O=""
158 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
159   SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
160 if test "$ac_cv_func_snprintf" = no ; then
161   SNPRINTF_C="snprintf.c"
162   SNPRINTF_O="snprintf.o"
163 fi
164 AC_SUBST(SNPRINTF_C)
165 AC_SUBST(SNPRINTF_O)
166
167 AC_CHECK_FUNC(strerror, STRERROR_O="",
168   STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
169 if test "$ac_cv_func_strerror" = no ; then
170   STRERROR_C="strerror.c"
171   STRERROR_O="strerror.o"
172 fi
173 AC_SUBST(STRERROR_C)
174 AC_SUBST(STRERROR_O)
175
176 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
177   STRNCASECMP_O="strncasecmp.o")
178 if test "$ac_cv_func_strncasecmp" = no ; then
179   STRNCASECMP_C="strncasecmp.c"
180   STRNCASECMP_O="strncasecmp.o"
181 fi
182 AC_SUBST(STRNCASECMP_C)
183 AC_SUBST(STRNCASECMP_O)
184
185 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
186   MKSTEMP_O="mkstemp.o")
187 if test "$ac_cv_func_mkstemp" = no ; then
188   MKSTEMP_C="mkstemp.c"
189   MKSTEMP_O="mkstemp.o"
190 fi
191 AC_SUBST(MKSTEMP_C)
192 AC_SUBST(MKSTEMP_O)
193
194 AC_CHECK_FUNC(inet_aton, INET_ATON_O="",
195   INET_ATON_O="inet_aton.o")
196 if test "$ac_cv_func_inet_aton" = no ; then
197   INET_ATON_C="inet_aton.c"
198   INET_ATON_O="inet_aton.o"
199 fi
200 AC_SUBST(INET_ATON_C)
201 AC_SUBST(INET_ATON_O)
202
203 AC_CHECK_FUNC(inet_pton, [
204   dnl check for pre-BIND82 inet_pton() bug.
205   AC_MSG_CHECKING(for broken inet_pton)
206   AC_TRY_RUN([#include <sys/types.h>
207 #include <sys/socket.h>
208 #include <netinet/in.h>
209 #include <arpa/inet.h>
210 int main()
211 {
212 #ifdef AF_INET6
213   char buf[16];
214   /* this should return 0 (error) */
215   return inet_pton(AF_INET6, "0:1:2:3:4:5:6:7:", buf);
216 #else
217   return 1;
218 #endif
219 }], [AC_MSG_RESULT(ok);
220 have_inet_pton=yes], [AC_MSG_RESULT(broken);
221 have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
222 have_inet_pton=no])],
223 have_inet_pton=no)
224 if test "$have_inet_pton" = no; then
225   INET_PTON_C="inet_pton.c"
226   INET_PTON_O="inet_pton.o"
227 else
228   INET_PTON_C=""
229   INET_PTON_O=""
230 fi
231 AC_SUBST(INET_PTON_C)
232 AC_SUBST(INET_PTON_O)
233
234 AC_CHECK_FUNC(inet_ntop, INET_NTOP_O="",
235   INET_NTOP_O="inet_ntop.o")
236 if test "$ac_cv_func_inet_ntop" = no ; then
237   INET_NTOP_C="inet_ntop.c"
238   INET_NTOP_O="inet_ntop.o"
239   AC_DEFINE(NEED_INET_V6DEFS_H)
240 fi
241 AC_SUBST(INET_NTOP_C)
242 AC_SUBST(INET_NTOP_O)
243
244 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
245
246 dnl blank for now, but will be used in future
247 AC_SUBST(ethereal_SUBDIRS)
248
249 AM_CONFIG_HEADER(config.h)
250 AC_CONFIG_SUBDIRS(wiretap)
251 AC_OUTPUT(Makefile ethereal.spec doc/Makefile doc/dfilter2pod gtk/Makefile,
252         [chmod +x doc/dfilter2pod])