diff options
Diffstat (limited to 'pcap-config.in')
-rw-r--r-- | pcap-config.in | 82 |
1 files changed, 74 insertions, 8 deletions
diff --git a/pcap-config.in b/pcap-config.in index 19f21141ddf22..37526d7fed604 100644 --- a/pcap-config.in +++ b/pcap-config.in @@ -4,13 +4,79 @@ # Script to give the appropriate compiler flags and linker flags # to use when building code that uses libpcap. # -case "$1" in +static=0 +show_cflags=0 +show_libs=0 +while [ "$#" != 0 ] +do + case "$1" in ---cflags) - echo "-I @includedir@" - ;; + --static) + static=1 + ;; ---libs) - echo "-L @libdir@ -lpcap @DEPLIBS@" - ;; -esac + --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 [ "$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 |