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