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