Add a "--with-extra-gcc-checks" option, which causes "-Wcast-qual
[obnox/wireshark/wip.git] / configure.in
1 # $Id: configure.in,v 1.188 2002/11/28 04:21:28 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 dnl Check for CPU / vendor / OS
17 AC_CANONICAL_HOST
18 AC_CANONICAL_TARGET
19
20 AM_INIT_AUTOMAKE(ethereal, 0.9.7)
21
22 dnl Checks for programs.
23 AC_PROG_CC
24 AC_PROG_CPP
25 AC_LIBTOOL_DLOPEN
26 AC_PROG_LIBTOOL
27 AC_PROG_YACC
28 AM_PROG_LEX
29 AC_PATH_PROG(PERL, perl)
30 AC_PATH_PROG(POD2MAN, pod2man)
31 AC_PATH_PROG(LEX, flex)
32 AC_PATH_PROG(PYTHON, python)
33
34 AC_SUBST(PERL)
35 AC_SUBST(LEX)
36 AC_SUBST(PYTHON)
37
38 # Check for packaging utilities
39 # For now, we check to see if the various packaging utilites are in our
40 # path.  I'm too lazy to write code to go hunt for them.  -  Gerald
41 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
42 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
43 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
44
45 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
46      -a x$HAVE_PKGTRANS = xyes ; then
47   HAVE_SVR4_PACKAGING=yes
48 else
49   HAVE_SVR4_PACKAGING=no
50 fi
51 AC_SUBST(HAVE_SVR4_PACKAGING)
52
53 AC_ETHEREAL_RPM_CHECK
54 AC_SUBST(HAVE_RPM)
55
56 #
57 # If we're running gcc, add '-Wall -W' to CFLAGS, and add
58 # '-D_U_="__attribute__((unused))"' as well, so we can use _U_ to
59 # flag unused function arguments and not get warnings about them.
60 # If "--with-extra-gcc-checks" was specified, add "-Wcast-qual
61 # -Wcast-align" as well.  (Add more checks here in the future?)
62 #
63 # Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
64 # argument will compile with non-GCC compilers.
65 #
66 AC_ARG_WITH(extra-gcc-checks,
67 [  --with-extra-gcc-checks do additional -W checks in GCC.  [default=no]],
68 [
69         if test $withval != no
70         then
71                 ethereal_extra_gcc_flags=" -Wcast-qual -Wcast-align"
72         fi
73 ],)
74 AC_MSG_CHECKING(to see if we can add '-Wall -W$ethereal_extra_gcc_flags' to CFLAGS)
75 if test x$GCC != x ; then
76   CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W$ethereal_extra_gcc_flags $CFLAGS"
77   AC_MSG_RESULT(yes)
78 else
79   CFLAGS="-D_U_=\"\" $CFLAGS"
80   AC_MSG_RESULT(no)
81 fi
82
83 #
84 # Add any platform-specific compiler flags needed.
85 #
86 AC_MSG_CHECKING(for platform-specific compiler flags)
87 if test "x$GCC" = x
88 then
89         #
90         # Not GCC - assume it's the vendor's compiler.
91         #
92         case "$host_os" in
93         hpux*)
94                 #
95                 # HP's ANSI C compiler; flags suggested by Jost Martin.
96                 # "-Ae" for ANSI C plus extensions such as "long long".
97                 # "+O2", for optimization.  XXX - works with "-g"?
98                 #
99                 CFLAGS="-Ae +O2 $CFLAGS"
100                 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
101                 ;;
102         darwin*)
103                 #
104                 # It may be called "cc", but it's really a GCC derivative
105                 # with a problematic special precompiler and precompiled
106                 # headers; turn off the special precompiler, as some
107                 # apparently-legal code won't compile with its precompiled
108                 # headers.
109                 #
110                 CFLAGS="-no-cpp-precomp $CFLAGS"
111                 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
112                 ;;
113         *)
114                 AC_MSG_RESULT(none needed)
115                 ;;
116         esac
117 else
118         case "$host_os" in
119         solaris*)
120                 # the X11 headers don't automatically include prototype info
121                 # and a lot don't include the return type
122                 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
123                 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
124                 ;;
125         darwin*)
126                 #
127                 # See comments above about Apple's lovely C compiler.
128                 #
129                 CFLAGS="-no-cpp-precomp $CFLAGS"
130                 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
131                 ;;
132         *)
133                 AC_MSG_RESULT(none needed)
134                 ;;
135         esac
136 fi
137
138 CFLAGS="$CFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
139 CPPFLAGS="$CPPFLAGS -I\$(top_srcdir) -I\$(top_srcdir)/wiretap"
140
141 dnl Look in /usr/local for header files and libraries ?
142 AC_ARG_ENABLE(usr-local,
143 [  --enable-usr-local      look for headers and libs in /usr/local tree.  [default=yes]],enable_usr_local=$enableval,enable_usr_local=yes)
144
145 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
146 if test "x$enable_usr_local" = "xyes" ; then
147         AC_MSG_RESULT(yes)
148         #
149         # Arrange that we search for header files in the source directory
150         # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
151         # as various packages we use ("libpcap", "zlib", an SNMP library)
152         # may have been installed under "/usr/local/include".
153         #
154         CFLAGS="$CFLAGS -I/usr/local/include"
155         CPPFLAGS="$CPPFLAGS -I/usr/local/include"
156
157         #
158         # Arrange that we search for libraries in "/usr/local/lib".
159         #
160         AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
161 else
162         AC_MSG_RESULT(no)
163 fi
164
165 # Create DATAFILE_DIR #define for config.h
166 DATAFILE_DIR=$sysconfdir
167 DATAFILE_DIR=`(
168     test "x$prefix" = xNONE && prefix=$ac_default_prefix
169     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
170     eval echo "$DATAFILE_DIR"
171 )`
172 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$DATAFILE_DIR")
173 AC_SUBST(DATAFILE_DIR)
174
175 #
176 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
177 # link directory.
178 #
179 case "$host_os" in
180   solaris*)
181     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
182     if test x$LD_LIBRARY_PATH != x ; then
183       LIBS="$LIBS -R$LD_LIBRARY_PATH"
184       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
185     else
186       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
187     fi
188   ;;
189 esac
190
191 #
192 # Check for versions of "sed" inadequate to handle, in libtool, a list
193 # of object files as large as the list in Ethereal.
194 #
195 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
196 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
197 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
198 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
199 # is the only "sed" that comes with Solaris that can handle Ethereal.
200 #
201 # Add any checks here that are necessary for other OSes.
202 #
203 AC_ETHEREAL_GNU_SED_CHECK
204 if test "$HAVE_GNU_SED" = no ; then
205         case "$host_os" in
206         solaris*)
207                 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
208                 case `which sed` in
209                         /bin/sed|/usr/bin/sed|/usr/ucb/sed)
210                         AC_MSG_RESULT(yes)              
211                         AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
212                         ;;
213
214                         *)
215                         AC_MSG_RESULT(no)
216                         ;;
217                 esac
218                 ;;
219
220         *)
221                 :
222                 ;;
223         esac
224 fi
225
226 # Enable/disable tethereal
227
228 AC_ARG_ENABLE(ethereal,
229 [  --enable-ethereal       build GTK+-based ethereal.  [default=yes]],,enable_ethereal=yes)
230
231 AC_ARG_ENABLE(gtk2,
232 [  --enable-gtk2           build Glib2/Gtk2+-based (t)ethereal.  [default=no]],enable_gtk2=yes,enable_gtk2=no)
233 AM_CONDITIONAL(USE_GTK2, test x$enable_gtk2 = xyes)
234
235 # GTK checks
236 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
237 # programs to be built with GTK+.
238 #
239 if test "x$enable_gtk2" = "xyes" -a "x$enable_ethereal" = "xyes" ; then
240         GTK_OK=two
241         AM_PATH_GTK_2_0(2.0.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no, gthread)
242 elif test "x$enable_gtk2" = "xno" -a "x$enable_ethereal" = "xyes" ; then
243         GTK_OK=one
244         AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
245 else
246         GTK_OK=no
247 fi
248
249 # GLib checks
250 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
251 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
252 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
253 # set when generating the Makefile, so we can make programs that require
254 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
255 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
256 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
257 # programs to be built with GLib.
258 #
259 if test "$GTK_OK" = "no" ; then
260         enable_ethereal="no"
261         ethereal_bin=""
262         ethereal_man=""
263         # Honor GLIB_CFLAGS
264         if test "x$enable_gtk2" = "xyes" ; then
265                 AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
266         else
267                 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
268         fi
269 else
270         ethereal_bin="ethereal"
271         ethereal_man="ethereal.1"
272         ethereal_SUBDIRS="gtk"
273         # Honor GLIB_CFLAGS
274         if test "$GTK_OK" = "two" ; then
275                 AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
276         else
277                 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
278         fi
279 fi
280
281 #
282 # Check whether GLib modules are supported, to determine whether we
283 # can support plugins.
284 #
285 AC_MSG_CHECKING(whether GLib supports loadable modules)
286 ac_save_CFLAGS="$CFLAGS"
287 ac_save_LIBS="$LIBS"
288 CFLAGS="$CFLAGS $GLIB_CFLAGS"
289 LIBS="$GLIB_LIBS $LIBS"
290 AC_TRY_RUN([
291 #include <glib.h>
292 #include <gmodule.h>
293 #include <stdio.h>
294 #include <stdlib.h>
295
296 int 
297 main ()
298 {
299   if (g_module_supported())
300     return 0;   /* success */
301   else
302     return 1;   /* failure */
303 }
304 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
305    [echo $ac_n "cross compiling; assumed OK... $ac_c"])
306 CFLAGS="$ac_save_CFLAGS"
307 LIBS="$ac_save_LIBS"
308 if test "$ac_cv_glib_supports_modules" = yes ; then
309   AC_MSG_RESULT(yes)
310   have_plugins=yes
311 else
312   AC_MSG_RESULT(no)
313   have_plugins=no
314 fi
315
316
317 AC_SUBST(ethereal_bin)
318 AC_SUBST(ethereal_man)
319
320
321
322 # Enable/disable tethereal
323
324 AC_ARG_ENABLE(tethereal,
325 [  --enable-tethereal      build tethereal.  [default=yes]],,enable_tethereal=yes)
326
327 if test "x$enable_tethereal" = "xyes" ; then
328         tethereal_bin="tethereal"
329         tethereal_man="tethereal.1"
330 else
331         tethereal_bin=""
332         tethereal_man=""
333 fi
334 AC_SUBST(tethereal_bin)
335 AC_SUBST(tethereal_man)
336
337
338
339 # Enable/disable editcap
340
341 AC_ARG_ENABLE(editcap,
342 [  --enable-editcap        build editcap.  [default=yes]],,enable_editcap=yes)
343
344 if test "x$enable_editcap" = "xyes" ; then
345         editcap_bin="editcap"
346         editcap_man="editcap.1"
347 else
348         editcap_bin=""
349         editcap_man=""
350 fi
351 AC_SUBST(editcap_bin)
352 AC_SUBST(editcap_man)
353
354
355 # Enable/disable mergecap
356
357 AC_ARG_ENABLE(mergecap,
358 [  --enable-mergecap       build mergecap.  [default=yes]],,enable_mergecap=yes)
359
360 if test "x$enable_mergecap" = "xyes" ; then
361         mergecap_bin="mergecap"
362         mergecap_man="mergecap.1"
363 else
364         mergecap_bin=""
365         mergecap_man=""
366 fi
367 AC_SUBST(mergecap_bin)
368 AC_SUBST(mergecap_man)
369
370
371 # Enable/disable text2pcap
372
373 AC_ARG_ENABLE(text2pcap,
374 [  --enable-text2pcap      build text2pcap.  [default=yes]],,enable_text2pcap=yes)
375
376 if test "x$enable_text2pcap" = "xyes" ; then
377         text2pcap_bin="text2pcap"
378         text2pcap_man="text2pcap.1"
379 else
380         text2pcap_bin=""
381         text2pcap_man=""
382 fi
383 AC_SUBST(text2pcap_bin)
384 AC_SUBST(text2pcap_man)
385
386 # Enable/disable idl2eth
387
388 AC_ARG_ENABLE(idl2eth,
389 [  --enable-idl2eth        build idl2eth.  [default=yes]],,enable_idl2eth=yes)
390
391 if test "x$enable_idl2eth" = "xyes" ; then
392         idl2eth_bin="idl2eth"
393         idl2eth_man="idl2eth.1"
394 else
395         idl2eth_bin=""
396         idl2eth_man=""
397 fi
398 AC_SUBST(idl2eth_bin)
399 AC_SUBST(idl2eth_man)
400
401
402 # Enable/disable dftest
403
404 AC_ARG_ENABLE(dftest,
405 [  --enable-dftest         build dftest.  [default=no]],,enable_dftest=no)
406
407 if test "x$enable_dftest" = "xyes" ; then
408         dftest_bin="dftest"
409 else
410         dftest_bin=""
411 fi
412 AC_SUBST(dftest_bin)
413
414
415 # Enable/disable randpkt
416
417 AC_ARG_ENABLE(randpkt,
418 [  --enable-randpkt        build randpkt.  [default=no]],,enable_randpkt=no)
419
420 if test "x$enable_randpkt" = "xyes" ; then
421         randpkt_bin="randpkt"
422 else
423         randpkt_bin=""
424 fi
425 AC_SUBST(randpkt_bin)
426
427
428 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
429 dnl "gethostbyname()".
430 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
431
432 dnl Checks for "connect()", used as a proxy for "socket()" - and
433 dnl "-lsocket", if we need it to get "connect()".
434 AC_ETHEREAL_SOCKET_LIB_CHECK
435
436 dnl pcap check
437 AC_MSG_CHECKING(whether to use libpcap for packet capture)
438
439 AC_ARG_WITH(pcap,
440 [  --with-pcap[=DIR]       use libpcap for packet capturing.  [default=yes]],
441 [
442         if test $withval = no
443         then
444                 want_pcap=no
445         elif test $withval = yes
446         then
447                 want_pcap=yes
448         else
449                 want_pcap=yes
450                 pcap_dir=$withval
451         fi
452 ],[
453         want_pcap=yes
454         pcap_dir=
455 ])
456 if test "x$want_pcap" = "xno" ; then
457         AC_MSG_RESULT(no)
458 else
459         AC_MSG_RESULT(yes)
460         AC_ETHEREAL_PCAP_CHECK
461         AC_ETHEREAL_PCAP_VERSION_CHECK
462 fi
463
464 dnl zlib check
465 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
466
467 AC_ARG_WITH(zlib,
468 [  --with-zlib[=DIR]       use zlib (located in directory DIR, if supplied) to read compressed data.  [default=yes, if present]],
469 [
470         if test $withval = no
471         then
472                 want_zlib=no
473         elif test $withval = yes
474         then
475                 want_zlib=yes
476         else
477                 want_zlib=yes
478                 zlib_dir=$withval
479         fi
480 ],[
481         #
482         # Use zlib if it's present, otherwise don't.
483         #
484         want_zlib=ifpresent
485         zlib_dir=
486 ])
487 if test "x$want_zlib" = "xno" ; then
488         AC_MSG_RESULT(no)
489 else
490         AC_MSG_RESULT(yes)
491         AC_ETHEREAL_ZLIB_CHECK
492         if test "x$want_zlib" = "xno" ; then
493                 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
494         fi
495 fi
496
497
498 dnl ipv6 check
499 AC_ARG_ENABLE(ipv6,
500 [  --enable-ipv6           use ipv6 name resolution, if available.  [default=yes]],,enable_ipv6=yes)
501
502 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
503 if test "x$enable_ipv6" = "xno" ; then
504         AC_MSG_RESULT(no)
505 else
506         AC_MSG_RESULT(yes)
507         AC_ETHEREAL_IPV6_STACK
508 fi
509
510
511 dnl Check if ethereal should be installed setuid
512 AC_ARG_ENABLE(setuid-install,
513 [  --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],,enable_setuid_install=no)
514
515 AC_MSG_CHECKING(whether to install ethereal setuid)
516 if test "x$enable_setuid_install" = "xno" ; then
517         AC_MSG_RESULT(no)
518 else
519         AC_MSG_RESULT(yes)
520 fi
521
522 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
523
524 dnl Checks for header files.
525 AC_HEADER_STDC
526 AC_CHECK_HEADERS(fcntl.h sys/ioctl.h sys/time.h unistd.h stdarg.h netdb.h)
527 AC_CHECK_HEADERS(sys/stat.h sys/sockio.h sys/types.h sys/socket.h)
528 AC_CHECK_HEADERS(sys/wait.h)
529 AC_CHECK_HEADERS(netinet/in.h)
530 AC_CHECK_HEADERS(stddef.h)
531 AC_CHECK_HEADERS(arpa/inet.h)
532 AC_CHECK_HEADERS(iconv.h)
533
534 dnl SSL Check
535 SSL_LIBS=''
536 AC_MSG_CHECKING(whether to use SSL library if available)
537 if test "x$enable_ssl" = "xno" ; then
538         AC_MSG_RESULT(no)
539 else
540         AC_MSG_RESULT(yes)
541         AC_ETHEREAL_SSL_CHECK
542 fi
543 AC_SUBST(SSL_LIBS)
544
545 dnl UCD SNMP Check
546 SNMP_LIBS=''
547 AC_MSG_CHECKING(whether to use UCD SNMP/NET-SNMP library if available)
548
549 AC_ARG_WITH(net-snmp,
550 [  --with-net-snmp=PATH    use PATH as the location of the net-snmp-config shell script that comes with the net-snmp package.],
551 [netsnmpconfig=$withval]
552 )
553
554 AC_ARG_WITH(ucdsnmp,
555 [  --with-ucdsnmp[=DIR]    use UCD SNMP/NET-SNMP client library (located in directory DIR, if supplied).  [default=yes, if present]],
556 [
557         if test $withval = no
558         then
559                 want_ucdsnmp=no
560         elif test $withval = yes
561         then
562                 want_ucdsnmp=yes
563         else
564                 want_ucdsnmp=yes
565                 ucdsnmp_dir=$withval
566         fi
567 ],[
568         #
569         # Set "want_ucdsnmp" to "ifpresent" to make the default "use it
570         # if you find it, otherwise don't".
571         #
572         want_ucdsnmp=ifpresent
573         ucdsnmp_dir=
574 ])
575
576 dnl try net-snmp first
577 if test "x$netsnmpconfig" != "xno" ; then
578         dnl get the net-snmp-config binary
579         if test "x$netsnmpconfig" = "xyes" -o "x$netsnmpconfig" = "x" ; then
580                 dnl search for it
581                 AC_PATH_PROG(NETSNMPCONFIG,net-snmp-config)
582         else
583                 NETSNMPCONFIG=$netsnmpconfig
584                 if test ! -x $NETSNMPCONFIG ; then
585                         AC_MSG_ERROR(Invalid net-snmp-config: $NETSNMPCONFIG)
586                 fi
587         fi
588 fi
589
590 if test "x$NETSNMPCONFIG" != "xno" -a "x$NETSNMPCONFIG" != "x" -a -x "$NETSNMPCONFIG" ; then
591         dnl other choices for flags to use here: could also use
592         dnl --prefix or --exec-prefix if you don't want the full list.
593
594         AC_CHECK_HEADERS(net-snmp/net-snmp-config.h net-snmp/library/default_store.h)
595         if test "x$ac_cv_header_net_snmp_net_snmp_config_h" = "xyes" -a "x$ac_cv_header_net_snmp_library_default_store_h" = "xyes" ; then
596                 CFLAGS="$CFLAGS `net-snmp-config --cflags`"
597                 CPPFLAGS="$CPPLAGS `net-snmp-config --cflags`"
598                 SNMP_LIBS=`net-snmp-config --libs`
599                 AC_DEFINE(HAVE_NET_SNMP)
600                 AC_MSG_RESULT(yes (net-snmp))
601         else
602                 # technically, we should retry ucd-snmp but it's
603                 # unlikely they have installed net-snmp-config and not
604                 # the net-snmp headers but do have the ucd-snmp
605                 # headers.  This would likely be a broken system to
606                 # try and use anyway.
607                 NETSNMPCONFIG="no"
608                 AC_MSG_RESULT(no)
609         fi      
610 else
611         if test "x$want_ucdsnmp" = "xno" ; then
612                 AC_MSG_RESULT(no)
613         else
614                 AC_MSG_RESULT(yes (ucd-snmp))
615                 AC_ETHEREAL_UCDSNMP_CHECK
616         fi
617 fi
618
619 AC_SUBST(SNMP_LIBS)
620
621 dnl Checks for typedefs, structures, and compiler characteristics.
622 # AC_C_CONST
623
624 # We need to know whether "struct sockaddr" has an "sa_len" member
625 # for get_interface_list().
626
627 AC_ETHEREAL_STRUCT_SA_LEN
628
629 # We must know our byte order
630 AC_C_BIGENDIAN
631
632 # Checks whether "-traditional" is needed when using "ioctl".
633 # XXX - do we need this?
634 AC_PROG_GCC_TRADITIONAL
635
636 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
637 # then this won't work.
638 SNPRINTF_C=""
639 SNPRINTF_O=""
640 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
641   SNPRINTF_O="snprintf.o" [AC_DEFINE(NEED_SNPRINTF_H)])
642 if test "$ac_cv_func_snprintf" = no ; then
643   SNPRINTF_C="snprintf.c"
644   SNPRINTF_O="snprintf.o"
645 fi
646 AC_SUBST(SNPRINTF_C)
647 AC_SUBST(SNPRINTF_O)
648
649 AC_CHECK_FUNC(strerror, STRERROR_O="",
650   STRERROR_O="strerror.o" [AC_DEFINE(NEED_STRERROR_H)])
651 if test "$ac_cv_func_strerror" = no ; then
652   STRERROR_C="strerror.c"
653   STRERROR_O="strerror.o"
654 fi
655 AC_SUBST(STRERROR_C)
656 AC_SUBST(STRERROR_O)
657
658 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
659   STRCASECMP_O="strcasecmp.o")
660 if test "$ac_cv_func_strcasecmp" = no ; then
661   STRCASECMP_C="strcasecmp.c"
662   STRCASECMP_O="strcasecmp.o"
663 fi
664 AC_SUBST(STRCASECMP_C)
665 AC_SUBST(STRCASECMP_O)
666
667 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
668   STRNCASECMP_O="strncasecmp.o")
669 if test "$ac_cv_func_strncasecmp" = no ; then
670   STRNCASECMP_C="strncasecmp.c"
671   STRNCASECMP_O="strncasecmp.o"
672 fi
673 AC_SUBST(STRNCASECMP_C)
674 AC_SUBST(STRNCASECMP_O)
675
676 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
677   MKSTEMP_O="mkstemp.o")
678 if test "$ac_cv_func_mkstemp" = no ; then
679   MKSTEMP_C="mkstemp.c"
680   MKSTEMP_O="mkstemp.o"
681 fi
682 AC_SUBST(MKSTEMP_C)
683 AC_SUBST(MKSTEMP_O)
684
685 AC_CHECK_FUNC(strptime, STRPTIME_O="",
686   STRPTIME_O="strptime.o" [AC_DEFINE(NEED_STRPTIME_H)])
687 if test "$ac_cv_func_strptime" = no ; then
688   STRPTIME_C="strptime.c"
689   STRPTIME_O="strptime.o"
690 fi
691 AC_SUBST(STRPTIME_C)
692 AC_SUBST(STRPTIME_O)
693
694 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
695
696 dnl blank for now, but will be used in future
697 AC_SUBST(ethereal_SUBDIRS)
698
699 dnl
700 dnl check whether plugins should be enabled and, if they should be,
701 dnl check for plugins directory - stolen from Amanda's configure.in
702 dnl
703 plugindir="$libdir/ethereal/plugins/$VERSION"
704 PLUGIN_DIR="$plugindir"
705 AC_ARG_WITH(plugins,
706   [  --with-plugins[=DIR]    support plugins (installed in DIR, if supplied).],
707   [
708   case "$withval" in
709   "" | y | ye | yes )
710     if test x$have_plugins = xno
711     then
712       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
713     fi
714     ;;
715   n | no)
716     have_plugins=no
717     ;;
718   *)
719     if test x$have_plugins = xno
720     then
721       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
722     fi
723     PLUGIN_DIR="$withval"
724     ;;
725   esac
726   ]
727 )
728
729 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
730 if test x$have_plugins = xyes
731 then
732   AC_DEFINE(HAVE_PLUGINS)
733   PLUGIN_DIR=`(
734     test "x$prefix" = xNONE && prefix=$ac_default_prefix
735     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
736     eval echo "$PLUGIN_DIR"
737   )`
738   AC_DEFINE_UNQUOTED(PLUGIN_DIR,"$PLUGIN_DIR", [Plugin installation directory])
739 else
740   AC_DEFINE(PLUGIN_DIR,NULL)
741 fi
742 AC_SUBST(PLUGIN_DIR)
743 AC_SUBST(plugindir)
744
745 dnl libtool defs
746 AM_PROG_LIBTOOL
747 AC_SUBST(LIBTOOL_DEPS)
748
749 AM_CONFIG_HEADER(config.h)
750 AC_CONFIG_SUBDIRS(epan wiretap)
751 AC_OUTPUT(
752   Makefile
753   doc/Makefile
754   gtk/Makefile
755   packaging/Makefile
756   packaging/nsis/Makefile
757   packaging/rpm/Makefile
758   packaging/rpm/SPECS/Makefile
759   packaging/rpm/SPECS/ethereal.spec
760   packaging/svr4/Makefile
761   packaging/svr4/checkinstall
762   packaging/svr4/pkginfo
763   plugins/Makefile
764   plugins/docsis/Makefile
765   plugins/giop/Makefile
766   plugins/gryphon/Makefile
767   plugins/mgcp/Makefile
768   plugins/pcli/Makefile
769   tools/Makefile
770   tools/lemon/Makefile
771   ,)
772
773
774 # Pretty messages
775
776 if test "x$enable_setuid_install" = "xyes" ; then
777         setuid_message="yes (DANGEROUS!!!)"
778 else
779         setuid_message="no"
780 fi
781
782 if test "x$want_zlib" = "xno" ; then
783         zlib_message="no"
784 else
785         zlib_message="yes"
786 fi
787
788 if test "x$NETSNMPCONFIG" != "xno" -a "x$NETSNMPCONFIG" != "x" -a -x "$NETSNMPCONFIG" ; then
789         snmp_libs_message="yes (net-snmp)"
790 elif test "x$SNMP_LIBS" = "x" ; then
791         snmp_libs_message="no"
792 else
793         snmp_libs_message="yes (ucd-snmp)"
794 fi
795
796 echo ""
797 echo "The Ethereal package has been configured with the following options."
798 echo "                    Build ethereal : $enable_ethereal"
799 echo "                   Build tethereal : $enable_tethereal"
800 echo "                     Build editcap : $enable_editcap"
801 echo "                    Build mergecap : $enable_mergecap"
802 echo "                   Build text2pcap : $enable_text2pcap"
803 echo "                     Build idl2eth : $enable_idl2eth"
804 echo "                     Build randpkt : $enable_randpkt"
805 echo "                      Build dftest : $enable_dftest"
806 echo ""
807 echo "                    Install setuid : $setuid_message"
808 echo "                       Use plugins : $have_plugins"
809 echo "               Use GTK+ v2 library : $enable_gtk2"
810 echo "                  Use pcap library : $want_pcap"
811 echo "                  Use zlib library : $zlib_message"
812 echo "          Use IPv6 name resolution : $enable_ipv6"
813 echo "     Use UCD SNMP/NET-SNMP library : $snmp_libs_message"