83 lines
1.5 KiB
Bash
Executable File
83 lines
1.5 KiB
Bash
Executable File
#! /bin/sh
|
|
|
|
#
|
|
# Script to give the appropriate compiler flags and linker flags
|
|
# to use when building code that uses libpcap.
|
|
#
|
|
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 [ "-Wl,-rpath," != "" ]
|
|
then
|
|
#
|
|
# If libdir isn't /usr/lib, add it to the run-time linker path.
|
|
#
|
|
if [ "/usr/local/lib" != "/usr/lib" ]
|
|
then
|
|
RPATH=-Wl,-rpath,/usr/local/lib
|
|
fi
|
|
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/usr/local/include -L/usr/local/lib -lpcap "
|
|
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
|
|
then
|
|
echo "-I/usr/local/include -L/usr/local/lib "
|
|
elif [ "$show_cflags" = 1 ]
|
|
then
|
|
echo "-I/usr/local/include"
|
|
elif [ "$show_libs" = 1 ]
|
|
then
|
|
echo "-L/usr/local/lib -lpcap "
|
|
elif [ "$show_additional_libs" = 1 ]
|
|
then
|
|
echo ""
|
|
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/usr/local/include -L/usr/local/lib $RPATH -lpcap"
|
|
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
|
|
then
|
|
echo "-I/usr/local/include"
|
|
elif [ "$show_cflags" = 1 ]
|
|
then
|
|
echo "-I/usr/local/include"
|
|
elif [ "$show_libs" = 1 ]
|
|
then
|
|
echo "-L/usr/local/lib $RPATH -lpcap"
|
|
fi
|
|
fi
|