1) local library, with a pcap-config;
2) local library, without a pcap-config;
3) installed library, with a pcap-config;
4) installed library, without a pcap-config.
If we have a local library, i.e. one in ../libpcap{whatever}, we:
add -I flags to the C compiler flags to point it at whatever
directories in ../libpcap{whatever};
add ../libpcap{whatever}/libpcap.a to $LIBS and:
if it has a pcap-config, we use it, with --additional-libraries,
to find the additional libraries with which we need to link;
otherwise, we do the usual OS-dependent hacks to try to figure
out with what additional flags we need to link;
and add them to $LIBS after libpcap.a.
If we have an installed library:
if it has a pcap-config we use it, with --cflags, to find what flags
to add to the C compiler flags, and use it, with --libs, to see what
flags to add to $LIBS;
if it doesn't have a pcap-config, we search for -lpcap and, if that
succeeds, we assume the headers are under /usr/local/include or
/usr/include, search for them there, and, if we don't find pcap.h
there, we look for it in a pcap subdirectory under there, and add
the appropriate -I flag to the C compiler flags, and then do the
usual OS-dependent hacks to try to figure out with what additional
flags we need to link.
While we're at it, we do the libdlpi check only on Solaris, as part of
"the usual OS-dependent hacks".