From 4da1fd615902e1c1c302f5714025ccc184356dda Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Fri, 22 May 2009 16:04:25 -0700 Subject: [PATCH] Add a --additional-libs flag to pcap-config, to write out any additional libraries needed to link with libpcap; this is to be used by tcpdump when it's linking with ../libpcap/libpcap.a. --- pcap-config.1 | 15 +++++++++++++-- pcap-config.in | 13 +++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/pcap-config.1 b/pcap-config.1 index aa20d0c..021f450 100644 --- a/pcap-config.1 +++ b/pcap-config.1 @@ -30,7 +30,7 @@ pcap-config \- write libpcap compiler and linker flags to standard output .B \-\-static ] [ -.B \-\-cflags | \-\-libs +.B \-\-cflags | \-\-libs | \-\-additional-libs ] .ad .SH DESCRIPTION @@ -50,9 +50,20 @@ writes to the standard output the .B \-L and .B \-l -linker required to link with libpcap, including +linker flags required to link with libpcap, including .B \-l flags for libraries required by libpcap. +When run with the +.B \-\-additional-libs +option, +.I pcap-config +writes to the standard output the +.B \-L +and +.B \-l +flags for libraries required by libpcap, but not the +.B \-lpcap +flag to link with libpcap itself. .LP By default, it writes flags appropriate for compiling with a dynamically-linked version of libpcap; the diff --git a/pcap-config.in b/pcap-config.in index 16f4fcb..d30bf33 100644 --- a/pcap-config.in +++ b/pcap-config.in @@ -22,6 +22,10 @@ do --libs) show_libs=1 ;; + + --additional-libs) + show_additional_libs=1 + ;; esac shift done @@ -34,12 +38,18 @@ then if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] then echo "-I @includedir@ -L @libdir@ -lpcap @DEPLIBS@" + elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] + then + echo "-I @includedir@ -L @libdir@ @DEPLIBS@" elif [ "$show_cflags" = 1 ] then echo "-I @includedir@" elif [ "$show_libs" = 1 ] then echo "-L @libdir@ -lpcap @DEPLIBS@" + elif [ "$show_additional_libs" = 1 ] + then + echo "@DEPLIBS@" fi else # @@ -49,6 +59,9 @@ else if [ "$show_cflags" = 1 -a "$show_libs" = 1 ] then echo "-I @includedir@ -L @libdir@ -lpcap" + elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ] + then + echo "-I @includedir@" elif [ "$show_cflags" = 1 ] then echo "-I @includedir@"