]>
The Tcpdump Group git mirrors - libpcap/blob - pcap-config.in
4 # Script to give the appropriate compiler flags and linker flags
5 # to use when building code that uses libpcap.
7 # These variables come from the configure script, so includedir and
8 # libdir may be defined in terms of prefix and exec_prefix, so the
9 # latter must be defined as well.
12 exec_prefix
="@exec_prefix@"
13 includedir
="@includedir@"
16 LIBS_STATIC
="@LIBS_STATIC@"
17 VERSION
="@PACKAGE_VERSION@"
23 show_additional_libs
=0
45 show_additional_libs
=1
49 echo "Usage: pcap-config [ --help ] [--version] [ --static | --static-pcap-only ] [ --libs | --additional-libs ]"
59 echo "pcap-config: Invalid command-line option $1 specified" 1>&2
60 echo "Usage: pcap-config [ --help ] [ --static | --static-pcap-only ] [ --libs | --additional-libs ]" 1>&2
68 # If we aren't installing in /usr, then provide a -L flag to let build
69 # processes find our library.
71 # (We must check $prefix, as $libdir isn't necessarily /usr/lib in this
72 # case - for example, Linux distributions for 64-bit platforms that
73 # also provide support for binaries for a 32-bit version of the
74 # platform may put the 64-bit libraries, the 32-bit libraries, or both
75 # in directories other than /usr/lib.)
77 if [ "$prefix" != "/usr" ]
84 # Include LIBS_STATIC so that the flags include libraries
85 # containing routines that libpcap uses, and libraries
86 # containing routines those libraries use, etc., so that a
87 # completely statically linked program - i.e., linked only with
88 # static libraries - will be linked with all necessary
91 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
93 echo "-I$includedir $LPATH -l@PACKAGE_NAME@ $LIBS_STATIC"
94 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
96 echo "-I$includedir $LPATH $LIBS_STATIC"
97 elif [ "$show_cflags" = 1 ]
100 elif [ "$show_libs" = 1 ]
102 echo "$LPATH -l@PACKAGE_NAME@ $LIBS_STATIC"
103 elif [ "$show_additional_libs" = 1 ]
107 elif [ "$static_pcap_only" = 1 ]
110 # Include LIBS so that the flags include libraries
111 # containing routines that libpcap uses, but not the libraries
112 # on which libpcap depends, so that an otherwise
113 # dynamically-linked program, linked statically only with
114 # libpcap - i.e., linked with a static libpcap and dynamic
115 # versions of other libraries - will be linked with all
116 # necessary libraries.
118 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
120 echo "-I$includedir $LPATH -l@PACKAGE_NAME@ $LIBS"
121 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
123 echo "-I$includedir $LPATH $LIBS"
124 elif [ "$show_cflags" = 1 ]
127 elif [ "$show_libs" = 1 ]
129 echo "$LPATH -l@PACKAGE_NAME@ $LIBS"
130 elif [ "$show_additional_libs" = 1 ]
136 # Don't included LIBS or LIBS_STATIC, for building a program
137 # with a dynamic libpcap; libpcap, being a dynamic library, will
138 # cause all of its dynamic-library dependencies to be pulled in
141 # Do, however, include RPATH, to make sure that, on platforms
142 # that require this, programs built with this version of
143 # libpcap can find it at run time.
145 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
147 echo "-I$includedir $LPATH @RPATH@ -l@PACKAGE_NAME@"
148 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
151 elif [ "$show_cflags" = 1 ]
154 elif [ "$show_libs" = 1 ]
156 echo "$LPATH @RPATH@ -l@PACKAGE_NAME@"