]>
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@"
21 echo "Usage: pcap-config [ --help ] [ --version ] [ --cflags ]"
22 echo " [ --libs | --additional-libs ]"
23 echo " [ --static | --static-pcap-only ]"
30 show_additional_libs
=0
52 show_additional_libs
=1
66 echo "pcap-config: Invalid command-line option $1 specified" 1>&2
75 # If we aren't installing in /usr, then provide a -L flag to let build
76 # processes find our library.
78 # (We must check $prefix, as $libdir isn't necessarily /usr/lib in this
79 # case - for example, Linux distributions for 64-bit platforms that
80 # also provide support for binaries for a 32-bit version of the
81 # platform may put the 64-bit libraries, the 32-bit libraries, or both
82 # in directories other than /usr/lib.)
84 if [ "$prefix" != "/usr" ]
91 # Include LIBS_STATIC so that the flags include libraries
92 # containing routines that libpcap uses, and libraries
93 # containing routines those libraries use, etc., so that a
94 # completely statically linked program - i.e., linked only with
95 # static libraries - will be linked with all necessary
98 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
100 echo "-I$includedir $LPATH -l@PACKAGE_NAME@ $LIBS_STATIC"
101 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
103 echo "-I$includedir $LPATH $LIBS_STATIC"
104 elif [ "$show_cflags" = 1 ]
107 elif [ "$show_libs" = 1 ]
109 echo "$LPATH -l@PACKAGE_NAME@ $LIBS_STATIC"
110 elif [ "$show_additional_libs" = 1 ]
114 elif [ "$static_pcap_only" = 1 ]
117 # Include LIBS so that the flags include libraries
118 # containing routines that libpcap uses, but not the libraries
119 # on which libpcap depends, so that an otherwise
120 # dynamically-linked program, linked statically only with
121 # libpcap - i.e., linked with a static libpcap and dynamic
122 # versions of other libraries - will be linked with all
123 # necessary libraries.
125 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
127 echo "-I$includedir $LPATH -l@PACKAGE_NAME@ $LIBS"
128 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
130 echo "-I$includedir $LPATH $LIBS"
131 elif [ "$show_cflags" = 1 ]
134 elif [ "$show_libs" = 1 ]
136 echo "$LPATH -l@PACKAGE_NAME@ $LIBS"
137 elif [ "$show_additional_libs" = 1 ]
143 # Don't included LIBS or LIBS_STATIC, for building a program
144 # with a dynamic libpcap; libpcap, being a dynamic library, will
145 # cause all of its dynamic-library dependencies to be pulled in
148 # Do, however, include RPATH, to make sure that, on platforms
149 # that require this, programs built with this version of
150 # libpcap can find it at run time.
152 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
154 echo "-I$includedir $LPATH @RPATH@ -l@PACKAGE_NAME@"
155 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
158 elif [ "$show_cflags" = 1 ]
161 elif [ "$show_libs" = 1 ]
163 echo "$LPATH @RPATH@ -l@PACKAGE_NAME@"