1 dnl Macros that test for specific features.
2 dnl This file is part of the Autoconf packaging for Ethereal.
3 dnl Copyright (C) 1998-2000 by Gerald Combs.
7 dnl This program is free software; you can redistribute it and/or modify
8 dnl it under the terms of the GNU General Public License as published by
9 dnl the Free Software Foundation; either version 2, or (at your option)
10 dnl any later version.
12 dnl This program is distributed in the hope that it will be useful,
13 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 dnl GNU General Public License for more details.
17 dnl You should have received a copy of the GNU General Public License
18 dnl along with this program; if not, write to the Free Software
19 dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 dnl As a special exception, the Free Software Foundation gives unlimited
23 dnl permission to copy, distribute and modify the configure scripts that
24 dnl are the output of Autoconf. You need not follow the terms of the GNU
25 dnl General Public License when using or distributing such scripts, even
26 dnl though portions of the text of Autoconf appear in them. The GNU
27 dnl General Public License (GPL) does govern all other use of the material
28 dnl that constitutes the Autoconf program.
30 dnl Certain portions of the Autoconf source text are designed to be copied
31 dnl (in certain cases, depending on the input) into the output of
32 dnl Autoconf. We call these the "data" portions. The rest of the Autoconf
33 dnl source text consists of comments plus executable code that decides which
34 dnl of the data portions to output in any given case. We call these
35 dnl comments and executable code the "non-data" portions. Autoconf never
36 dnl copies any of the non-data portions into its output.
38 dnl This special exception to the GPL applies to versions of Autoconf
39 dnl released by the Free Software Foundation. When you make and
40 dnl distribute a modified version of Autoconf, you may extend this special
41 dnl exception to the GPL to apply to your modified version as well, *unless*
42 dnl your modified version has the potential to copy into its output some
43 dnl of the text that was the non-data portion of the version that you started
44 dnl with. (In other words, unless your change moves or copies text from
45 dnl the non-data portions to the data portions.) If your modification has
46 dnl such potential, you must delete any notice of this special exception
47 dnl to the GPL from your modified version.
49 dnl Written by David MacKenzie, with help from
50 dnl Franc,ois Pinard, Karl Berry, Richard Pixley, Ian Lance Taylor,
51 dnl Roland McGrath, Noah Friedman, david d zuhn, and many others.
54 # AC_ETHEREAL_ADD_DASH_L
56 # Add to the variable specified as the first argument a "-L" flag for the
57 # directory specified as the second argument, and, on Solaris, add a
58 # "-R" flag for it as well.
60 # XXX - IRIX, and other OSes, may require some flag equivalent to
63 AC_DEFUN([AC_ETHEREAL_ADD_DASH_L],
74 # AC_ETHEREAL_STRUCT_SA_LEN
76 dnl AC_STRUCT_ST_BLKSIZE extracted from the file in question,
77 dnl "acspecific.m4" in GNU Autoconf 2.12, and turned into
78 dnl AC_ETHEREAL_STRUCT_SA_LEN, which checks if "struct sockaddr"
79 dnl has the 4.4BSD "sa_len" member, and defines HAVE_SA_LEN; that's
80 dnl what's in this file.
81 dnl Done by Guy Harris <guy@alum.mit.edu> on 1998-11-14.
83 dnl ### Checks for structure members
85 AC_DEFUN([AC_ETHEREAL_STRUCT_SA_LEN],
86 [AC_CACHE_CHECK([for sa_len in struct sockaddr], ac_cv_ethereal_struct_sa_len,
87 [AC_TRY_COMPILE([#include <sys/types.h>
88 #include <sys/socket.h>], [struct sockaddr s; s.sa_len;],
89 ac_cv_ethereal_struct_sa_len=yes, ac_cv_ethereal_struct_sa_len=no)])
90 if test $ac_cv_ethereal_struct_sa_len = yes; then
91 AC_DEFINE(HAVE_SA_LEN, 1, [Define if sa_len field exists in struct sockaddr])
97 dnl Check whether a given format can be used to print 64-bit integers
99 AC_DEFUN([AC_ETHEREAL_CHECK_64BIT_FORMAT],
101 AC_MSG_CHECKING([whether %$1x can be used to format 64-bit integers])
106 # ifdef HAVE_INTTYPES_H
107 #include <inttypes.h>
109 #include <glibconfig.h>
111 #include <sys/types.h>
117 sprintf(strbuf, "%016$1x", t << 32);
118 if (strcmp(strbuf, "0000000100000000") == 0)
126 AC_DEFINE(PRId64, "$1d", [Format for printing 64-bit signed decimal numbers])
127 AC_DEFINE(PRIo64, "$1o", [Format for printing 64-bit unsigned octal numbers])
128 AC_DEFINE(PRIx64, "$1x", [Format for printing 64-bit unsigned hexadecimal numbers])
129 AC_DEFINE(PRIu64, "$1u", [Format for printing 64-bit unsigned decimal numbers])
139 # AC_ETHEREAL_IPV6_STACK
141 # By Jun-ichiro "itojun" Hagino, <itojun@iijlab.net>
143 AC_DEFUN([AC_ETHEREAL_IPV6_STACK],
148 AC_MSG_CHECKING([ipv6 stack type])
149 for i in v6d toshiba kame inria zeta linux linux-glibc solaris8; do
153 #include </usr/local/v6/include/sys/types.h>
157 [v6type=$i; v6lib=v6;
158 v6libdir=/usr/local/v6/lib;
159 CFLAGS="-I/usr/local/v6/include $CFLAGS"])
163 #include <sys/param.h>
164 #ifdef _TOSHIBA_INET6
167 [v6type=$i; v6lib=inet6;
168 v6libdir=/usr/local/v6/lib;
169 CFLAGS="-DINET6 $CFLAGS"])
173 #include <netinet/in.h>
177 [v6type=$i; v6lib=inet6;
178 v6libdir=/usr/local/v6/lib;
179 CFLAGS="-DINET6 $CFLAGS"])
183 #include <netinet/in.h>
184 #ifdef IPV6_INRIA_VERSION
187 [v6type=$i; CFLAGS="-DINET6 $CFLAGS"])
191 #include <sys/param.h>
192 #ifdef _ZETA_MINAMI_INET6
195 [v6type=$i; v6lib=inet6;
196 v6libdir=/usr/local/v6/lib;
197 CFLAGS="-DINET6 $CFLAGS"])
200 if test -d /usr/inet6; then
204 CFLAGS="-DINET6 $CFLAGS"
209 #include <features.h>
210 #if defined(__GLIBC__) && defined(__GLIBC_MINOR__)
211 #if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 1) || __GLIBC__ > 2
215 [v6type=$i; v6lib=inet6; CFLAGS="-DINET6 $CFLAGS"])
218 if test "`uname -s`" = "SunOS" && test "`uname -r`" = "5.8"; then
221 [CFLAGS="-DINET6 -DSOLARIS8_INET6 $CFLAGS"]
225 if test "$v6type" != "unknown"; then
230 if test "$v6lib" != "none"; then
231 for dir in $v6libdir /usr/local/v6/lib /usr/local/lib; do
232 if test -d $dir -a -f $dir/lib$v6lib.a; then
233 LIBS="-L$dir $LIBS -l$v6lib"
241 AC_MSG_RESULT(["$v6type, $v6lib"])
245 # AC_ETHEREAL_GETHOSTBY_LIB_CHECK
247 # Checks whether we need "-lnsl" to get "gethostby*()", which we use
250 # Adapted from stuff in the AC_PATH_XTRA macro in "acspecific.m4" in
251 # GNU Autoconf 2.13; the comment came from there.
252 # Done by Guy Harris <guy@alum.mit.edu> on 2000-01-14.
254 AC_DEFUN([AC_ETHEREAL_GETHOSTBY_LIB_CHECK],
256 # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
257 # to get the SysV transport functions.
258 # chad@anasazi.com says the Pyramid MIS-ES running DC/OSx (SVR4)
260 # The nsl library prevents programs from opening the X display
261 # on Irix 5.2, according to dickey@clark.net.
262 AC_CHECK_FUNC(gethostbyname, ,
263 AC_CHECK_LIB(nsl, gethostbyname, NSL_LIBS="-lnsl"))
268 # AC_ETHEREAL_SOCKET_LIB_CHECK
270 # Checks whether we need "-lsocket" to get "socket()", which is used
271 # by libpcap on some platforms - and, in effect, "gethostby*()" on
272 # most if not all platforms (so that it can use NIS or DNS or...
273 # to look up host names).
275 # Adapted from stuff in the AC_PATH_XTRA macro in "acspecific.m4" in
276 # GNU Autoconf 2.13; the comment came from there.
277 # Done by Guy Harris <guy@alum.mit.edu> on 2000-01-14.
279 # We use "connect" because that's what AC_PATH_XTRA did.
281 AC_DEFUN([AC_ETHEREAL_SOCKET_LIB_CHECK],
283 # lieder@skyler.mavd.honeywell.com says without -lsocket,
284 # socket/setsockopt and other routines are undefined under SCO ODT
285 # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
286 # on later versions), says simon@lia.di.epfl.ch: it contains
287 # gethostby* variants that don't use the nameserver (or something).
288 # -lsocket must be given before -lnsl if both are needed.
289 # We assume that if connect needs -lnsl, so does gethostbyname.
290 AC_CHECK_FUNC(connect, ,
291 AC_CHECK_LIB(socket, connect, SOCKET_LIBS="-lsocket",
292 AC_MSG_ERROR(Function 'socket' not found.), $NSL_LIBS))
293 AC_SUBST(SOCKET_LIBS)
297 # AC_ETHEREAL_PCAP_CHECK
299 AC_DEFUN([AC_ETHEREAL_PCAP_CHECK],
301 if test -z "$pcap_dir"
304 # XXX need to set a var AC_CHECK_HEADER(pcap.h,,)
307 # The user didn't specify a directory in which libpcap resides;
308 # we assume that the current library search path will work,
309 # but we may have to look for the header in a "pcap"
310 # subdirectory of "/usr/include" or "/usr/local/include",
311 # as some systems apparently put "pcap.h" in a "pcap"
312 # subdirectory, and we also check "$prefix/include" - and
313 # "$prefix/include/pcap", in case $prefix is set to
314 # "/usr/include" or "/usr/local/include".
316 # XXX - should we just add "$prefix/include" to the include
317 # search path and "$prefix/lib" to the library search path?
319 AC_MSG_CHECKING(for extraneous pcap header directories)
321 pcap_dir_list="/usr/include/pcap $prefix/include/pcap $prefix/include"
322 if test "x$ac_cv_enable_usr_local" = "xyes" ; then
323 pcap_dir_list="$pcap_dir_list /usr/local/include/pcap"
325 for pcap_dir in $pcap_dir_list
327 if test -d $pcap_dir ; then
328 if test x$pcap_dir != x/usr/include -a x$pcap_dir != x/usr/local/include ; then
329 CFLAGS="$CFLAGS -I$pcap_dir"
330 CPPFLAGS="$CPPFLAGS -I$pcap_dir"
332 found_pcap_dir=" $found_pcap_dir -I$pcap_dir"
337 if test "$found_pcap_dir" != "" ; then
338 AC_MSG_RESULT(found --$found_pcap_dir added to CFLAGS)
340 AC_MSG_RESULT(not found)
344 # The user specified a directory in which libpcap resides,
345 # so add the "include" subdirectory of that directory to
346 # the include file search path and the "lib" subdirectory
347 # of that directory to the library search path.
349 # XXX - if there's also a libpcap in a directory that's
350 # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
351 # make us find the version in the specified directory,
352 # as the compiler and/or linker will search that other
353 # directory before it searches the specified directory.
355 CFLAGS="$CFLAGS -I$pcap_dir/include"
356 CPPFLAGS="$CPPFLAGS -I$pcap_dir/include"
357 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, $pcap_dir/lib)
361 AC_CHECK_HEADER(pcap.h,,
362 AC_MSG_ERROR([[Header file pcap.h not found; if you installed libpcap
363 from source, did you also do \"make install-incl\", and if you installed a
364 binary package of libpcap, is there also a developer's package of libpcap,
365 and did you also install that package?]]))
368 # Check to see if we find "pcap_open_live" in "-lpcap".
370 AC_CHECK_LIB(pcap, pcap_open_live,
373 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
375 AC_MSG_CHECKING([for pcap_open_live in -lpcap -lcfg -lodm])
377 LIBS="-lpcap -lcfg -lodm"
383 pcap_open_live(NULL, 0, 0, 0, NULL);
387 PCAP_LIBS="-lpcap -lcfg -lodm"
388 AC_DEFINE(HAVE_LIBPCAP, 1, [Define to use libpcap library])
392 AC_MSG_ERROR([Library libpcap not found.])
395 ], $SOCKET_LIBS $NSL_LIBS)
399 # Check whether various variables and functions are defined by
403 AC_MSG_CHECKING(whether pcap_version is defined by libpcap)
404 LIBS="$PCAP_LIBS $SOCKET_LIBS $NSL_LIBS $LIBS"
408 extern char *pcap_version;
411 printf ("%s\n", pcap_version);
413 ac_cv_pcap_version_defined=yes,
414 ac_cv_pcap_version_defined=no,
415 [echo $ac_n "cross compiling; assumed OK... $ac_c"])
416 if test "$ac_cv_pcap_version_defined" = yes ; then
418 AC_DEFINE(HAVE_PCAP_VERSION, 1, [Define if libpcap version is known])
422 AC_CHECK_FUNCS(pcap_open_dead)
424 # Later versions of Mac OS X 10.3[.x] ship a pcap.h that
425 # doesn't define pcap_if_t but ship an 0.8[.x] libpcap,
426 # so the library has "pcap_findalldevs()", but pcap.h
427 # doesn't define "pcap_if_t" so you can't actually *use*
428 # "pcap_findalldevs()".
430 # That even appears to be true of systems shipped with
431 # 10.3.4, so it doesn't appear only to be a case of
432 # Software Update not updating header files.
434 # (You can work around this by installing the 0.8 header
437 AC_CACHE_CHECK([whether pcap_findalldevs is present and usable],
438 [ac_cv_func_pcap_findalldevs],
447 pcap_if_t *devpointer;
450 pcap_findalldevs(&devpointer, errbuf);
455 ac_cv_func_pcap_findalldevs=yes
458 ac_cv_func_pcap_findalldevs=no
462 # Don't check for other new routines that showed up after
463 # "pcap_findalldevs()" if we don't have a usable
464 # "pcap_findalldevs()", so we don't end up using them if the
465 # "pcap.h" is crufty and old and doesn't declare them.
467 if test $ac_cv_func_pcap_findalldevs = "yes" ; then
468 AC_DEFINE(HAVE_PCAP_FINDALLDEVS, 1,
469 [Define to 1 if you have the `pcap_findalldevs' function and a pcap.h that declares pcap_if_t.])
470 AC_CHECK_FUNCS(pcap_datalink_val_to_name pcap_datalink_name_to_val)
471 AC_CHECK_FUNCS(pcap_list_datalinks pcap_set_datalink pcap_lib_version)
477 # AC_ETHEREAL_ZLIB_CHECK
479 AC_DEFUN([AC_ETHEREAL_ZLIB_CHECK],
481 if test "x$zlib_dir" != "x"
484 # The user specified a directory in which zlib resides,
485 # so add the "include" subdirectory of that directory to
486 # the include file search path and the "lib" subdirectory
487 # of that directory to the library search path.
489 # XXX - if there's also a zlib in a directory that's
490 # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
491 # make us find the version in the specified directory,
492 # as the compiler and/or linker will search that other
493 # directory before it searches the specified directory.
495 ethereal_save_CFLAGS="$CFLAGS"
496 CFLAGS="$CFLAGS -I$zlib_dir/include"
497 ethereal_save_CPPFLAGS="$CPPFLAGS"
498 CPPFLAGS="$CPPFLAGS -I$zlib_dir/include"
499 ethereal_save_LIBS="$LIBS"
500 AC_ETHEREAL_ADD_DASH_L(LIBS, $zlib_dir/lib)
504 # Make sure we have "zlib.h". If we don't, it means we probably
505 # don't have zlib, so don't use it.
507 AC_CHECK_HEADER(zlib.h,,
509 if test "x$zlib_dir" != "x"
512 # The user used "--with-zlib=" to specify a directory
513 # containing zlib, but we didn't find the header file
514 # there; that either means they didn't specify the
515 # right directory or are confused about whether zlib
516 # is, in fact, installed. Report the error and give up.
518 AC_MSG_ERROR([zlib header not found in directory specified in --with-zlib])
520 if test "x$want_zlib" = "xyes"
523 # The user tried to force us to use the library, but we
524 # couldn't find the header file; report an error.
526 AC_MSG_ERROR(Header file zlib.h not found.)
529 # We couldn't find the header file; don't use the
530 # library, as it's probably not present.
537 if test "x$want_zlib" != "xno"
540 # Well, we at least have the zlib header file.
542 # Check for "gzgets()" in zlib, because we need it, but
543 # some older versions of zlib don't have it. It appears
544 # from the zlib ChangeLog that any released version of zlib
545 # with "gzgets()" should have the other routines we
546 # depend on, such as "gzseek()", "gztell()", and "zError()".
548 # Another reason why we require "gzgets()" is that
549 # some versions of zlib that didn't have it, such
550 # as 1.0.8, had a bug in "gzseek()" that meant that it
551 # doesn't work correctly on uncompressed files; this
552 # means we cannot use version 1.0.8. (Unfortunately,
553 # that's the version that comes with recent X11 source,
554 # and many people who install XFree86 on their Slackware
555 # boxes don't realize that they should configure it to
556 # use the native zlib rather than building and installing
557 # the crappy old version that comes with XFree86.)
559 # I.e., we can't just avoid using "gzgets()", as
560 # versions of zlib without "gzgets()" are likely to have
561 # a broken "gzseek()".
563 AC_CHECK_LIB(z, gzgets,
565 if test "x$zlib_dir" != "x"
568 # Put the "-I" and "-L" flags for zlib at
569 # the beginning of CFLAGS, CPPFLAGS, and
573 AC_ETHEREAL_ADD_DASH_L(LIBS, $zlib_dir/lib)
574 LIBS="$LIBS -lz $ethereal_save_LIBS"
578 AC_DEFINE(HAVE_LIBZ, 1, [Define to use libz library])
580 if test "x$zlib_dir" != "x"
583 # Restore the versions of CFLAGS, CPPFLAGS,
584 # and LIBS before we added the "-with-zlib="
585 # directory, as we didn't actually find
586 # zlib there, or didn't find a zlib that
587 # contains gzgets there.
589 CFLAGS="$ethereal_save_CFLAGS"
590 CPPFLAGS="$ethereal_save_CPPFLAGS"
591 LIBS="$ethereal_save_LIBS"
597 if test "x$want_zlib" != "xno"
600 # Well, we at least have the zlib header file and a zlib
603 # Now check for "gzgets()" in zlib when linking with the
604 # linker flags for GTK+ applications; people often grab
605 # XFree86 source and build and install it on their systems,
606 # and they appear sometimes to misconfigure XFree86 so that,
607 # even on systems with zlib, it assumes there is no zlib,
608 # so the XFree86 build process builds and installs its
609 # own zlib in the X11 library directory.
611 # The XFree86 zlib is an older version that lacks
612 # "gzgets()", and that's the zlib with which Ethereal
613 # gets linked, so the build of Ethereal fails.
615 ac_save_CFLAGS="$CFLAGS"
617 CFLAGS="$CFLAGS $GTK_CFLAGS"
618 LIBS="$GTK_LIBS -lz $LIBS"
619 AC_MSG_CHECKING([for gzgets missing when linking with X11])
620 AC_TRY_LINK_FUNC(gzgets, AC_MSG_RESULT(no),
623 AC_MSG_ERROR(old zlib found when linking with X11 - get rid of old zlib.)
625 CFLAGS="$ac_save_CFLAGS"
631 # AC_ETHEREAL_LIBPCRE_CHECK
633 AC_DEFUN([AC_ETHEREAL_LIBPCRE_CHECK],
635 if test "x$pcre_dir" != "x"
638 # The user specified a directory in which libpcre resides,
639 # so add the "include" subdirectory of that directory to
640 # the include file search path and the "lib" subdirectory
641 # of that directory to the library search path.
643 # XXX - if there's also a libpcre in a directory that's
644 # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
645 # make us find the version in the specified directory,
646 # as the compiler and/or linker will search that other
647 # directory before it searches the specified directory.
649 ethereal_save_CFLAGS="$CFLAGS"
650 CFLAGS="$CFLAGS -I$pcre_dir/include"
651 ethereal_save_CPPFLAGS="$CPPFLAGS"
652 CPPFLAGS="$CPPFLAGS -I$pcre_dir/include"
653 ethereal_save_LIBS="$LIBS"
655 ethereal_save_LDFLAGS="$LDFLAGS"
656 LDFLAGS="$LDFLAGS -L$pcre_dir/lib"
660 # Make sure we have "pcre.h". If we don't, it means we probably
661 # don't have libpcre, so don't use it.
663 AC_CHECK_HEADER(pcre.h,,
665 if test "x$pcre_dir" != "x"
668 # The user used "--with-pcre=" to specify a directory
669 # containing libpcre, but we didn't find the header file
670 # there; that either means they didn't specify the
671 # right directory or are confused about whether libpcre
672 # is, in fact, installed. Report the error and give up.
674 AC_MSG_ERROR([libpcre header not found in directory specified in --with-pcre])
676 if test "x$want_pcre" = "xyes"
679 # The user tried to force us to use the library, but we
680 # couldn't find the header file; report an error.
682 AC_MSG_ERROR(Header file pcre.h not found.)
685 # We couldn't find the header file; don't use the
686 # library, as it's probably not present.
693 if test "x$want_pcre" != "xno"
696 # Well, we at least have the pcre header file.
698 # We're only using standard functions from libpcre,
699 # so we don't need to perform extra checks.
701 AC_CHECK_LIB(pcre, pcre_compile,
703 if test "x$pcre_dir" != "x"
706 # Put the "-I" and "-L" flags for pcre at
707 # the beginning of CFLAGS, CPPFLAGS,
710 PCRE_LIBS="-L$pcre_dir/lib -lpcre $ethereal_save_LIBS"
714 AC_DEFINE(HAVE_LIBPCRE, 1, [Define to use libpcre library])
716 if test "x$pcre_dir" != "x"
719 # Restore the versions of CFLAGS, CPPFLAGS,
720 # LDFLAGS, and LIBS before we added the
721 # "--with-pcre=" directory, as we didn't
722 # actually find pcre there.
724 CFLAGS="$ethereal_save_CFLAGS"
725 CPPFLAGS="$ethereal_save_CPPFLAGS"
726 LDFLAGS="$ethereal_save_LDFLAGS"
727 LIBS="$ethereal_save_LIBS"
737 # AC_ETHEREAL_UCDSNMP_CHECK
739 AC_DEFUN([AC_ETHEREAL_UCDSNMP_CHECK],
741 if test "x$ucdsnmp_dir" != "x"
744 # The user specified a directory in which UCD SNMP resides,
745 # so add the "include" subdirectory of that directory to
746 # the include file search path and the "lib" subdirectory
747 # of that directory to the library search path.
749 # XXX - if there's also a libpcap in a directory that's
750 # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
751 # make us find the version in the specified directory,
752 # as the compiler and/or linker will search that other
753 # directory before it searches the specified directory.
755 CFLAGS="$CFLAGS -I$ucdsnmp_dir/include"
756 CPPFLAGS="$CPPFLAGS -I$ucdsnmp_dir/include"
757 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, $ucdsnmp_dir/lib)
761 # Check for one of the UCD SNMP header files we include,
762 # to see whether we have UCD SNMP installed.
764 AC_CHECK_HEADER(ucd-snmp/ucd-snmp-config.h,
767 # UCD SNMP or Net-SNMP might require various helper
768 # libraries on various platforms, such as "-ldes425"
769 # in "/usr/kerberos/lib" on some versions of Red
770 # Hat Linux, or "-lkstat" on Solaris.
772 # It might also require "-lcrypto" on some platforms;
773 # if the user didn't specify --with-ssl, we check
774 # whether it would have made a difference and, if so,
775 # we tell the user that they needed to request it.
776 # (There are annoying licensing issues with it and
777 # GPL'ed code, so we don't include it by default.)
779 # XXX - autoconf really needs a way to test for
780 # a given routine in a given library *and* to test
781 # whether additional "-L"/"-R"/whatever flags are
782 # needed *before* the "-l" flag for the library
783 # and to test whether additional libraries are
784 # needed after the library *and* to cache all that
787 ethereal_save_LIBS="$LIBS"
788 found_sprint_realloc_objid=no
789 for extras in "" "-L/usr/kerberos/lib -ldes425" "-lkstat"
791 LIBS="-lsnmp $extras $SOCKET_LIBS $NSL_LIBS $SSL_LIBS"
794 AC_MSG_CHECKING([whether UCD SNMP includes sprint_realloc_objid])
796 AC_MSG_CHECKING([whether UCD SNMP includes sprint_realloc_objid (linking with $extras)])
802 sprint_realloc_objid();
806 # We found "sprint_realloc_objid()",
807 # and required the libraries in
811 SNMP_LIBS="-lsnmp $extras"; break;
812 found_sprint_realloc_objid=yes
817 # The link failed. If they didn't ask
818 # for SSL, try linking with -lcrypto
819 # as well, and if *that* succeeds,
820 # tell them they'll need to specify
824 if test "x$want_ssl" = "xno"
826 LIBS="$LIBS -lcrypto"
831 sprint_realloc_objid();
835 # It worked with -lcrypto; tell
836 # them they'll need to specify
839 AC_MSG_ERROR([UCD SNMP requires -lcrypto but --with-ssl not specified])
844 LIBS="$ethereal_save_LIBS"
847 # If we didn't find "sprint_realloc_objid()", fail.
848 # Either the user needs a newer version of UCD SNMP
849 # with "sprint_realloc_objid()", or they may need to
850 # specify "--with-ssl".
852 if test "$found_snmp_sprint_realloc_objid" = no; then
853 AC_MSG_ERROR([UCD SNMP header files found, but sprint_realloc_objid not found in SNMP library.])
857 # We found it, so we have UCD SNMP.
859 AC_DEFINE(HAVE_UCD_SNMP, 1, [Define to enable support for UCD-SNMP])
863 # No, we don't have it.
864 # If the user explicitly asked for UCD SNMP, fail,
865 # otherwise just don't use the UCD SNMP library.
867 if test "x$want_ucdsnmp" = "xyes" ; then
868 AC_MSG_ERROR(Header file ucd-snmp/snmp.h not found.)
874 # AC_ETHEREAL_RPM_CHECK
875 # Looks for the rpm program, and checks to see if we can redefine "_topdir".
877 AC_DEFUN([AC_ETHEREAL_RPM_CHECK],
879 AC_CHECK_PROG(ac_cv_ethereal_have_rpm, rpm, "yes", "no")
880 if test "x$ac_cv_ethereal_have_rpm" = "xyes"; then
881 rpm --define '_topdir /tmp' > /dev/null 2>&1
882 AC_MSG_CHECKING(to see if we can redefine _topdir)
883 if test $? -eq 0 ; then
887 AC_MSG_RESULT(no. You'll have to build packages manually.)
894 # AC_ETHEREAL_GNU_SED_CHECK
895 # Checks if GNU sed is the first sed in PATH.
897 AC_DEFUN([AC_ETHEREAL_GNU_SED_CHECK],
899 AC_MSG_CHECKING(for GNU sed as first sed in PATH)
900 if ( sh -c "sed --version" </dev/null 2> /dev/null | grep "GNU sed" 2>&1 > /dev/null ) ; then
910 # AC_ETHEREAL_ADNS_CHECK
912 AC_DEFUN([AC_ETHEREAL_ADNS_CHECK],
917 changequote(<<, >>)dnl
918 << --with-adns[=DIR] use GNU ADNS (located in directory DIR, if supplied). [default=yes, if present]>>,
921 if test "x$withval" = "xno"; then
923 elif test "x$withval" = "xyes"; then
925 elif test -d "$withval"; then
927 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, ${withval}/lib)
931 if test "x$want_adns" = "xdefaultyes"; then
934 if test -d "$withval"; then
935 AC_ETHEREAL_ADD_DASH_L(LDFLAGS, ${withval}/lib)
939 if test "x$want_adns" = "xyes"; then
940 AC_CHECK_LIB(adns, adns_init,
943 AC_DEFINE(HAVE_GNU_ADNS, 1, [Define to use GNU ADNS library])
945 ],, $SOCKET_LIBS $NSL_LIBS
948 AC_MSG_RESULT(not required)
954 # AC_ETHEREAL_KRB5_CHECK
956 AC_DEFUN([AC_ETHEREAL_KRB5_CHECK],
958 ethereal_save_CFLAGS="$CFLAGS"
959 ethereal_save_CPPFLAGS="$CPPFLAGS"
960 if test "x$krb5_dir" != "x"
963 # The user specified a directory in which kerberos resides,
964 # so add the "include" subdirectory of that directory to
965 # the include file search path and the "lib" subdirectory
966 # of that directory to the library search path.
968 # XXX - if there's also a kerberos in a directory that's
969 # already in CFLAGS, CPPFLAGS, or LDFLAGS, this won't
970 # make us find the version in the specified directory,
971 # as the compiler and/or linker will search that other
972 # directory before it searches the specified directory.
974 CFLAGS="$CFLAGS -I$krb5_dir/include"
975 CPPFLAGS="$CPPFLAGS -I$krb5_dir/include"
976 ac_heimdal_version=`grep heimdal $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*heimdal.*$/HEIMDAL/'`
977 ac_mit_version=`grep 'Massachusetts Institute of Technology' $krb5_dir/include/krb5.h | head -n 1 | sed 's/^.*Massachusetts Institute of Technology.*$/MIT/'`
978 ac_krb5_version="$ac_heimdal_version$ac_mit_version"
979 if test "x$ac_krb5_version" = "xHEIMDAL"
980 KRB5_LIBS="-L$krb5_dir/lib -lkrb5 -lasn1 $SSL_LIBS -lroken -lcrypt"
982 KRB5_LIBS="-L$krb5_dir/lib -lkrb5 -lk5crypto -lcom_err"
984 if test "x$ac_krb5_version" = "xMIT"
986 AC_DEFINE(HAVE_MIT_KERBEROS, 1, [Define to use MIT kerberos])
989 AC_PATH_PROG(KRB5_CONFIG, krb5-config)
990 if test -x "$KRB5_CONFIG"
992 KRB5_FLAGS=`"$KRB5_CONFIG" --cflags`
993 KRB5_LIBS=`"$KRB5_CONFIG" --libs`
994 CFLAGS="$CFLAGS $KRB5_FLAGS"
995 CPPFLAGS="$CPPFLAGS $KRB5_FLAGS"
997 # If -lcrypto is in KRB5_FLAGS, we require it to build
998 # with Heimdal/MIT. We don't want to built with it by
999 # default, due to annoying license incompatibilities
1000 # between the OpenSSL license and the GPL, so:
1002 # if SSL_LIBS is set to a non-empty string, we
1003 # remove -lcrypto from KRB5_LIBS and replace
1006 # if SSL_LIBS is not set to a non-empty string
1007 # we fail with an appropriate error message.
1009 case "$KRB5_LIBS" in
1011 if test ! -z "$SSL_LIBS"
1013 KRB5_LIBS=`echo $KRB5_LIBS | sed 's/-lcrypto//'`
1014 KRB5_LIBS="$KRB5_LIBS $SSL_LIBS"
1016 AC_MSG_ERROR([Kerberos library requires -lcrypto but --with-ssl not specified])
1020 ac_krb5_version=`"$KRB5_CONFIG" --version | head -n 1 | sed -e 's/^.*heimdal.*$/HEIMDAL/' -e 's/^Kerberos .*$/MIT/'`
1025 # Make sure we have "krb5.h". If we don't, it means we probably
1026 # don't have kerberos, so don't use it.
1028 AC_CHECK_HEADER(krb5.h,,
1030 if test "x$krb5_dir" != "x"
1033 # The user used "--with-krb5=" to specify a directory
1034 # containing kerberos, but we didn't find the header file
1035 # there; that either means they didn't specify the
1036 # right directory or are confused about whether kerberos
1037 # is, in fact, installed. Report the error and give up.
1039 AC_MSG_ERROR([kerberos header not found in directory specified in --with-krb5])
1041 if test "x$want_krb5" = "xyes"
1044 # The user tried to force us to use the library, but we
1045 # couldn't find the header file; report an error.
1047 AC_MSG_ERROR(Header file krb5.h not found.)
1050 # We couldn't find the header file; don't use the
1051 # library, as it's probably not present.
1054 AC_MSG_RESULT(No Heimdal or MIT header found - disabling dissection for some kerberos data in packet decoding)
1059 if test "x$want_krb5" != "xno"
1062 # Well, we at least have the krb5 header file.
1063 # Check whether this is Heimdal or MIT.
1065 AC_MSG_CHECKING(whether the Kerberos library is Heimdal or MIT)
1066 if test "x$ac_krb5_version" = "xHEIMDAL" -o "x$ac_krb5_version" = "xMIT"
1070 # Check whether we have krb5_kt_resolve - and whether
1071 # we need to link with -lresolv when linking with
1072 # the Kerberos library.
1074 AC_MSG_RESULT($ac_krb5_version)
1075 ethereal_save_LIBS="$LIBS"
1076 found_krb5_kt_resolve=no
1077 for extras in "" "-lresolv"
1079 LIBS="$KRB5_LIBS $extras"
1080 if test -z "$extras"
1082 AC_MSG_CHECKING([whether $ac_krb5_version includes krb5_kt_resolve])
1084 AC_MSG_CHECKING([whether $ac_krb5_version includes krb5_kt_resolve (linking with $extras)])
1094 # We found "krb5_kt_resolve()", and required
1095 # the libraries in extras as well.
1099 AC_DEFINE(HAVE_KERBEROS, 1, [Define to use kerberos])
1100 if test "x$ac_krb5_version" = "xHEIMDAL"
1102 AC_DEFINE(HAVE_HEIMDAL_KERBEROS, 1, [Define to use heimdal kerberos])
1104 if test "x$ac_krb5_version" = "xMIT"
1106 AC_DEFINE(HAVE_MIT_KERBEROS, 1, [Define to use MIT kerberos])
1108 found_krb5_kt_resolve=yes
1115 if test "$found_krb5_kt_resolve" = no
1118 # We didn't find "krb5_kt_resolve()" in the
1119 # Kerberos library, even when we tried linking
1120 # with -lresolv; we can't link with kerberos.
1122 if test "x$want_krb5" = "xyes"
1125 # The user tried to force us to use the library,
1126 # but we can't do so; report an error.
1128 AC_MSG_ERROR(Usable $ac_krb5_version not found)
1131 # Restore the versions of CFLAGS and CPPFLAGS
1132 # from before we added the flags for Kerberos.
1134 AC_MSG_RESULT(Usable $ac_krb5_version not found - disabling dissection for some kerberos data in packet decoding)
1135 CFLAGS="$ethereal_save_CFLAGS"
1136 CPPFLAGS="$ethereal_save_CPPFLAGS"
1141 LIBS="$ethereal_save_LIBS"
1144 # It's not Heimdal or MIT.
1147 if test "x$want_krb5" = "xyes"
1150 # The user tried to force us to use the library,
1151 # but we can't do so; report an error.
1153 AC_MSG_ERROR(Kerberos not found)
1156 # Restore the versions of CFLAGS and CPPFLAGS
1157 # from before we added the flags for Kerberos.
1159 AC_MSG_RESULT(Kerberos not found - disabling dissection for some kerberos data in packet decoding)
1160 CFLAGS="$ethereal_save_CFLAGS"
1161 CPPFLAGS="$ethereal_save_CPPFLAGS"
1168 # The user asked us not to use Kerberos, or they didn't
1169 # say whether they wanted us to use it but we found
1172 # Restore the versions of CFLAGS and CPPFLAGS
1173 # from before we added the flags for Kerberos.
1175 CFLAGS="$ethereal_save_CFLAGS"
1176 CPPFLAGS="$ethereal_save_CPPFLAGS"