diff options
author | Guy Harris <guy@alum.mit.edu> | 2017-12-30 14:16:15 -0800 |
---|---|---|
committer | Guy Harris <guy@alum.mit.edu> | 2017-12-30 14:16:15 -0800 |
commit | ebf3f194266cb41da20aaef7506daab4f9dbb6d8 (patch) | |
tree | 04409655e8e0ebe0008b6c836cf793055ee97c44 /configure.ac | |
parent | a1b2cce62e20f891d6d35e41ab8fedb156096bfd (diff) | |
download | tcpdump-ebf3f194266cb41da20aaef7506daab4f9dbb6d8.tar.gz |
Clean up handling of libdnet headers.
If we don't have dnet_htoa(), we don't need any of the headers. Check
for them only if we have dnet_htoa().
Use AC_CHECK_DECL to see if netdnet/dnetdb.h declares dnet_htoa().
Check for netdnet/dn.h and, if we have it, check whether it declares
struct dn_naddr; if so, include it, rather than defining the structure
ourselves.
Don't define union etheraddr ourselves; we only need to define an
etheraddr typedef. That avoids colliding with a libdnet header
definition of union etheraddr. (When we use etheraddr, we care about
what's on the wire, and we don't rely on system headers to tell us
what's on the wire.)
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 52 |
1 files changed, 39 insertions, 13 deletions
diff --git a/configure.ac b/configure.ac index af501dba..6c845c29 100644 --- a/configure.ac +++ b/configure.ac @@ -29,7 +29,7 @@ if test "$ac_cv___attribute__" = "yes"; then AC_C___ATTRIBUTE___FALLTHROUGH fi -AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h netdnet/dnetdb.h) +AC_CHECK_HEADERS(fcntl.h rpc/rpc.h rpc/rpcent.h) AC_CHECK_HEADERS(net/pfvar.h, , , [#include <sys/types.h> #include <sys/socket.h> #include <net/if.h>]) @@ -394,15 +394,44 @@ if test "$ipv6" = "yes" -a "$ipv6lib" != "none"; then fi fi -AC_CACHE_CHECK([for dnet_htoa declaration in netdnet/dnetdb.h], -[td_cv_decl_netdnet_dnetdb_h_dnet_htoa], -[AC_EGREP_HEADER(dnet_htoa, netdnet/dnetdb.h, - td_cv_decl_netdnet_dnetdb_h_dnet_htoa=yes, - td_cv_decl_netdnet_dnetdb_h_dnet_htoa=no)]) -if test "$td_cv_decl_netdnet_dnetdb_h_dnet_htoa" = yes; then - AC_DEFINE(HAVE_NETDNET_DNETDB_H_DNET_HTOA, 1, - [define if you have a dnet_htoa declaration in <netdnet/dnetdb.h>]) -fi +AC_SEARCH_LIBS(dnet_htoa, dnet, +[ + AC_DEFINE(HAVE_DNET_HTOA, 1, + [define if you have the dnet_htoa function]) + # + # OK, we have dnet_htoa(). Do we have netdnet/dnetdb.h? + # + AC_CHECK_HEADERS(netdnet/dnetdb.h) + if test "$ac_cv_header_netdnet_dnetdb_h" = "yes"; then + # + # Yes. Does it declare dnet_htoa()? + # + AC_CHECK_DECL(dnet_htoa, + [ + # Yes. + AC_DEFINE(NETDNET_DNETDB_H_DECLARES_DNET_HTOA,, + [Define to 1 if netenet/dnetdb.h declares `dnet_htoa']) + ],, + [ +AC_INCLUDES_DEFAULT +#include <netdnet/dnetdb.h> + ]) + fi + + # + # Do we have netdnet/dn.h? + # + AC_CHECK_HEADERS(netdnet/dn.h) + if test "$ac_cv_header_netdnet_dn_h" = "yes"; then + # + # Yes. Does it declare struct dn_naddr? + # + AC_CHECK_TYPES(struct dn_naddr,,, + [ +#include <netdnet/dn.h> + ]) + fi +]) AC_REPLACE_FUNCS(vfprintf strlcat strlcpy strdup strsep getservent getopt_long) AC_CHECK_FUNCS(fork vfork strftime) @@ -415,9 +444,6 @@ if test $needsnprintf = yes; then AC_LIBOBJ(snprintf) fi -AC_SEARCH_LIBS(dnet_htoa, dnet, - AC_DEFINE(HAVE_DNET_HTOA, 1, [define if you have the dnet_htoa function])) - AC_CHECK_LIB(rpc, main) dnl It's unclear why we might need -lrpc dnl Some platforms may need -lnsl for getrpcbynumber. |