From Lars Roland: add support for building a libethereal.dll with MSVC:
[obnox/wireshark/wip.git] / configure.in
1 # $Id: configure.in,v 1.258 2004/05/09 10:03:36 guy Exp $
2 #
3 AC_INIT(etypes.h)
4
5 AC_PREREQ(2.52)
6
7 dnl Check for CPU / vendor / OS
8 AC_CANONICAL_HOST
9 AC_CANONICAL_TARGET
10
11 AM_INIT_AUTOMAKE(ethereal, 0.10.3)
12
13 AM_DISABLE_STATIC
14
15 dnl Checks for programs.
16 AC_PROG_CC
17 AC_PROG_CPP
18 dnl Work around libtool bug (fixed in the version 1.5a?)
19 AC_DEFUN([AC_PROVIDE_AC_LIBTOOL_DLOPEN], )
20 AC_LIBTOOL_DLOPEN
21 AC_PROG_LIBTOOL
22 AC_PROG_YACC
23 AM_PROG_LEX
24 AC_PATH_PROG(PERL, perl)
25 AC_PATH_PROG(POD2MAN, pod2man)
26 if test "x$POD2MAN" = x
27 then
28         #
29         # The alternative is not to build the man pages....
30         #
31         AC_MSG_ERROR(I couldn't find pod2man; make sure it's installed and in your path)
32 fi
33 AC_PATH_PROG(LEX, flex)
34 AC_PATH_PROG(PYTHON, python)
35
36 AC_SUBST(PERL)
37 AC_SUBST(POD2MAN)
38 AC_SUBST(LEX)
39 AC_SUBST(FLEX_PATH)
40 AC_SUBST(PYTHON)
41
42 # Check for packaging utilities
43 # For now, we check to see if the various packaging utilites are in our
44 # path.  I'm too lazy to write code to go hunt for them.  -  Gerald
45 AC_CHECK_PROG(HAVE_PKGPROTO, pkgproto, "yes", "no")
46 AC_CHECK_PROG(HAVE_PKGMK, pkgmk, "yes", "no")
47 AC_CHECK_PROG(HAVE_PKGTRANS, pkgtrans, "yes", "no")
48
49 if test x$HAVE_PKGPROTO = xyes -a x$HAVE_PKGMK = xyes \
50      -a x$HAVE_PKGTRANS = xyes ; then
51   HAVE_SVR4_PACKAGING=yes
52 else
53   HAVE_SVR4_PACKAGING=no
54 fi
55 AC_SUBST(HAVE_SVR4_PACKAGING)
56
57 AC_ETHEREAL_RPM_CHECK
58 AC_SUBST(HAVE_RPM)
59
60 #
61 # If we're running gcc, add '-Wall -W' to CFLAGS, and add
62 # '-D_U_="__attribute__((unused))"' as well, so we can use _U_ to
63 # flag unused function arguments and not get warnings about them.
64 # If "--with-extra-gcc-checks" was specified, add "-Wcast-qual
65 # -Wcast-align" as well.  (Add more checks here in the future?)
66 #
67 # Otherwise, add '-D_U_=""', so that _U_ used to flag an unused function
68 # argument will compile with non-GCC compilers.
69 #
70 AC_ARG_WITH(extra-gcc-checks,
71 [  --with-extra-gcc-checks Do additional -W checks in GCC.  [default=no]],
72 [
73         if test $withval != no
74         then
75                 ethereal_extra_gcc_flags=" -Wcast-qual -Wcast-align -Wbad-function-cast -pedantic -Wstrict-prototypes"
76         fi
77 ],)
78 AC_MSG_CHECKING(to see if we can add '-Wall -W$ethereal_extra_gcc_flags' to CFLAGS)
79 if test x$GCC != x ; then
80   CFLAGS="-D_U_=\"__attribute__((unused))\" -Wall -W$ethereal_extra_gcc_flags $CFLAGS"
81   AC_MSG_RESULT(yes)
82 else
83   CFLAGS="-D_U_=\"\" $CFLAGS"
84   AC_MSG_RESULT(no)
85 fi
86
87 #
88 # Add any platform-specific compiler flags needed.
89 #
90 AC_MSG_CHECKING(for platform-specific compiler flags)
91 if test "x$GCC" = x
92 then
93         #
94         # Not GCC - assume it's the vendor's compiler.
95         #
96         case "$host_os" in
97         hpux*)
98                 #
99                 # HP's ANSI C compiler; flags suggested by Jost Martin.
100                 # "-Ae" for ANSI C plus extensions such as "long long".
101                 # "+O2", for optimization.  XXX - works with "-g"?
102                 #
103                 CFLAGS="-Ae +O2 $CFLAGS"
104                 AC_MSG_RESULT(HP ANSI C compiler - added -Ae +O2)
105                 ;;
106         darwin*)
107                 #
108                 # It may be called "cc", but it's really a GCC derivative
109                 # with a problematic special precompiler and precompiled
110                 # headers; turn off the special precompiler, as some
111                 # apparently-legal code won't compile with its precompiled
112                 # headers.
113                 #
114                 CFLAGS="-no-cpp-precomp $CFLAGS"
115                 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
116                 ;;
117         *)
118                 AC_MSG_RESULT(none needed)
119                 ;;
120         esac
121 else
122         case "$host_os" in
123         solaris*)
124                 # the X11 headers don't automatically include prototype info
125                 # and a lot don't include the return type
126                 CFLAGS="$CFLAGS -Wno-return-type -DFUNCPROTO=15"
127                 AC_MSG_RESULT(GCC on Solaris - added -Wno-return-type -DFUNCPROTO=15)
128                 ;;
129         darwin*)
130                 #
131                 # See comments above about Apple's lovely C compiler.
132                 #
133                 CFLAGS="-no-cpp-precomp $CFLAGS"
134                 AC_MSG_RESULT(Apple GCC - added -no-cpp-precomp)
135                 ;;
136         cygwin*)
137                 #
138                 # Shared libraries in cygwin/Win32 must never contain
139                 # undefined symbols.
140                 #
141                 LDFLAGS="$LDFLAGS -no-undefined"
142                 AC_MSG_RESULT(CygWin GCC - added -no-undefined to LDFLAGS)
143                 ;;
144         *)
145                 AC_MSG_RESULT(none needed)
146                 ;;
147         esac
148 fi
149
150 dnl Look in /usr/local for header files and libraries ?
151 dnl XXX FIXME don't include /usr/local if it is already in the system
152 dnl search path as this causes gcc 3.2 on Linux to complain about a change
153 dnl of the system search order for includes
154 AC_ARG_ENABLE(usr-local,
155 [  --enable-usr-local      look for headers and libs in /usr/local tree.  [default=yes]],ac_cv_enable_usr_local=$enableval,ac_cv_enable_usr_local=yes)
156
157 AC_MSG_CHECKING(whether to use /usr/local for headers and libraries)
158 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
159         AC_MSG_RESULT(yes)
160         #
161         # Arrange that we search for header files in the source directory
162         # and in its "wiretap" subdirectory, as well as in "/usr/local/include",
163         # as various packages we use ("libpcap", "zlib", an SNMP library)
164         # may have been installed under "/usr/local/include".
165         #
166         CFLAGS="$CFLAGS -I/usr/local/include"
167         CPPFLAGS="$CPPFLAGS -I/usr/local/include"
168
169         #
170         # Arrange that we search for libraries in "/usr/local/lib".
171         #
172         AC_ETHEREAL_ADD_DASH_L(LDFLAGS, /usr/local/lib)
173 else
174         AC_MSG_RESULT(no)
175 fi
176
177 #
178 # If we're running Solaris, and LD_LIBRARY_PATH is defined, add it as a
179 # link directory.
180 #
181 case "$host_os" in
182   solaris*)
183     AC_MSG_CHECKING(for LD_LIBRARY_PATH, since you appear to be running Solaris)
184     if test x$LD_LIBRARY_PATH != x ; then
185       LIBS="$LIBS -R$LD_LIBRARY_PATH"
186       AC_MSG_RESULT(yes -- added LD_LIBRARY_PATH to run-time linker path)
187     else
188       AC_MSG_RESULT(no -- this may be a problem in a few seconds)
189     fi
190   ;;
191 esac
192
193 #
194 # Check for versions of "sed" inadequate to handle, in libtool, a list
195 # of object files as large as the list in Ethereal.
196 #
197 # On Solaris, we check for "/bin/sed", "/usr/bin/sed", and "/usr/ucb/sed",
198 # as both "/usr/bin/sed" (which is also "/bin/sed", as "/bin" is just a
199 # symlink to "/usr/bin", but people may have "/bin" before "/usr/bin" in
200 # their search path) and "/usr/ucb/sed" are inadequate; "/usr/xpg4/bin/sed"
201 # is the only "sed" that comes with Solaris that can handle Ethereal.
202 #
203 # Add any checks here that are necessary for other OSes.
204 #
205 AC_ETHEREAL_GNU_SED_CHECK
206 if test "$HAVE_GNU_SED" = no ; then
207         case "$host_os" in
208         solaris*)
209                 AC_MSG_CHECKING(whether one of /usr/bin/sed or /bin/sed or /usr/ucb/sed will be used)
210                 case `which sed` in
211                         /bin/sed|/usr/bin/sed|/usr/ucb/sed)
212                         AC_MSG_RESULT(yes)              
213                         AC_MSG_ERROR([change your path to search /usr/xpg4/bin or directory containing GNU sed before /usr/bin (and /bin and /usr/ucb)])
214                         ;;
215
216                         *)
217                         AC_MSG_RESULT(no)
218                         ;;
219                 esac
220                 ;;
221
222         *)
223                 :
224                 ;;
225         esac
226 fi
227
228 # Enable/disable tethereal
229
230 AC_ARG_ENABLE(ethereal,
231 [  --enable-ethereal       build GTK+-based ethereal.  [default=yes]],enable_ethereal=$enableval,enable_ethereal=yes)
232
233 AC_ARG_ENABLE(gtk2,
234 [  --enable-gtk2           build Glib2/Gtk2+-based (t)ethereal.  [default=no]],enable_gtk2=$enableval,enable_gtk2=no)
235 AM_CONDITIONAL(USE_GTK2, test x$enable_gtk2 = xyes)
236
237 AC_ARG_ENABLE(threads,
238 [  --enable-threads        use threads in ethereal.  [default=no]],enable_threads=$enableval,enable_threads=no)
239 AM_CONDITIONAL(USE_THREADS, test x$enable_threads = xyes)
240
241 AC_ARG_ENABLE(profile-build,
242 [  --enable-profile-build  build profile-ready binaries.  [default=no]],enable_profile_build=$enableval,enable_profile_build=no)
243 AM_CONDITIONAL(USE_PROFILE_BUILD, test x$enable_profile_build = xyes)
244 AC_MSG_CHECKING(if profile builds must be generated)
245 if test "x$enable_profile_build" = "xyes" ; then
246         if test -n "$GCC" ; then
247                 AC_MSG_RESULT(yes)
248                 CFLAGS=" -pg $CFLAGS"
249         else
250                 AC_MSG_RESULT(no)
251                 echo "Building profile binaries currently only supported for GCC."
252         fi
253 else
254         AC_MSG_RESULT(no)
255 fi
256
257 # Create DATAFILE_DIR #define for config.h
258 datafiledir=$datadir/ethereal
259 datafiledir=`(
260     test "x$prefix" = xNONE && prefix=$ac_default_prefix
261     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
262     eval echo "$datafiledir"
263 )`
264 AC_DEFINE_UNQUOTED(DATAFILE_DIR,"$datafiledir", [Directory for data])
265
266 # GTK checks
267 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
268 # programs to be built with GTK+.
269 #
270 if test "x$enable_gtk2" = "xyes" -a "x$enable_ethereal" = "xyes" ; then
271         GTK_OK=two
272         AM_PATH_GTK_2_0(2.0.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no, gthread)
273 elif test "x$enable_gtk2" != "xyes" -a "x$enable_ethereal" = "xyes" ; then
274         GTK_OK=one
275         AM_PATH_GTK(1.2.0, CFLAGS="$CFLAGS $GTK_CFLAGS", GTK_OK=no )
276 else
277         GTK_OK=no
278 fi
279
280 # GLib checks
281 # This doesn't add GLIB_CFLAGS to CFLAGS, because AM_PATH_GTK will add
282 # GTK_CFLAGS to CFLAGS, and GTK_CFLAGS is a superset of CFLAGS.
283 # However, this means that both @GLIB_LIBS@ and @GTK_LIBS@ will be
284 # set when generating the Makefile, so we can make programs that require
285 # only GLib link with @GLIB_LIBS@ and make programs that require GTK+
286 # link with @GTK_LIBS@ (which includes @GLIB_LIBS@).
287 # We don't add $GLIB_LIBS to LIBS, because we don't want to force all
288 # programs to be built with GLib.
289 #
290 if test "$GTK_OK" = "no" ; then
291         enable_ethereal="no"
292         ethereal_bin=""
293         ethereal_man=""
294         # Honor GLIB_CFLAGS
295         if test "x$enable_gtk2" = "xyes" ; then
296                 AM_PATH_GLIB_2_0(2.0.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
297         else
298                 AM_PATH_GLIB(1.2.0, CFLAGS="$CFLAGS $GLIB_CFLAGS", AC_MSG_ERROR(GLib distribution not found.), gmodule)
299         fi
300 else
301         ethereal_bin="ethereal\$(EXEEXT)"
302         ethereal_man="ethereal.1"
303         ethereal_SUBDIRS="gtk"
304         # Honor GLIB_CFLAGS
305         if test "$GTK_OK" = "two" ; then
306                 AM_PATH_GLIB_2_0(2.0.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
307         else
308                 AM_PATH_GLIB(1.2.0, , AC_MSG_ERROR(GLib distribution not found.), gmodule)
309         fi
310 fi
311
312 #
313 # Check whether GLib modules are supported, to determine whether we
314 # can support plugins.
315 #
316 AC_MSG_CHECKING(whether GLib supports loadable modules)
317 ac_save_CFLAGS="$CFLAGS"
318 ac_save_LIBS="$LIBS"
319 CFLAGS="$CFLAGS $GLIB_CFLAGS"
320 LIBS="$GLIB_LIBS $LIBS"
321 AC_TRY_RUN([
322 #include <glib.h>
323 #include <gmodule.h>
324 #include <stdio.h>
325 #include <stdlib.h>
326
327 int 
328 main ()
329 {
330   if (g_module_supported())
331     return 0;   /* success */
332   else
333     return 1;   /* failure */
334 }
335 ], ac_cv_glib_supports_modules=yes, ac_cv_glib_supports_modules=no,
336    [echo $ac_n "cross compiling; assumed OK... $ac_c"])
337 CFLAGS="$ac_save_CFLAGS"
338 LIBS="$ac_save_LIBS"
339 if test "$ac_cv_glib_supports_modules" = yes ; then
340   AC_MSG_RESULT(yes)
341   have_plugins=yes
342 else
343   AC_MSG_RESULT(no)
344   have_plugins=no
345 fi
346
347
348 AC_SUBST(ethereal_bin)
349 AC_SUBST(ethereal_man)
350
351 rdps_bin="rdps\$(EXEEXT)"
352 AC_SUBST(rdps_bin)
353
354
355 # Enable/disable tethereal
356
357 AC_ARG_ENABLE(tethereal,
358 [  --enable-tethereal      build tethereal.  [default=yes]],tethereal=$enableval,enable_tethereal=yes)
359
360 if test "x$enable_tethereal" = "xyes" ; then
361         tethereal_bin="tethereal\$(EXEEXT)"
362         tethereal_man="tethereal.1"
363         etherealfilter_man="ethereal-filter.4"
364 else
365         tethereal_bin=""
366         tethereal_man=""
367 fi
368 AC_SUBST(tethereal_bin)
369 AC_SUBST(tethereal_man)
370 AC_SUBST(etherealfilter_man)
371
372
373
374 # Enable/disable editcap
375
376 AC_ARG_ENABLE(editcap,
377 [  --enable-editcap        build editcap.  [default=yes]],enable_editcap=$enableval,enable_editcap=yes)
378
379 if test "x$enable_editcap" = "xyes" ; then
380         editcap_bin="editcap\$(EXEEXT)"
381         editcap_man="editcap.1"
382 else
383         editcap_bin=""
384         editcap_man=""
385 fi
386 AC_SUBST(editcap_bin)
387 AC_SUBST(editcap_man)
388
389
390 # Enable/disable mergecap
391
392 AC_ARG_ENABLE(mergecap,
393 [  --enable-mergecap       build mergecap.  [default=yes]],enable_mergecap=$enableval,enable_mergecap=yes)
394
395 if test "x$enable_mergecap" = "xyes" ; then
396         mergecap_bin="mergecap\$(EXEEXT)"
397         mergecap_man="mergecap.1"
398 else
399         mergecap_bin=""
400         mergecap_man=""
401 fi
402 AC_SUBST(mergecap_bin)
403 AC_SUBST(mergecap_man)
404
405
406 # Enable/disable text2pcap
407
408 AC_ARG_ENABLE(text2pcap,
409 [  --enable-text2pcap      build text2pcap.  [default=yes]],text2pcap=$enableval,enable_text2pcap=yes)
410
411 if test "x$enable_text2pcap" = "xyes" ; then
412         text2pcap_bin="text2pcap\$(EXEEXT)"
413         text2pcap_man="text2pcap.1"
414 else
415         text2pcap_bin=""
416         text2pcap_man=""
417 fi
418 AC_SUBST(text2pcap_bin)
419 AC_SUBST(text2pcap_man)
420
421 # Enable/disable idl2eth
422
423 AC_ARG_ENABLE(idl2eth,
424 [  --enable-idl2eth        build idl2eth.  [default=yes]],enable_idl2eth=$enableval,enable_idl2eth=yes)
425
426 if test "x$enable_idl2eth" = "xyes" ; then
427         idl2eth_bin="idl2eth"
428         idl2eth_man="idl2eth.1"
429 else
430         idl2eth_bin=""
431         idl2eth_man=""
432 fi
433 AC_SUBST(idl2eth_bin)
434 AC_SUBST(idl2eth_man)
435
436
437 # Enable/disable dftest
438
439 AC_ARG_ENABLE(dftest,
440 [  --enable-dftest         build dftest.  [default=no]],enable_dftest=$enableval,enable_dftest=no)
441
442 if test "x$enable_dftest" = "xyes" ; then
443         dftest_bin="dftest\$(EXEEXT)"
444 else
445         dftest_bin=""
446 fi
447 AC_SUBST(dftest_bin)
448
449
450 # Enable/disable randpkt
451
452 AC_ARG_ENABLE(randpkt,
453 [  --enable-randpkt        build randpkt.  [default=no]],enable_randpkt=$enableval,enable_randpkt=no)
454
455 if test "x$enable_randpkt" = "xyes" ; then
456         randpkt_bin="randpkt\$(EXEEXT)"
457 else
458         randpkt_bin=""
459 fi
460 AC_SUBST(randpkt_bin)
461
462
463 dnl Checks for "gethostbyname()" - and "-lnsl", if we need it to get
464 dnl "gethostbyname()".
465 AC_ETHEREAL_GETHOSTBY_LIB_CHECK
466
467 dnl Checks for "connect()", used as a proxy for "socket()" - and
468 dnl "-lsocket", if we need it to get "connect()".
469 AC_ETHEREAL_SOCKET_LIB_CHECK
470
471 dnl pcap check
472 AC_MSG_CHECKING(whether to use libpcap for packet capture)
473
474 AC_ARG_WITH(pcap,
475 changequote(<<, >>)dnl
476 <<  --with-pcap[=DIR]       use libpcap for packet capturing.  [default=yes]>>,
477 changequote([, ])dnl
478 [
479         if test $withval = no
480         then
481                 want_pcap=no
482         elif test $withval = yes
483         then
484                 want_pcap=yes
485         else
486                 want_pcap=yes
487                 pcap_dir=$withval
488         fi
489 ],[
490         want_pcap=yes
491         pcap_dir=
492 ])
493 if test "x$want_pcap" = "xno" ; then
494         AC_MSG_RESULT(no)
495 else
496         AC_MSG_RESULT(yes)
497         AC_ETHEREAL_PCAP_CHECK
498 fi
499
500 dnl zlib check
501 AC_MSG_CHECKING(whether to use zlib for reading compressed capture files)
502
503 AC_ARG_WITH(zlib,
504 changequote(<<, >>)dnl
505 <<  --with-zlib[=DIR]       use zlib (located in directory DIR, if supplied) to read compressed data.  [default=yes, if present]>>,
506 changequote([, ])dnl
507 [
508         if test $withval = no
509         then
510                 want_zlib=no
511         elif test $withval = yes
512         then
513                 want_zlib=yes
514         else
515                 want_zlib=yes
516                 zlib_dir=$withval
517         fi
518 ],[
519         #
520         # Use zlib if it's present, otherwise don't.
521         #
522         want_zlib=ifpresent
523         zlib_dir=
524 ])
525 if test "x$want_zlib" = "xno" ; then
526         AC_MSG_RESULT(no)
527 else
528         AC_MSG_RESULT(yes)
529         AC_ETHEREAL_ZLIB_CHECK
530         if test "x$want_zlib" = "xno" ; then
531                 AC_MSG_RESULT(zlib not found - disabling compressed capture file support)
532         fi
533 fi
534
535
536 dnl pcre check
537 AC_MSG_CHECKING(whether to use libpcre for regular expressions in dfilters)
538
539 AC_ARG_WITH(pcre,
540 changequote(<<, >>)dnl
541 <<  --with-pcre[=DIR]       use libpcre (located in directory DIR, if supplied) to use in dfilter regular expressions.  [default=yes, if present]>>,
542 changequote([, ])dnl
543 [
544         if test $withval = no
545         then
546                 want_pcre=no
547         elif test $withval = yes
548         then
549                 want_pcre=yes
550         else
551                 want_pcre=yes
552                 pcre_dir=$withval
553         fi
554 ],[
555         #
556         # Use libpcre if it's present, otherwise don't.
557         #
558         want_pcre=ifpresent
559         pcre_dir=
560 ])
561 if test "x$want_pcre" = "xno" ; then
562         AC_MSG_RESULT(no)
563 else
564         AC_MSG_RESULT(yes)
565         AC_ETHEREAL_LIBPCRE_CHECK
566         if test "x$want_pcre" = "xno" ; then
567                 AC_MSG_RESULT(libpcre not found - disabling support for perl compatible regular expressions in dfilters)
568         fi
569 fi
570
571
572 dnl ipv6 check
573 AC_ARG_ENABLE(ipv6,
574 [  --enable-ipv6           use ipv6 name resolution, if available.  [default=yes]],enable_ipv6=$enableval,enable_ipv6=yes)
575
576 AC_MSG_CHECKING(whether to enable ipv6 name resolution if available)
577 if test "x$enable_ipv6" = "xno" ; then
578         AC_MSG_RESULT(no)
579 else
580         AC_MSG_RESULT(yes)
581         AC_ETHEREAL_IPV6_STACK
582 fi
583
584
585 dnl Check if ethereal should be installed setuid
586 AC_ARG_ENABLE(setuid-install,
587 [  --enable-setuid-install install ethereal as setuid. DANGEROUS!!! [default=no]],enable_setuid_install=$enableval,enable_setuid_install=no)
588
589 AC_MSG_CHECKING(whether to install ethereal setuid)
590 if test "x$enable_setuid_install" = "xno" ; then
591         AC_MSG_RESULT(no)
592 else
593         AC_MSG_RESULT(yes)
594 fi
595
596 AM_CONDITIONAL(SETUID_INSTALL, test x$enable_setuid_install = xyes)
597
598 dnl Checks for header files.
599 AC_HEADER_STDC
600 AC_CHECK_HEADERS(direct.h dirent.h fcntl.h netdb.h stdarg.h stddef.h unistd.h)
601 AC_CHECK_HEADERS(sys/ioctl.h sys/param.h sys/socket.h sys/sockio.h sys/stat.h sys/time.h sys/types.h sys/utsname.h sys/wait.h)
602 AC_CHECK_HEADERS(netinet/in.h)
603 AC_CHECK_HEADERS(arpa/inet.h arpa/nameser.h)
604 AC_CHECK_HEADERS(iconv.h)
605
606 dnl SSL Check
607 SSL_LIBS=''
608 AC_MSG_CHECKING(whether to use SSL library if available)
609 if test "x$enable_ssl" = "xno" ; then
610         AC_MSG_RESULT(no)
611 else
612         AC_MSG_RESULT(yes)
613         AC_ETHEREAL_SSL_CHECK
614 fi
615 AC_SUBST(SSL_LIBS)
616
617 dnl UCD SNMP/NET-SNMP Check
618 SNMP_LIBS=''
619
620 AC_ARG_WITH(net-snmp,
621 changequote(<<, >>)dnl
622 <<  --with-net-snmp=PATH    use NET-SNMP library, with PATH as the location of the net-snmp-config shell script that comes with the net-snmp package.>>,
623 changequote([, ])dnl
624 [netsnmpconfig=$withval]
625 )
626
627 AC_ARG_WITH(ucd-snmp,
628 changequote(<<, >>)dnl
629 <<  --with-ucd-snmp[=DIR]   use UCD SNMP client library (located in directory DIR, if supplied).  [default=yes, if present]>>,
630 changequote([, ])dnl
631 [
632         if test $withval = no
633         then
634                 want_ucdsnmp=no
635         elif test $withval = yes
636         then
637                 want_ucdsnmp=yes
638         else
639                 want_ucdsnmp=yes
640                 ucdsnmp_dir=$withval
641         fi
642 ],[
643         #
644         # Set "want_ucdsnmp" to "ifpresent" to make the default "use it
645         # if you find it, otherwise don't".
646         #
647         want_ucdsnmp=ifpresent
648         ucdsnmp_dir=
649 ])
650
651 dnl try net-snmp first
652 AC_MSG_CHECKING(whether to use NET-SNMP library if available)
653 if test "x$netsnmpconfig" != "xno" ; then
654         AC_MSG_RESULT(yes)
655         dnl get the net-snmp-config binary
656         if test "x$netsnmpconfig" = "xyes" -o "x$netsnmpconfig" = "x" ; then
657                 dnl search for it
658                 AC_PATH_PROG(NETSNMPCONFIG,net-snmp-config)
659         else
660                 NETSNMPCONFIG=$netsnmpconfig
661                 if test ! -x $NETSNMPCONFIG ; then
662                         AC_MSG_ERROR(Invalid net-snmp-config: $NETSNMPCONFIG)
663                 fi
664         fi
665 else
666         AC_MSG_RESULT(no)
667 fi
668
669 if test "x$NETSNMPCONFIG" != "xno" -a "x$NETSNMPCONFIG" != "x" -a -x "$NETSNMPCONFIG" ; then
670         dnl other choices for flags to use here: could also use
671         dnl --prefix or --exec-prefix if you don't want the full list.
672
673         #
674         # Save the current settings of CFLAGS and CPPFLAGS, and add
675         # the output of "$NETSNMPCONFIG --cflags" to it, so that when
676         # searching for the Net-SNMP headers, we look in whatever
677         # directory that output specifies.
678         #
679         ethereal_save_CFLAGS="$CFLAGS"
680         ethereal_save_CPPFLAGS="$CPPFLAGS"
681         CFLAGS="$CFLAGS `$NETSNMPCONFIG --cflags`"
682         CPPFLAGS="$CPPFLAGS `$NETSNMPCONFIG --cflags`"
683
684         AC_CHECK_HEADERS(net-snmp/net-snmp-config.h net-snmp/library/default_store.h)
685         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
686                 SNMP_LIBS=`$NETSNMPCONFIG --libs`
687                 AC_DEFINE(HAVE_NET_SNMP, 1, [Define to enable support for NET-SNMP])
688                 have_net_snmp="yes"
689         else
690                 # technically, we should retry ucd-snmp but it's
691                 # unlikely they have installed net-snmp-config and not
692                 # the net-snmp headers but do have the ucd-snmp
693                 # headers.  This would likely be a broken system to
694                 # try and use anyway.
695                 NETSNMPCONFIG="no"
696
697                 #
698                 # Restore the versions of CFLAGS and CPPFLAGS before
699                 # we added the output of '$NETSNMPCONFIG --cflags",
700                 # as we didn't actually find Net-SNMP there.
701                 #
702                 CFLAGS="$ethereal_save_CFLAGS"
703                 CPPFLAGS="$ethereal_save_CPPFLAGS"
704         fi      
705 else
706         AC_MSG_CHECKING(whether to use UCD SNMP library if available)
707         if test "x$want_ucdsnmp" = "xno" ; then
708                 AC_MSG_RESULT(no)
709         else
710                 AC_MSG_RESULT(yes)
711                 AC_ETHEREAL_UCDSNMP_CHECK
712         fi
713 fi
714
715 if test "x$have_net_snmp" = "xyes" || test "x$have_ucd_snmp" = "xyes"; then
716         AC_DEFINE(HAVE_SOME_SNMP, 1, [Define to if some SNMP support is to be used])
717 fi
718
719 AC_SUBST(SNMP_LIBS)
720
721
722 dnl kerberos/heimdal check
723 AC_MSG_CHECKING(whether to use kerberos/heimdal)
724
725 AC_ARG_WITH(krb5,
726 changequote(<<, >>)dnl
727 <<  --with-krb5[=DIR]       use kerberos/heimdal (located in directory DIR, if supplied) to use in kerberos dissection  [default=no]>>,
728 changequote([, ])dnl
729 [
730         if test $withval = no
731         then
732                 want_krb5=no
733         elif test $withval = yes
734         then
735                 want_krb5=yes
736         else
737                 want_krb5=no
738                 krb5_dir=$withval
739         fi
740 ],[
741         #
742         # Use kerberos/heimdal if it's present, otherwise don't.
743         #
744         want_krb5=no
745         krb5_dir=
746 ])
747 if test "x$want_krb5" = "xno" ; then
748         AC_MSG_RESULT(no)
749 else
750         AC_MSG_RESULT(yes)
751         AC_ETHEREAL_KRB5_CHECK
752         if test "x$want_krb5" = "xno" ; then
753                 AC_MSG_RESULT(heimdal not found - disabling dissection for some kerberos data in packet decoding)
754         fi
755 fi
756
757
758 dnl ADNS Check
759 ADNS_LIBS=''
760 AC_MSG_CHECKING(whether to use the GNU ADNS library if available)
761 if test "x$with_adns" = "xno" ; then
762         AC_MSG_RESULT(no)
763 else
764         AC_MSG_RESULT(yes)
765         AC_ETHEREAL_ADNS_CHECK
766 fi
767 AC_SUBST(ADNS_LIBS)
768
769 #
770 # Define ETH_VAR_IMPORT appropriately for declarations of external
771 # variables exported from dynamically-linked libraries.
772 #
773 AC_DEFINE(ETH_VAR_IMPORT, extern, [Define as the string to precede external variable declarations in dynamically-linked libraries])
774
775 dnl Checks for typedefs, structures, and compiler characteristics.
776 # AC_C_CONST
777
778 # We need to know whether "struct sockaddr" has an "sa_len" member
779 # for get_interface_list().
780
781 AC_ETHEREAL_STRUCT_SA_LEN
782
783 # We must know our byte order
784 AC_C_BIGENDIAN
785
786 # Checks whether "-traditional" is needed when using "ioctl".
787 # XXX - do we need this?
788 AC_PROG_GCC_TRADITIONAL
789
790 # If there's a system out there that has snprintf and _doesn't_ have vsnprintf,
791 # then this won't work.
792 SNPRINTF_C=""
793 SNPRINTF_O=""
794 AC_CHECK_FUNC(snprintf, SNPRINTF_O="",
795   [SNPRINTF_O="snprintf.o"
796    AC_DEFINE(NEED_SNPRINTF_H, 1, [Define if sprintf.h needs to be included])
797 ])
798 if test "$ac_cv_func_snprintf" = no ; then
799   SNPRINTF_C="snprintf.c"
800   SNPRINTF_O="snprintf.o"
801 fi
802 AC_SUBST(SNPRINTF_C)
803 AC_SUBST(SNPRINTF_O)
804
805 AC_CHECK_FUNC(strerror, STRERROR_O="",
806   [STRERROR_O="strerror.o"
807    AC_DEFINE(NEED_STRERROR_H, 1, [Define if strerror.h needs to be included])
808 ])
809 if test "$ac_cv_func_strerror" = no ; then
810   STRERROR_C="strerror.c"
811   STRERROR_O="strerror.o"
812 fi
813 AC_SUBST(STRERROR_C)
814 AC_SUBST(STRERROR_O)
815
816 AC_CHECK_FUNC(strcasecmp, STRCASECMP_O="",
817   STRCASECMP_O="strcasecmp.o")
818 if test "$ac_cv_func_strcasecmp" = no ; then
819   STRCASECMP_C="strcasecmp.c"
820   STRCASECMP_O="strcasecmp.o"
821 fi
822 AC_SUBST(STRCASECMP_C)
823 AC_SUBST(STRCASECMP_O)
824
825 AC_CHECK_FUNC(strncasecmp, STRNCASECMP_O="",
826   STRNCASECMP_O="strncasecmp.o")
827 if test "$ac_cv_func_strncasecmp" = no ; then
828   STRNCASECMP_C="strncasecmp.c"
829   STRNCASECMP_O="strncasecmp.o"
830 fi
831 AC_SUBST(STRNCASECMP_C)
832 AC_SUBST(STRNCASECMP_O)
833
834 AC_CHECK_FUNC(mkstemp, MKSTEMP_O="",
835   MKSTEMP_O="mkstemp.o")
836 if test "$ac_cv_func_mkstemp" = no ; then
837   MKSTEMP_C="mkstemp.c"
838   MKSTEMP_O="mkstemp.o"
839 fi
840 AC_SUBST(MKSTEMP_C)
841 AC_SUBST(MKSTEMP_O)
842
843 AC_CHECK_FUNC(inet_aton, INET_ATON_O="",
844   INET_ATON_O="inet_aton.lo")
845 if test "$ac_cv_func_inet_aton" = no ; then
846   INET_ATON_C="inet_aton.c"
847   INET_ATON_O="inet_aton.lo"
848   AC_DEFINE(NEED_INET_ATON_H, 1, [Define if inet/aton.h needs to be included])
849 fi
850 AC_SUBST(INET_ATON_C)
851 AC_SUBST(INET_ATON_O)
852
853 AC_SEARCH_LIBS(inet_pton, [socket nsl], [
854   dnl check for pre-BIND82 inet_pton() bug.
855   AC_MSG_CHECKING(for broken inet_pton)
856   AC_TRY_RUN([#include <sys/types.h>
857 #include <sys/socket.h>
858 #include <netinet/in.h>
859 #include <arpa/inet.h>
860 int main()
861 {
862 #ifdef AF_INET6
863   char buf[16];
864   /* this should return 0 (error) */
865   return inet_pton(AF_INET6, "0:1:2:3:4:5:6:7:", buf);
866 #else
867   return 1;
868 #endif
869 }], [AC_MSG_RESULT(ok);
870 have_inet_pton=yes], [AC_MSG_RESULT(broken);
871 have_inet_pton=no], [AC_MSG_RESULT(cross compiling, assume it is broken);
872 have_inet_pton=no])],
873 have_inet_pton=no)
874 if test "$have_inet_pton" = no; then
875   INET_PTON_C="inet_pton.c"
876   INET_PTON_O="inet_pton.lo"
877 else
878   INET_PTON_C=""
879   INET_PTON_O=""
880 fi
881 AC_SUBST(INET_PTON_C)
882 AC_SUBST(INET_PTON_O)
883
884 AC_SEARCH_LIBS(inet_ntop, [socket nsl], [
885   AC_MSG_CHECKING([for inet_ntop prototype])
886   AC_TRY_COMPILE([#include <stdio.h>
887 #include <sys/types.h>
888 #include <sys/socket.h>
889 #include <netinet/in.h>
890 #include <arpa/inet.h>
891
892 extern const char *inet_ntop(int, const void *, char *, size_t);],, [
893     AC_MSG_RESULT(yes)
894     AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
895     [Define if inet_ntop() prototype exists])], [
896     AC_TRY_COMPILE([#include <stdio.h>
897 #include <sys/types.h>
898 #include <sys/socket.h>
899 #include <netinet/in.h>
900 #include <arpa/inet.h>
901
902 extern const char *inet_ntop(int, const void *, char *, socklen_t);],, [
903       AC_MSG_RESULT(yes)
904       AC_DEFINE(HAVE_INET_NTOP_PROTO, 1,
905       [Define if inet_ntop() prototype exists])], [
906       AC_MSG_RESULT(no)])])
907   INET_NTOP_O=""], [
908   INET_NTOP_C="inet_ntop.c"
909   INET_NTOP_O="inet_ntop.lo"
910   AC_DEFINE(NEED_INET_V6DEFS_H, 1,
911   [Define if inet/v6defs.h needs to be included])])
912 AC_SUBST(INET_NTOP_C)
913 AC_SUBST(INET_NTOP_O)
914
915 AC_CHECK_FUNC(strptime, STRPTIME_O="",
916   [STRPTIME_O="strptime.o"
917    AC_DEFINE(NEED_STRPTIME_H, 1, [Define if strptime.h needs to be included])
918 ])
919 if test "$ac_cv_func_strptime" = no ; then
920   STRPTIME_C="strptime.c"
921   STRPTIME_O="strptime.o"
922 fi
923 AC_SUBST(STRPTIME_C)
924 AC_SUBST(STRPTIME_O)
925
926 AC_CHECK_FUNCS(getprotobynumber gethostbyname2)
927
928 dnl blank for now, but will be used in future
929 AC_SUBST(ethereal_SUBDIRS)
930
931 dnl
932 dnl check whether plugins should be enabled and, if they should be,
933 dnl check for plugins directory - stolen from Amanda's configure.in
934 dnl
935 plugindir="$libdir/ethereal/plugins/$VERSION"
936 AC_ARG_WITH(plugins,
937 changequote(<<, >>)dnl
938 <<  --with-plugins[=DIR]    support plugins (installed in DIR, if supplied).>>,
939 changequote([, ])dnl
940 [
941   case "$withval" in
942   "" | y | ye | yes )
943     if test x$have_plugins = xno
944     then
945       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
946     fi
947     ;;
948   n | no)
949     have_plugins=no
950     ;;
951   *)
952     if test x$have_plugins = xno
953     then
954       AC_MSG_ERROR([GLib on this platform doesn't support loadable modules, so you can't enable plugins.])
955     fi
956     plugindir="$withval"
957     ;;
958   esac
959 ])
960
961 AM_CONDITIONAL(HAVE_PLUGINS, test x$have_plugins = xyes)
962 if test x$have_plugins = xyes
963 then
964   AC_DEFINE(HAVE_PLUGINS, 1, [Define if plugins are enabled])
965   plugindir=`(
966     test "x$prefix" = xNONE && prefix=$ac_default_prefix
967     test "x$exec_prefix" = xNONE && exec_prefix=${prefix}
968     eval echo "$plugindir"
969   )`
970   AC_DEFINE_UNQUOTED(PLUGIN_DIR, "$plugindir", [Plugin installation directory])
971 else
972   AC_DEFINE(PLUGIN_DIR, NULL, [Plugin installation directory])
973 fi
974 AC_SUBST(plugindir)
975
976 #
977 # The plugin dissectors reside in ./plugins/PROTO/
978 #
979 PLUGIN_LIBS="-L../../epan -lethereal $GLIB_LIBS"
980 AC_SUBST(PLUGIN_LIBS)
981
982 dnl libtool defs
983 #
984 # Yes, AM_PROG_LIBTOOL is redundant with newer version(s) of some tool(s)
985 # (autoconf?  automake?  libtool?) - with the newer version(s), it's
986 # just an alias for AC_PROG_LIBTOOL, which is called earlier.
987 #
988 # With older version(s) of those tool(s), however, it's not just an
989 # alias, and the configure scripts don't work without it.
990 #
991 AM_PROG_LIBTOOL
992 AC_SUBST(LIBTOOL_DEPS)
993
994 AM_CONDITIONAL(ENABLE_STATIC, test x$enable_static = xyes)
995 if test x$enable_static = xyes -a x$have_plugins = xyes
996 then
997   AC_DEFINE(ENABLE_STATIC, 1, [Link plugins statically into Ethereal])
998 fi
999 AC_SUBST(ENABLE_STATIC)
1000
1001 dnl Save the cacheable configure results to config.cache before recursing
1002 AC_CACHE_SAVE
1003
1004 AM_CONFIG_HEADER(config.h)
1005 AC_CONFIG_SUBDIRS(wiretap)
1006 AC_OUTPUT(
1007   Makefile
1008   doc/Makefile
1009   epan/Makefile
1010   epan/dfilter/Makefile
1011   epan/ftypes/Makefile
1012   gtk/Makefile
1013   help/Makefile
1014   packaging/Makefile
1015   packaging/nsis/Makefile
1016   packaging/rpm/Makefile
1017   packaging/rpm/SPECS/Makefile
1018   packaging/rpm/SPECS/ethereal.spec
1019   packaging/svr4/Makefile
1020   packaging/svr4/checkinstall
1021   packaging/svr4/pkginfo
1022   plugins/Makefile
1023   plugins/acn/Makefile
1024   plugins/artnet/Makefile
1025   plugins/asn1/Makefile
1026   plugins/ciscosm/Makefile
1027   plugins/docsis/Makefile
1028   plugins/enttec/Makefile
1029   plugins/giop/Makefile
1030   plugins/gryphon/Makefile
1031   plugins/irda/Makefile
1032   plugins/lwres/Makefile
1033   plugins/megaco/Makefile
1034   plugins/mgcp/Makefile
1035   plugins/pcli/Makefile
1036   plugins/rdm/Makefile
1037   plugins/rlm/Makefile
1038   plugins/rtnet/Makefile
1039   plugins/rudp/Makefile
1040   plugins/v5ua/Makefile
1041   tools/Makefile
1042   tools/lemon/Makefile
1043   ,)
1044
1045
1046 # Pretty messages
1047
1048 if test "x$enable_setuid_install" = "xyes" ; then
1049         setuid_message="yes (DANGEROUS!!!)"
1050 else
1051         setuid_message="no"
1052 fi
1053
1054 if test "x$want_zlib" = "xno" ; then
1055         zlib_message="no"
1056 else
1057         zlib_message="yes"
1058 fi
1059
1060 if test "x$want_pcre" = "xno" ; then
1061         pcre_message="no"
1062 else
1063         pcre_message="yes"
1064 fi
1065
1066 if test "x$want_krb5" = "xno" ; then
1067         krb5_message="no"
1068 else
1069         krb5_message="yes (heimdal)"
1070 fi
1071
1072 if test "x$have_good_adns" = "xyes" ; then
1073         adns_message="yes"
1074 else
1075         adns_message="no"
1076 fi
1077
1078 if test "x$NETSNMPCONFIG" != "xno" -a "x$NETSNMPCONFIG" != "x" -a -x "$NETSNMPCONFIG" ; then
1079         snmp_libs_message="yes (net-snmp)"
1080 elif test "x$SNMP_LIBS" = "x" ; then
1081         snmp_libs_message="no"
1082 else
1083         snmp_libs_message="yes (ucd-snmp)"
1084 fi
1085
1086 echo ""
1087 echo "The Ethereal package has been configured with the following options."
1088 echo "                    Build ethereal : $enable_ethereal"
1089 echo "                   Build tethereal : $enable_tethereal"
1090 echo "                     Build editcap : $enable_editcap"
1091 echo "                    Build mergecap : $enable_mergecap"
1092 echo "                   Build text2pcap : $enable_text2pcap"
1093 echo "                     Build idl2eth : $enable_idl2eth"
1094 echo "                     Build randpkt : $enable_randpkt"
1095 echo "                      Build dftest : $enable_dftest"
1096 echo ""
1097 echo "                    Install setuid : $setuid_message"
1098 echo "                       Use plugins : $have_plugins"
1099 echo "               Use GTK+ v2 library : $enable_gtk2"
1100 if test "x$enable_gtk2" = "xyes" ; then
1101 echo "                       Use threads : $enable_threads"
1102 echo "            Build profile binaries : $enable_profile_build"
1103 fi
1104 echo "                  Use pcap library : $want_pcap"
1105 echo "                  Use zlib library : $zlib_message"
1106 echo "                  Use pcre library : $pcre_message"
1107 echo "              Use kerberos library : $krb5_message"
1108 echo "              Use GNU ADNS library : $adns_message"
1109 echo "          Use IPv6 name resolution : $enable_ipv6"
1110 echo "     Use UCD SNMP/NET-SNMP library : $snmp_libs_message"