dect
/
libpcap
Archived
13
0
Fork 0

Use config.status to generate pcap-config.

Rather than use a custom sed script to replace things in pcap-config,
use the already existing config.status script.  This keeps people from
having to update the Makefile.in every time they want to add a new var
to the file.

Also, clean up the pcap-config.in script a bit to set local vars at the
top of the file and then refer to those rather than replacing all things
through out.  This makes it easier to tweak on the fly as there is only
line to change rather than trying and figure out all the locations.

Reviewed-By: Guy Harris <guy@alum.mit.edu>
This commit is contained in:
Mike Frysinger 2010-11-30 16:06:14 -08:00 committed by Guy Harris
parent a092bafeee
commit 16f6b49c87
2 changed files with 20 additions and 17 deletions

View File

@ -490,11 +490,7 @@ bpf_filter.o: bpf_filter.c
# #
pcap-config: $(srcdir)/pcap-config.in pcap-config: $(srcdir)/pcap-config.in
@rm -f $@ $@.tmp @rm -f $@ $@.tmp
sed -e 's|@includedir[@]|$(includedir)|g' \ ./config.status --file=$@.tmp:$<
-e 's|@libdir[@]|$(libdir)|g' \
-e 's|@LIBS[@]|$(LIBS)|g' \
-e 's|@V_RPATH_OPT[@]|$(V_RPATH_OPT)|g' \
$(srcdir)/pcap-config.in >$@.tmp
mv $@.tmp $@ mv $@.tmp $@
chmod a+x $@ chmod a+x $@

View File

@ -4,6 +4,13 @@
# Script to give the appropriate compiler flags and linker flags # Script to give the appropriate compiler flags and linker flags
# to use when building code that uses libpcap. # 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 static=0
show_cflags=0 show_cflags=0
show_libs=0 show_libs=0
@ -29,14 +36,14 @@ do
esac esac
shift shift
done done
if [ "@V_RPATH_OPT@" != "" ] if [ "$V_RPATH_OPT" != "" ]
then then
# #
# If libdir isn't /usr/lib, add it to the run-time linker path. # If libdir isn't /usr/lib, add it to the run-time linker path.
# #
if [ "@libdir@" != "/usr/lib" ] if [ "$libdir" != "/usr/lib" ]
then then
RPATH=@V_RPATH_OPT@@libdir@ RPATH=$V_RPATH_OPT$libdir
fi fi
fi fi
if [ "$static" = 1 ] if [ "$static" = 1 ]
@ -47,19 +54,19 @@ then
# #
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
then then
echo "-I@includedir@ -L@libdir@ -lpcap @LIBS@" echo "-I$includedir -L$libdir -lpcap $LIBS"
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
then then
echo "-I@includedir@ -L@libdir@ @LIBS@" echo "-I$includedir -L$libdir $LIBS"
elif [ "$show_cflags" = 1 ] elif [ "$show_cflags" = 1 ]
then then
echo "-I@includedir@" echo "-I$includedir"
elif [ "$show_libs" = 1 ] elif [ "$show_libs" = 1 ]
then then
echo "-L@libdir@ -lpcap @LIBS@" echo "-L$libdir -lpcap $LIBS"
elif [ "$show_additional_libs" = 1 ] elif [ "$show_additional_libs" = 1 ]
then then
echo "@LIBS@" echo "$LIBS"
fi fi
else else
# #
@ -68,15 +75,15 @@ else
# #
if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
then then
echo "-I@includedir@ -L@libdir@ $RPATH -lpcap" echo "-I$includedir -L$libdir $RPATH -lpcap"
elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
then then
echo "-I@includedir@" echo "-I$includedir"
elif [ "$show_cflags" = 1 ] elif [ "$show_cflags" = 1 ]
then then
echo "-I@includedir@" echo "-I$includedir"
elif [ "$show_libs" = 1 ] elif [ "$show_libs" = 1 ]
then then
echo "-L@libdir@ $RPATH -lpcap" echo "-L$libdir $RPATH -lpcap"
fi fi
fi fi