minix/external/bsd/libpcap/dist/pcap-config.in
David van Moolenbroek d56f51ea7d Import NetBSD libpcap
As part of this, we import bpf_filter.c from NetBSD.  Even though that
file is part of the NetBSD kernel, it is also used by userland (as is
clear here).  Our LWIP service has its own bpf_filter.c implementation
but that implementation has certain limits (e.g. on program size) that
are fine for a system service but should not apply to userland.

The libpcap code has a number of blocks guarded by __NetBSD__, but
none of those blocks apply to MINIX 3.  In particular, some of the
alignment logic used for NetBSD may in fact not work in our case.

Change-Id: Ib187e22d627c929e111d5d4a991c3bee3c0154cb
2017-03-21 22:00:18 +00:00

103 lines
1.8 KiB
Bash

#! /bin/sh
#
# Script to give the appropriate compiler flags and linker flags
# to use when building code that uses libpcap.
#
prefix="@prefix@"
exec_prefix="@exec_prefix@"
includedir="@includedir@"
libdir="@libdir@"
V_RPATH_OPT="@V_RPATH_OPT@"
LIBS="@LIBS@"
static=0
show_cflags=0
show_libs=0
while [ "$#" != 0 ]
do
case "$1" in
--static)
static=1
;;
--cflags)
show_cflags=1
;;
--libs)
show_libs=1
;;
--additional-libs)
show_additional_libs=1
;;
esac
shift
done
if [ "$V_RPATH_OPT" != "" ]
then
#
# If libdir isn't /usr/lib, add it to the run-time linker path.
#
if [ "$libdir" != "/usr/lib" ]
then
RPATH=$V_RPATH_OPT$libdir
fi
fi
if [ "@includedir@" != "/usr/include" ]
then
i="-I@includedir@"
fi
if [ "@libdir@" != "/usr/lib" ]
then
l="-L@libdir@"
fi
if [ -n "@LIBS@" ]
then
L="@LIBS@"
fi
if [ "$static" = 1 ]
then
#
# Include LIBS so that the flags include libraries containing
# routines that libpcap uses.
#
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
then
echo "-I$includedir -L$libdir -lpcap $LIBS"
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
then
echo "-I$includedir -L$libdir $LIBS"
elif [ "$show_cflags" = 1 ]
then
echo "-I$includedir"
elif [ "$show_libs" = 1 ]
then
echo "-L$libdir -lpcap $LIBS"
elif [ "$show_additional_libs" = 1 ]
then
echo "$LIBS"
fi
else
#
# Omit LIBS - libpcap is assumed to be linked with those
# libraries, so there's no need to do so explicitly.
#
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
then
echo "-I$includedir -L$libdir $RPATH -lpcap"
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
then
echo "-I$includedir"
elif [ "$show_cflags" = 1 ]
then
echo "-I$includedir"
elif [ "$show_libs" = 1 ]
then
echo "-L$libdir $RPATH -lpcap"
fi
fi