2008-09-23 18:04:01 +00:00
|
|
|
#! /bin/sh
|
|
|
|
|
|
|
|
#
|
|
|
|
# Script to give the appropriate compiler flags and linker flags
|
|
|
|
# to use when building code that uses libpcap.
|
|
|
|
#
|
2009-03-27 07:41:53 +00:00
|
|
|
static=0
|
|
|
|
show_cflags=0
|
|
|
|
show_libs=0
|
|
|
|
while [ "$#" != 0 ]
|
|
|
|
do
|
|
|
|
case "$1" in
|
2008-09-23 18:04:01 +00:00
|
|
|
|
2009-03-27 07:41:53 +00:00
|
|
|
--static)
|
|
|
|
static=1
|
|
|
|
;;
|
2008-09-23 18:04:01 +00:00
|
|
|
|
2009-03-27 07:41:53 +00:00
|
|
|
--cflags)
|
|
|
|
show_cflags=1
|
|
|
|
;;
|
|
|
|
|
|
|
|
--libs)
|
|
|
|
show_libs=1
|
|
|
|
;;
|
2009-05-22 23:04:25 +00:00
|
|
|
|
|
|
|
--additional-libs)
|
|
|
|
show_additional_libs=1
|
|
|
|
;;
|
2009-03-27 07:41:53 +00:00
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|
2009-06-09 17:50:31 +00:00
|
|
|
if [ "@V_RPATH_OPT@" != "" ]
|
|
|
|
then
|
|
|
|
#
|
|
|
|
# If libdir isn't /usr/lib, add it to the run-time linker path.
|
|
|
|
#
|
2009-06-09 17:56:41 +00:00
|
|
|
if [ "@libdir@" != "/usr/lib" ]
|
2009-06-09 17:50:31 +00:00
|
|
|
then
|
|
|
|
RPATH=@V_RPATH_OPT@@libdir@
|
|
|
|
fi
|
|
|
|
fi
|
2009-03-27 07:41:53 +00:00
|
|
|
if [ "$static" = 1 ]
|
|
|
|
then
|
|
|
|
#
|
2009-05-22 23:14:08 +00:00
|
|
|
# Include LIBS so that the flags include libraries containing
|
2009-03-27 07:41:53 +00:00
|
|
|
# routines that libpcap uses.
|
|
|
|
#
|
|
|
|
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
|
|
|
|
then
|
2009-06-08 00:54:01 +00:00
|
|
|
echo "-I@includedir@ -L@libdir@ -lpcap @LIBS@"
|
2009-05-22 23:04:25 +00:00
|
|
|
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
|
|
|
|
then
|
2009-06-08 00:54:01 +00:00
|
|
|
echo "-I@includedir@ -L@libdir@ @LIBS@"
|
2009-03-27 07:41:53 +00:00
|
|
|
elif [ "$show_cflags" = 1 ]
|
|
|
|
then
|
2009-06-08 00:54:01 +00:00
|
|
|
echo "-I@includedir@"
|
2009-03-27 07:41:53 +00:00
|
|
|
elif [ "$show_libs" = 1 ]
|
|
|
|
then
|
2009-06-08 00:54:01 +00:00
|
|
|
echo "-L@libdir@ -lpcap @LIBS@"
|
2009-05-22 23:04:25 +00:00
|
|
|
elif [ "$show_additional_libs" = 1 ]
|
|
|
|
then
|
2009-05-22 23:14:08 +00:00
|
|
|
echo "@LIBS@"
|
2009-03-27 07:41:53 +00:00
|
|
|
fi
|
|
|
|
else
|
|
|
|
#
|
2009-05-22 23:14:08 +00:00
|
|
|
# Omit LIBS - libpcap is assumed to be linked with those
|
2009-03-27 07:41:53 +00:00
|
|
|
# libraries, so there's no need to do so explicitly.
|
|
|
|
#
|
|
|
|
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
|
|
|
|
then
|
2009-06-09 17:50:31 +00:00
|
|
|
echo "-I@includedir@ -L@libdir@ $RPATH -lpcap"
|
2009-05-22 23:04:25 +00:00
|
|
|
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
|
|
|
|
then
|
2009-06-08 00:54:01 +00:00
|
|
|
echo "-I@includedir@"
|
2009-03-27 07:41:53 +00:00
|
|
|
elif [ "$show_cflags" = 1 ]
|
|
|
|
then
|
2009-06-08 00:54:01 +00:00
|
|
|
echo "-I@includedir@"
|
2009-03-27 07:41:53 +00:00
|
|
|
elif [ "$show_libs" = 1 ]
|
|
|
|
then
|
2009-06-09 17:50:31 +00:00
|
|
|
echo "-L@libdir@ $RPATH -lpcap"
|
2009-03-27 07:41:53 +00:00
|
|
|
fi
|
|
|
|
fi
|