]> The Tcpdump Group git mirrors - libpcap/blob - pcap-config.in
Fix building without protochain support. (GH #852)
[libpcap] / pcap-config.in
1 #! /bin/sh
2
3 #
4 # Script to give the appropriate compiler flags and linker flags
5 # to use when building code that uses libpcap.
6 #
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.
10 #
11 prefix="@prefix@"
12 exec_prefix="@exec_prefix@"
13 includedir="@includedir@"
14 libdir="@libdir@"
15 V_RPATH_OPT="@V_RPATH_OPT@"
16 LIBS="@LIBS@"
17 PACKAGE_NAME="@PACKAGE_NAME@"
18
19 static=0
20 show_cflags=0
21 show_libs=0
22 while [ "$#" != 0 ]
23 do
24 case "$1" in
25
26 --static)
27 static=1
28 ;;
29
30 --cflags)
31 show_cflags=1
32 ;;
33
34 --libs)
35 show_libs=1
36 ;;
37
38 --additional-libs)
39 show_additional_libs=1
40 ;;
41 esac
42 shift
43 done
44 #
45 # If libdir isn't /usr/lib, add it to the link-time linker path.
46 #
47 if [ "$libdir" != "/usr/lib" ]
48 then
49 LPATH=-L$libdir
50 fi
51 if [ "$V_RPATH_OPT" != "" ]
52 then
53 #
54 # If libdir isn't /usr/lib, add it to the run-time linker path.
55 #
56 if [ "$libdir" != "/usr/lib" ]
57 then
58 RPATH=$V_RPATH_OPT$libdir
59 fi
60 fi
61 if [ "$static" = 1 ]
62 then
63 #
64 # Include LIBS so that the flags include libraries containing
65 # routines that libpcap uses.
66 #
67 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
68 then
69 echo "-I$includedir $LPATH -lpcap $LIBS"
70 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
71 then
72 echo "-I$includedir $LPATH $LIBS"
73 elif [ "$show_cflags" = 1 ]
74 then
75 echo "-I$includedir"
76 elif [ "$show_libs" = 1 ]
77 then
78 echo "$LPATH -lpcap $LIBS"
79 elif [ "$show_additional_libs" = 1 ]
80 then
81 echo "$LIBS"
82 fi
83 else
84 #
85 # Omit LIBS - libpcap is assumed to be linked with those
86 # libraries, so there's no need to do so explicitly.
87 #
88 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
89 then
90 echo "-I$includedir $LPATH $RPATH -l$PACKAGE_NAME"
91 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
92 then
93 echo "-I$includedir"
94 elif [ "$show_cflags" = 1 ]
95 then
96 echo "-I$includedir"
97 elif [ "$show_libs" = 1 ]
98 then
99 echo "$LPATH $RPATH -l$PACKAGE_NAME"
100 fi
101 fi