Commit Graph

66 Commits

Author SHA1 Message Date
Guy Harris
599c6c53d1 Recognize -PRE-GIT as well as alpha/beta; clean up regexps a bit. 2010-02-08 16:28:42 -08:00
Guy Harris
16e7d6ed56 When removing conftest*, use "-r", to clean up OS X .dSYM turds. 2010-01-02 15:59:43 -08:00
Guy Harris
ebc9a33b11 Fix some problems that show up in autoconf 2.64 and later. 2010-01-02 15:29:06 -08:00
Guy Harris
ce952c7dc4 Get rid of some autoconf macros not used, or no longer used, with
tcpdump.

Check whether __attribute__((format)) can be applied to function
pointers and, if not, don't apply it to function pointers; some older
versions of GCC appear to support applying it to functions, but not
pointers to functions.

As we've gotten rid of missing/getaddrinfo.c, don't use it.
2009-07-08 01:22:27 -07:00
Guy Harris
706103b136 In AC_LBL_C_INIT, don't explicitly set V_CCOPT, just set $1, as is done
elsewhere in the macro.

For the Alpha C compiler, don't set -std1 unless it's necessary for ANSI
mode - we don't want to limit the compiler only to C89 features and,
more importantly, C89 headers (<inttypes.h> doesn't work, on at least
some versions of Digital UNIX and some C compiler versions, with -std1).
2009-07-04 17:57:01 -07:00
Guy Harris
9076e3c01a Add a comment to the AC_DEFINE call for const, just as we did for
libpcap; that eliminates the need to list it in acconfig.h, so get rid
of that.
2009-07-02 19:28:34 -07:00
Guy Harris
0491b33dc0 Expand another AC_DEFINE comment. 2009-07-02 19:01:20 -07:00
Guy Harris
4cf4925027 Pick up some AC_DEFINE comments from libpcap's aclocal.m4.
Remove unused items, and items for which we now have AC_DEFINE() calls
that supply a comment, from acconfig.h.

Note that a host OS that matches "osf*" is assumed to be DEC
OSF1/Digital UNIX/Tru64 UNIX.
2009-07-02 18:59:24 -07:00
Guy Harris
e6a083238b As with libpcap, so with tcpdump; when testing whether "inline" works,
use the V_CCOPT flags, because some of those might disable inlining;
otherwise, the test for inlining will succeed, but inlining won't work
with the options we're using when compiling.
2009-07-02 11:55:00 -07:00
Guy Harris
6b510e1a1b On AIX, if we have pcap-config, rely on it to supply the right extra
flags for linking with libpcap.
2009-06-16 00:21:06 -07:00
Guy Harris
018e7fe40d If we're using a local libpcap library, check for a local pcap-config
script and, if we find it, query it to see what additional libraries are
needed to link with that library.

If we're not, check for a system pcap-config script and, if we find it,
query it to see what C compiler flags and linker flags are needed to
build with that library.
2009-05-22 18:45:27 -07:00
Guy Harris
fbb3b4f6ef From Michael Riepe:
On e.g. an x86_64 Linux system, configure won't find libcrypto because
it's located in .../lib64.  As a temporal workaround, use the last part
of $libdir instead of "lib".  On the long run, AC_LBL_SSLEAY should
probably be rewritten.
2009-03-24 08:42:47 -07:00
guy
2fa88fe1a3 We support building tcpdump with versions of libpcap other than the one
with which it was released, and DLT_BLUETOOTH_HCI_H4_WITH_PHDR might be
defined by pcap-bpf.h without pcap/bluetooth.h being present (as appears
to be the case on Fedora 9, for example), so check whether
<pcap/bluetooth.h> is usable.

Update a comment - F9 appears to have a "/usr/include/pcap.h" if you
install the libpcap headers.

When adding -I flags when running a compiler-based test, add them to
CPPFLAGS, not CFLAGS - the latter doesn't work right with
AC_CHECK_HEADERS, as the "gcc -E" run doesn't have the -I flags added.
2008-09-25 21:45:50 +00:00
guy
5d375b6ca0 Have --with-crypto take an optional argument, specifying where libcrypto
can be found.  If --with-crypto is specified, and libcrypto isn't found,
fail, as presumably the user expected libcrypto to be available.
2008-02-26 20:47:12 +00:00
guy
d5744f5949 From Mike Frysinger: include the Blackfin processor as one of the
processors that don't support unaligned accesses.
2008-02-26 19:17:56 +00:00
guy
625ce5e12d Add -Wpointer-arith to the list of warnings we enable with GCC. 2005-11-08 02:59:40 +00:00
guy
e549a22820 Use pcap_dump_ftell() rather than casting a pcap_dumper_t * to a FILE *
and using ftell(); that won't necessarily work on Windows (if libpcap
was built with a different version of the C runtime library than tcpdump
is), and, even on UN*X, would break if a pcap_dumper_t * were ever made
something other than a FILE *.

Provide a pcap_dump_ftell() implementation that does that cheating cast
for use if libpcap doesn't have it (a pcap_dumper_t * is just a FILE *
on those older versions of libpcap).
2005-06-03 22:08:51 +00:00
guy
674ca18295 Fix to work with autoconf 2.59. 2005-06-03 21:36:41 +00:00
guy
d4290ae435 AC_TRY_COMPILE works only for code that fits inside "main()"; the test
for __attribute__ doesn't fit inside "main()" with GCC 4.0, as it
defines a function.
2005-04-21 03:50:29 +00:00
guy
d26090f659 Put back AC_LBL_C_INLINE; it turns out that wasn't the cause of the
inline problem, and AC_LBL_C_INLINE checks for a case that some versions
of the HP C compiler don't handle, and only uses inline if that case
succeeds.
2005-04-21 02:21:47 +00:00
guy
caf503e482 From Albert Chin:
1. aclocal.m4 patch required by Tru64 UNIX which has
     inttypes.h in a non-standard location so gcc cannot find
     the PRI types. So, use <sys/bitypes.h> to get u_int#_t
     types for help detecting %llx, etc.
  2. Help gcc on aix find ether_ntohost declaration.
2005-04-20 09:49:52 +00:00
guy
e1db53eeb7 From Albert Chin:
1. On AIX, AC_LBL_C_INLINE detected the compiler supported
     the inline keyword which is wrong. AC_C_INLINE from
     autoconf-2.59 worked.
  2. AC_CHECK_TYPE from autoconf-2.5x is no longer broken.
     Replaced AC_LBL_CHECK_TYPE with it, mainly to use
     <sys/bitypes.h> for Tru64 UNIX where some of the u_int#_t
     types are defined.
  3. Tru64 UNIX 4.0D doesn't support %llx; however, it does support %lx.
  4. Added <stdint.h> to interface.h for int#_t types on
     Tru64 UNIX 4.0D (required for missing/snprintf.c).
  5. Reworked includes in tcpdump-stdinc.h for int#_t types.
2005-04-20 09:44:30 +00:00
guy
b2eeaa3e02 When testing whether "inline" works, use the V_CCOPT flags, because some
of those might disable inlining; otherwise, the test for inlining will
succeed, but inlining won't work with the options we're using when
compiling.
2005-03-27 03:31:01 +00:00
guy
faf8160c18 Second stage of adding support for 64-bit integral data types - this
causes the configure script to attempt to define the PRI[doux]64 macros
if they're not defined by including <inttypes.h>, and causes
"missing/bittypes.h" to attempt to define them, if undefined, in a
fashion that should, with any luck, work on MSVC++ and various flavors
of GNU C on Windows.

Fix the spelling of "Mac OS X".
2004-04-17 08:44:49 +00:00
guy
1875b8ffe1 First stage of adding support for 64-bit integral data types - this
causes "int64_t" and "u_int64_t" to be defined by the configure script,
and causes "missing/bittypes.h" to attempt to define "u_int64_t" in a
fashion that should, with any luck, work on MSVC++ and various flavors
of GNU C on Windows.
2004-04-17 04:33:16 +00:00
guy
e4e20350aa AC_LIBOBJ takes the name of an object file without the extension (as the
extension is platform-dependent).
2004-01-31 05:26:50 +00:00
guy
b0aae8584b Autoconf 2.5x won't let you modify LIBOBJS directly; use AC_LIBOBJ to
modify it.

AC_LIBOBJ isn't supported by pre-2.50 autoconf; require 2.50.

2.5x apparently does quoting, or dnl, or something differently from
2.13; fix AC_EGREP_CPP calls.
2004-01-14 03:14:29 +00:00
guy
0cf35b497d Print both the name and the description of a link-layer type (the name
isn't always very suggestive - for example, somebody might think
"EN10MB" is always 10 MB/s, and might not know that "IEEE802" is Token
Ring), using "pcap_datalink_val_to_description()".  Supply our own
"pcap_datalink_val_to_description()" if libpcap doesn't have it (even if
it has "pcap_datalink_name_to_val()").
2003-11-18 23:09:42 +00:00
guy
2683dab266 From Brian Ginsbach: add the Cray NV1 CPU to the list of CPUs that don't
support unaligned accesses.
2003-11-16 09:44:20 +00:00
guy
bbc1cfa669 Have the configure script arrange that the Makefile define _U_
appropriately, and that GNUmakefile and the MSVC++ project file define
it apppriately, as we do with libpcap, rather than defining it in
"interface.h".

Undo the rcsid-shuffling and addition of extra #includes, as we no
longer need to arrange that "interface.h" be included before using _U_
in an RCS ID or copyright.
2003-11-16 09:36:07 +00:00
guy
8f34a01034 Check whether we have "pcap_breakloop()", and use it if we do - it's a
safer way to terminate "pcap_loop()" in a signal handler (it just sets a
flag, it doesn't muck with data structures that might have been in the
middle of being updated).

Have "setsignal()" not request SA_RESTART, so that if we call
"pcap_breakloop()" in a signal handler and then return, we don't restart
a call that was waiting for captured packets, we just make that call
EINTR out.
2003-11-04 07:29:15 +00:00
guy
e49c5476b9 Quote "$d" when testing it in "AC_LBL_LIBPCAP", so that if it's empty -
i.e., if no extraneous pcap header directory is found when using an
installed libpcap - we don't die.
2003-05-02 08:41:01 +00:00
guy
423dfbff62 "if ! {command}" works in the Almquist shell (as used by FreeBSD), and
is also documented to work in Bash, but is not documented to work in the
real Bourne shell, and doesn't appear to work in the real Bourne shell.
Don't use it.
2003-05-01 21:20:52 +00:00
guy
f3fa4cfd2d From Paul Mundt <lethal@linux-sh.org>: add SuperH to the list of CPUs
where we wire in the idea that it can't handle unaligned accesses.  (I
don't know why the test program doesn't work - but perhaps the test
program is the wrong answer anyway, as it doesn't work when
cross-compiling.)
2003-03-28 08:36:34 +00:00
guy
79dbf39ec6 Check for libpcap in directories under $srcdir, so that if you're
doing the compile in a directory other than the source directory, by
using the "--srcdir=" option, it finds libpcap if it's in a directory at
the same level as the tcpdump source directory or in a libpcap
subdirectory of that directory.
2003-03-13 08:04:25 +00:00
guy
b85e959f16 On AIX, we have to link with "-lodm" and "-lcfg", as libpcap now uses
routines from those libraries on AIX (in order to load the BPF driver
and create the BPF devices).
2003-02-12 10:17:08 +00:00
guy
9aa840d2d3 Use AC_CHECK_FUNC, not AC_CHECK_LIB, to look for
"pcap_list_datalinks()", "pcap_set_datalink()", and
"pcap_datalink_name_to_val()" in the version of libpcap we're using -
AC_CHECK_LIB can't check the local version, if that's what we're using,
but AC_CHECK_FUNC can (it just uses the current LIBS setting).
2003-01-11 20:51:41 +00:00
guy
6076158547 NetBSD support for multiple data link types on an interface, from David
Young <dyoung@ojctech.com>, with some minor changes by Jason R. Thorpe
<thorpej@netbsd.org>, and further changes by me to:

	use "-y" rather than "-D" to set the link type ("-D" was already
	taken);

	use libpcap APIs to map between data link type names and values;

	supply stub versions of missing-but-needed libpcap APIs.

Update Jason Thorpe's e-mail address (Zembu is going away, if it hasn't
done so already).
2002-12-19 09:27:54 +00:00
guy
c284d10cf4 If we're not using a local libpcap, check to see whether "pcap.h" is
hidden in a "pcap" subdirectory of "/usr/include" or
"/usr/local/include" and, if so, add a "-I" flag to search in that
subdirectory, so we manage to find "pcap.h", as Red Hat decided to
"improve" things by putting "pcap.h" in "/usr/include/pcap" (that's
probably where libpcap should have put it originally, but moving it now
just breaks source compatibility).
2002-12-17 09:55:14 +00:00
guy
c422d3ab0f Get rid of the "-Wno-unused" flag, and fix up most of the
unused-parameter problems reported by GCC.  Add an _U_ tag to label
parameters as unused if the function is called through a pointer (so
that you can't change its signature by removing parameters) or if there
are unused parameters only because the function isn't complete.

Add some additional bounds checks the necessity for which was revealed
while cleaning up unused-parameter problems.

Make some routines static.

"lcp_print()", defined in "print-lcp.c", isn't called anywhere -
"print-ppp.c" has the code to dissect LCP.  Get rid of "print-lcp.c".
2002-09-05 21:25:34 +00:00
guy
edb0e92cdc Add a few more GCC warnings on GCC >= 2 for ".devel" builds.
From Neil T. Spring: fixes for many of those warnings:

	addrtoname.c, configure.in: Linux needs netinet/ether.h for
	ether_ntohost

	print-*.c: change char *foo = "bar" to const char *foo = "bar"
	to appease -Wwrite-strings; should affect no run-time behavior.

	print-*.c: make some variables unsigned.

	print-bgp.c: plen ('prefix len') is unsigned, no reason to
	validate by comparing to zero.

	print-cnfp.c, print-rx.c: use intoa, provided by addrtoname,
	instead of inet_ntoa.

	print-domain.c: unsigned int l; (l=foo()) < 0 is guaranteed to
	be false, so check for (u_int)-1, which represents failure,
	explicitly.

	print-isakmp.c: complete initialization of attrmap objects.

	print-lwres.c: "if(x); print foo;" seemed much more likely to be
	intended to be "if(x) { print foo; }".

	print-smb.c: complete initialization of some structures.

In addition, add some fixes for the signed vs. unsigned comparison
warnings:

	extract.h: cast the result of the byte-extraction-and-combining,
	as, at least for the 16-bit version, C's integral promotions
	will turn "u_int16_t" into "int" if there are other "int"s
	nearby.

	print-*.c: make some more variables unsigned, or add casts to an
	unsigned type of signed values known not to be negative, or add
	casts to "int" of unsigned values known to fit in an "int", and
	make other changes needed to handle the aforementioned variables
	now being unsigned.

	print-isakmp.c: clean up the handling of error/status indicators
	in notify messages.

	print-ppp.c: get rid of a check that an unsigned quantity is >=
	0.

	print-radius.c: clean up some of the bounds checking.

	print-smb.c: extract the word count into a "u_int" to avoid the
	aforementioned problems with C's integral promotions.

	print-snmp.c: change a check that an unsigned variable is >= 0
	to a check that it's != 0.

Also, fix some formats to use "%u" rather than "%d" for unsigned
quantities.
2002-09-05 00:00:07 +00:00
guy
72898542e5 Explain why "AC_LBL_CHECK_LIB" isn't used any more. 2002-08-04 21:20:29 +00:00
guy
0431ce571f Note that "AC_LBL_CHECK_LIB" isn't used any more. 2002-08-03 22:32:36 +00:00
guy
03cfed6821 Make static the structure to which the test program checking what to use
for "inlines", so that we don't get tripped up by compilers complaining
that we're returning a pointer to an automatic variable.
2002-07-13 09:36:36 +00:00
guy
84dbd61af9 Fix up AC_LBL_C_INLINE to put all of the test code into the "inlines"
section - the other section gets stuck in the middle of "main()", and,
although GCC lets you define functions inside functions, other C
compilers don't.

Pick a name more likely to be unique to use as the iterator variable in
AC_LBL_C_INLINE.

Make AC_LBL_C_INLINE print "no" rather than "not supported" if inline
isn't supported, to match what AC_C_INLINE does.
2002-07-02 02:22:36 +00:00
guy
cb0c77819f Put variables in quotes when testing them in "test" commands, so that
the test doesn't get a syntax error if the variable isn't set or is set
to a null string.
2002-06-29 04:24:25 +00:00
guy
b1263c69c5 Some versions of the HP C compiler can handle inlines, but not if they
return a structure pointer.  Check whether the C compiler can handle
inline functions that return a structure pointer, not whether they can
handle inline functions that return an int, as at least some versions of
autoconf's AC_C_INLINE do.
2002-06-28 10:45:40 +00:00
guy
c51ad6a636 Nobody seemed to know why we preferred sigset() to sigaction(); the
latter is a POSIX standard, and you don't have to include some
additional header file to get it declared, so we'll prefer the it.
2002-04-24 06:34:18 +00:00
guy
ea54ca7605 Replace "target_cpu", "target_os", and AC_CANONICAL_SYSTEM with
"host_cpu", "host_os", and AC_CANONICAL_HOST, as per Maciej W.
Rozycki's patch.
2001-12-10 08:41:15 +00:00
guy
2566537526 From Maciej W. Rozycki <macro@ds2.pg.gda.pl>: treat all MIPS and SPARC
platforms as always requiring strict alignment, rather than doing
configure-time testing with a sample program.
2001-11-25 02:26:34 +00:00