File: pcap-config.in

package info (click to toggle)
libpcap 1.10.5-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,892 kB
  • sloc: ansic: 47,969; sh: 3,761; makefile: 1,078; lex: 690; python: 254; asm: 227
file content (146 lines) | stat: -rw-r--r-- 3,207 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#! /bin/sh

#
# Script to give the appropriate compiler flags and linker flags
# to use when building code that uses libpcap.
#
# These variables come from the configure script, so includedir and
# libdir may be defined in terms of prefix and exec_prefix, so the
# latter must be defined as well.
#
prefix="@prefix@"
exec_prefix="@exec_prefix@"
includedir="@includedir@"
LIBS="@LIBS@"
LIBS_STATIC="@LIBS_STATIC@"
VERSION="@PACKAGE_VERSION@"

usage()
{
	echo "Usage: pcap-config [ --help ] [ --version ] [ --cflags ]"
	echo "                   [ --libs | --additional-libs ]"
	echo "                   [ --static | --static-pcap-only ]"
}

static=0
static_pcap_only=0
show_cflags=0
show_libs=0
show_additional_libs=0
while [ "$#" != 0 ]
do
	case "$1" in

	--static)
		static=1
		;;

	--static-pcap-only)
		static_pcap_only=1
		;;

	--cflags)
		show_cflags=1
		;;

	--libs)
		show_libs=1
		;;

	--additional-libs)
		show_additional_libs=1
		;;

	-h|--help)
		usage
		exit 0
		;;

	--version)
		echo "$VERSION"
		exit 0
		;;

	*)
		echo "pcap-config: Invalid command-line option $1 specified" 1>&2
		usage 1>&2
		exit 1
		;;
	esac
	shift
done

if [ "$static" = 1 ]
then
	#
	# Include LIBS_STATIC so that the flags include libraries
	# containing routines that libpcap uses, and libraries
	# containing routines those libraries use, etc., so that a
	# completely statically linked program - i.e., linked only with
	# static libraries - will be linked with all necessary
	# libraries.
	#
	if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
	then
		echo "-I$includedir -l@PACKAGE_NAME@ $LIBS_STATIC"
	elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
	then
		echo "-I$includedir $LIBS_STATIC"
	elif [ "$show_cflags" = 1 ]
	then
		echo "-I$includedir"
	elif [ "$show_libs" = 1 ]
	then
		echo "-l@PACKAGE_NAME@ $LIBS_STATIC"
	elif [ "$show_additional_libs" = 1 ]
	then
		echo "$LIBS_STATIC"
	fi
elif [ "$static_pcap_only" = 1 ]
then
	#
	# Include LIBS so that the flags include libraries
	# containing routines that libpcap uses, but not the libraries
	# on which libpcap depends, so that an otherwise
	# dynamically-linked program, linked statically only with
	# libpcap - i.e., linked with a static libpcap and dynamic
	# versions of other libraries - will be linked with all
	# necessary libraries.
	#
	if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
	then
		echo "-I$includedir -l@PACKAGE_NAME@ $LIBS"
	elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
	then
		echo "-I$includedir $LIBS"
	elif [ "$show_cflags" = 1 ]
	then
		echo "-I$includedir"
	elif [ "$show_libs" = 1 ]
	then
		echo "-l@PACKAGE_NAME@ $LIBS"
	elif [ "$show_additional_libs" = 1 ]
	then
		echo "$LIBS"
	fi
else
	#
	# Don't included LIBS or LIBS_STATIC, for building a program
	# with a dynamic libpcap; libpcap, being a dynamic library, will
	# cause all of its dynamic-library dependencies to be pulled in
	# at run time.
	#
	if [ "$show_cflags" = 1 -a "$show_libs" = 1 ]
	then
		echo "-I$includedir -l@PACKAGE_NAME@"
	elif [ "$show_cflags" = 1 -a "$show_additional_libs" = 1 ]
	then
		echo "-I$includedir"
	elif [ "$show_cflags" = 1 ]
	then
		echo "-I$includedir"
	elif [ "$show_libs" = 1 ]
	then
		echo "-l@PACKAGE_NAME@"
	fi
fi