]> The Tcpdump Group git mirrors - libpcap/blob - pcap-config.in
From Dustin Spicuzza:
[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 static=0
8 show_cflags=0
9 show_libs=0
10 while [ "$#" != 0 ]
11 do
12 case "$1" in
13
14 --static)
15 static=1
16 ;;
17
18 --cflags)
19 show_cflags=1
20 ;;
21
22 --libs)
23 show_libs=1
24 ;;
25
26 --additional-libs)
27 show_additional_libs=1
28 ;;
29 esac
30 shift
31 done
32 if [ "@V_RPATH_OPT@" != "" ]
33 then
34 #
35 # If libdir isn't /usr/lib, add it to the run-time linker path.
36 #
37 if [ "@libdir@" != "/usr/lib" ]
38 then
39 RPATH=@V_RPATH_OPT@@libdir@
40 fi
41 fi
42 if [ "$static" = 1 ]
43 then
44 #
45 # Include LIBS so that the flags include libraries containing
46 # routines that libpcap uses.
47 #
48 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
49 then
50 echo "-I@includedir@ -L@libdir@ -lpcap @LIBS@"
51 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
52 then
53 echo "-I@includedir@ -L@libdir@ @LIBS@"
54 elif [ "$show_cflags" = 1 ]
55 then
56 echo "-I@includedir@"
57 elif [ "$show_libs" = 1 ]
58 then
59 echo "-L@libdir@ -lpcap @LIBS@"
60 elif [ "$show_additional_libs" = 1 ]
61 then
62 echo "@LIBS@"
63 fi
64 else
65 #
66 # Omit LIBS - libpcap is assumed to be linked with those
67 # libraries, so there's no need to do so explicitly.
68 #
69 if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
70 then
71 echo "-I@includedir@ -L@libdir@ $RPATH -lpcap"
72 elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
73 then
74 echo "-I@includedir@"
75 elif [ "$show_cflags" = 1 ]
76 then
77 echo "-I@includedir@"
78 elif [ "$show_libs" = 1 ]
79 then
80 echo "-L@libdir@ $RPATH -lpcap"
81 fi
82 fi