xref: /freebsd/contrib/libpcap/pcap-config.in (revision 01ded8b942effbbb4d9225c4227f264e499e9698)
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#
7static=0
8show_cflags=0
9show_libs=0
10while [ "$#" != 0 ]
11do
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
31done
32if [ "@V_RPATH_OPT@" != "" ]
33then
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
41fi
42if [ "$static" = 1 ]
43then
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
64else
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
82fi
83