| 1 | #! /bin/sh |
| 2 | |
| 3 | ## |
| 4 | ## Make variable substitutions in configuration files. |
| 5 | ## |
| 6 | ## This script does something very similar to what config.status does, but |
| 7 | ## it fully resolves the various path variables (prefix, exec_prefix, etc.) |
| 8 | ## so that they don't contain any variable substitutions. It's easier to |
| 9 | ## do this in a separate script than try to use eval or the like to resolve |
| 10 | ## the variable names inside configure, particularly since prefix and |
| 11 | ## exec_prefix aren't set until the end of the script. |
| 12 | ## |
| 13 | ## The original form of this script was taken from the INN project |
| 14 | ## which is under a BSD-style license |
| 15 | ## |
| 16 | |
| 17 | AWK="mawk" |
| 18 | |
| 19 | # The paths set by configure. |
| 20 | prefix="/usr/local" |
| 21 | exec_prefix="${prefix}" |
| 22 | bindir="${exec_prefix}/bin" |
| 23 | libexecdir="${exec_prefix}/libexec" |
| 24 | libdir="/usr/local/lib64" |
| 25 | sbindir="${exec_prefix}/sbin" |
| 26 | sysconfdir="${prefix}/etc" |
| 27 | includedir="${prefix}/include" |
| 28 | runstatedir="${prefix}/var/run" # @runstatedir@ if autoconf >= 2.70 |
| 29 | if [ -d "${prefix}/etc/sysconfig" ] |
| 30 | then |
| 31 | envdir="${prefix}/etc/sysconfig" |
| 32 | else |
| 33 | envdir="${prefix}/etc/default" |
| 34 | fi |
| 35 | |
| 36 | # Additional variables set by configure |
| 37 | CFLAGS="`echo '-g -O2 -fno-strict-aliasing -Wall -D_REENTRANT' | $AWK '{ gsub(/,/, "\\\\,"); print }'`" |
| 38 | LDFLAGS="`echo ' -lpthread -lapr-1 ' | $AWK '{ gsub(/,/, "\\\\,"); print }'`" |
| 39 | LIBS="-ldl -lnsl -lnsl -lz -lpcre -lexpat -lconfuse -lpthread " |
| 40 | VERSION="3.7.2" |
| 41 | host_cpu="x86_64" |
| 42 | |
| 43 | # Additional paths specific to Ganglia. |
| 44 | moduledir="/usr/local/lib64/ganglia" |
| 45 | varstatedir="/var/lib" |
| 46 | |
| 47 | # Additional variables that are substituted into configuration files. |
| 48 | GANGLIA_MAJOR_VERSION="3" |
| 49 | GANGLIA_MICRO_VERSION="2" |
| 50 | GANGLIA_MINOR_VERSION="7" |
| 51 | GANGLIA_VERSION="3.7.2" |
| 52 | REL="1" |
| 53 | |
| 54 | # We can probably just assume sed is on the path, but since we have it, we may |
| 55 | # as well use it. |
| 56 | SED="/bin/sed" |
| 57 | |
| 58 | input="$1" |
| 59 | if [ -z "$input" ] ; then |
| 60 | echo "No input file specified" >&2 |
| 61 | exit 1 |
| 62 | fi |
| 63 | |
| 64 | output="$2" |
| 65 | if [ -z "$output" ] ; then |
| 66 | output=`echo "$input" | $SED -e 's/\.in$//'` |
| 67 | fi |
| 68 | if [ x"$input" = x"$output" ] ; then |
| 69 | echo "No output file specified and input file doesn't end in .in" >&2 |
| 70 | exit 1 |
| 71 | fi |
| 72 | |
| 73 | $SED -e "s,@prefix[@],$prefix,g" \ |
| 74 | -e "s,@exec_prefix[@],$exec_prefix,g" \ |
| 75 | -e "s,@bindir[@],$bindir,g" \ |
| 76 | -e "s,@libexecdir[@],$libexecdir,g" \ |
| 77 | -e "s,@libdir[@],$libdir,g" \ |
| 78 | -e "s,@sbindir[@],$sbindir,g" \ |
| 79 | -e "s,@sysconfdir[@],$sysconfdir,g" \ |
| 80 | -e "s,@envdir[@],$envdir,g" \ |
| 81 | -e "s,@runstatedir[@],$runstatedir,g" \ |
| 82 | -e "s,@includedir[@],$includedir,g" \ |
| 83 | -e "s,@CFLAGS[@],$CFLAGS,g" \ |
| 84 | -e "s,@LDFLAGS[@],$LDFLAGS,g" \ |
| 85 | -e "s,@LIBS[@],$LIBS,g" \ |
| 86 | -e "s,@VERSION[@],$VERSION,g" \ |
| 87 | -e "s,@host_cpu[@],$host_cpu,g" \ |
| 88 | -e "s,@moduledir[@],$moduledir,g" \ |
| 89 | -e "s,@varstatedir[@],$varstatedir,g" \ |
| 90 | -e "s,@GANGLIA_MAJOR_VERSION[@],$GANGLIA_MAJOR_VERSION,g" \ |
| 91 | -e "s,@GANGLIA_MICRO_VERSION[@],$GANGLIA_MICRO_VERSION,g" \ |
| 92 | -e "s,@GANGLIA_MINOR_VERSION[@],$GANGLIA_MINOR_VERSION,g" \ |
| 93 | -e "s,@GANGLIA_VERSION[@],$GANGLIA_VERSION,g" \ |
| 94 | -e "s,@REL[@],$REL,g" \ |
| 95 | < "$input" > "$output" |
| 96 |