forked from ganglia/monitor-core
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fixconfig.in
87 lines (76 loc) · 2.67 KB
/
fixconfig.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
#! /bin/sh
##
## Make variable substitutions in configuration files.
##
## This script does something very similar to what config.status does, but
## it fully resolves the various path variables (prefix, exec_prefix, etc.)
## so that they don't contain any variable substitutions. It's easier to
## do this in a separate script than try to use eval or the like to resolve
## the variable names inside configure, particularly since prefix and
## exec_prefix aren't set until the end of the script.
##
## The original form of this script was taken from the INN project
## which is under a BSD-style license
##
AWK="@AWK@"
# The paths set by configure.
prefix="@prefix@"
exec_prefix="@exec_prefix@"
bindir="@bindir@"
libexecdir="@libexecdir@"
libdir="@libdir@"
sbindir="@sbindir@"
sysconfdir="@sysconfdir@"
includedir="@includedir@"
# Additional variables set by configure
CFLAGS="`echo '@CFLAGS@' | $AWK '{ gsub(/,/, "\\\\,"); print }'`"
LDFLAGS="`echo '@LDFLAGS@' | $AWK '{ gsub(/,/, "\\\\,"); print }'`"
LIBS="@LIBS@"
VERSION="@VERSION@"
host_cpu="@host_cpu@"
# Additional paths specific to Ganglia.
moduledir="@moduledir@"
varstatedir="@varstatedir@"
# Additional variables that are substituted into configuration files.
GANGLIA_MAJOR_VERSION="@GANGLIA_MAJOR_VERSION@"
GANGLIA_MICRO_VERSION="@GANGLIA_MICRO_VERSION@"
GANGLIA_MINOR_VERSION="@GANGLIA_MINOR_VERSION@"
GANGLIA_VERSION="@GANGLIA_VERSION@"
REL="@REL@"
# We can probably just assume sed is on the path, but since we have it, we may
# as well use it.
SED="@SED@"
input="$1"
if [ -z "$input" ] ; then
echo "No input file specified" >&2
exit 1
fi
output="$2"
if [ -z "$output" ] ; then
output=`echo "$input" | $SED -e 's/\.in$//'`
fi
if [ x"$input" = x"$output" ] ; then
echo "No output file specified and input file doesn't end in .in" >&2
exit 1
fi
$SED -e "s,@prefix[@],$prefix,g" \
-e "s,@exec_prefix[@],$exec_prefix,g" \
-e "s,@bindir[@],$bindir,g" \
-e "s,@libexecdir[@],$libexecdir,g" \
-e "s,@libdir[@],$libdir,g" \
-e "s,@sbindir[@],$sbindir,g" \
-e "s,@sysconfdir[@],$sysconfdir,g" \
-e "s,@includedir[@],$includedir,g" \
-e "s,@CFLAGS[@],$CFLAGS,g" \
-e "s,@LDFLAGS[@],$LDFLAGS,g" \
-e "s,@LIBS[@],$LIBS,g" \
-e "s,@VERSION[@],$VERSION,g" \
-e "s,@host_cpu[@],$host_cpu,g" \
-e "s,@moduledir[@],$moduledir,g" \
-e "s,@varstatedir[@],$varstatedir,g" \
-e "s,@GANGLIA_MAJOR_VERSION[@],$GANGLIA_MAJOR_VERSION,g" \
-e "s,@GANGLIA_MICRO_VERSION[@],$GANGLIA_MICRO_VERSION,g" \
-e "s,@GANGLIA_MINOR_VERSION[@],$GANGLIA_MINOR_VERSION,g" \
-e "s,@GANGLIA_VERSION[@],$GANGLIA_VERSION,g" \
-e "s,@REL[@],$REL,g" \
< "$input" > "$output"