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
|
#! /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="mawk"
# The paths set by configure.
prefix="/usr/local"
exec_prefix="${prefix}"
bindir="${exec_prefix}/bin"
libexecdir="${exec_prefix}/libexec"
libdir="/usr/local/lib64"
sbindir="${exec_prefix}/sbin"
sysconfdir="${prefix}/etc"
includedir="${prefix}/include"
runstatedir="${prefix}/var/run" # @runstatedir@ if autoconf >= 2.70
if [ -d "${prefix}/etc/sysconfig" ]
then
envdir="${prefix}/etc/sysconfig"
else
envdir="${prefix}/etc/default"
fi
# Additional variables set by configure
CFLAGS="`echo '-g -O2 -fno-strict-aliasing -Wall -D_REENTRANT' | $AWK '{ gsub(/,/, "\\\\,"); print }'`"
LDFLAGS="`echo ' -lpthread -lapr-1 ' | $AWK '{ gsub(/,/, "\\\\,"); print }'`"
LIBS="-ldl -lnsl -lnsl -lz -lpcre -lexpat -lconfuse -lpthread "
VERSION="3.7.2"
host_cpu="x86_64"
# Additional paths specific to Ganglia.
moduledir="/usr/local/lib64/ganglia"
varstatedir="/var/lib"
# Additional variables that are substituted into configuration files.
GANGLIA_MAJOR_VERSION="3"
GANGLIA_MICRO_VERSION="2"
GANGLIA_MINOR_VERSION="7"
GANGLIA_VERSION="3.7.2"
REL="1"
# We can probably just assume sed is on the path, but since we have it, we may
# as well use it.
SED="/bin/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,@envdir[@],$envdir,g" \
-e "s,@runstatedir[@],$runstatedir,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"
|