-
Notifications
You must be signed in to change notification settings - Fork 246
/
ganglia-config.in
109 lines (103 loc) · 2.63 KB
/
ganglia-config.in
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
#!/bin/sh
DIFS='
'
prefix="@prefix@"
exec_prefix="@exec_prefix@"
ganglia_prefix="$prefix"
ganglia_exec_prefix="$exec_prefix"
ganglia_bindir="@bindir@"
ganglia_libdir="@libdir@"
ganglia_includedir="@includedir@"
ganglia_datarootdir="@varstatedir@/ganglia"
ganglia_cflags="@CFLAGS@"
ganglia_ldflags="@LDFLAGS@"
ganglia_libs="@LIBS@"
ganglia_version="@VERSION@"
help=no
version=no
usage="ganglia-config"
usage="$usage [--help] [--version] [--all]"
usage="$usage [--prefix] [--exec-prefix] [--bindir] [--libdir] [--includedir] [--datarootdir]"
usage="$usage [--cflags] [--ldflags] [--libs]"
if [ $# -eq 0 ]; then
echo "ganglia-config:Error: Invalid option" 1>&2
echo "ganglia-config:Usage: $usage" 1>&2
exit 1
fi
output=''
output_extra=''
all=no
prev=''
OIFS="$IFS" IFS="$DIFS"
for option
do
if [ ".$prev" != . ]; then
eval "$prev=\$option"
prev=''
continue
fi
case "$option" in
-*=*) optarg=`echo "$option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
*) optarg='' ;;
esac
case "$option" in
--help|-h)
echo "Usage: $usage"
echo "Report bugs to [email protected]"
exit 0
;;
--version|-v)
echo "Ganglia $ganglia_version"
exit 0
;;
--all)
all=yes
;;
--prefix)
output="$output $ganglia_prefix"
;;
--exec-prefix)
output="$output $ganglia_exec_prefix"
;;
--bindir)
output="$output $ganglia_bindir"
;;
--libdir)
output="$output $ganglia_libdir"
;;
--includedir)
output="$output $ganglia_includedir"
;;
--datarootdir)
output="$output $ganglia_datarootdir"
;;
--cflags)
output="$output -I$ganglia_includedir"
output_extra="$output_extra $ganglia_cflags"
;;
--ldflags)
output="$output -L$ganglia_libdir"
output_extra="$output_extra $ganglia_ldflags"
;;
--libs)
output="$output -lganglia"
output_extra="$output_extra $ganglia_libs"
;;
* )
echo "ganglia-config:Error: Invalid option" 1>&2
echo "ganglia-config:Usage: $usage" 1>&2
exit 1;
;;
esac
done
IFS="$OIFS"
if [ ".$prev" != . ]; then
echo "ganglia-config:Error: missing argument to --`echo $prev | sed 's/_/-/g'`" 1>&2
exit 1
fi
if [ ".$output" != . ]; then
if [ ".$all" = .yes ]; then
output="$output $output_extra"
fi
echo $output
fi