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