#!/bin/sh

case $# in
2)	:;;
*)	echo "Usage: $0 <source_file> <destination_file>" >&2
	exit 1;;
esac
src=$1
dst=$2

prefix="@prefix@"
exec_prefix="@exec_prefix@"
bindir="@bindir@"
libexecdir="@libexecdir@"
datarootdir="@datarootdir@"
datadir="@datadir@"
sysconfdir="@sysconfdir@"
ldap_targets='@ldap_targets@'
postgresql_targets='@postgresql_targets@'
globus_flavor="@globus_flavor@"
globus_location="@globus_location@"

RUBY="@RUBY@"
PERL="@PERL@"

# If Globus is not configured, use "gcc32" for documentation purpose.
: ${globus_flavor:="gcc32"}

INSTALL="@abs_top_srcdir@/makes/install-sh -c"
tmpfile=/tmp/insttmp.$$
status=1

trap 'rm -f $tmpfile; exit $status' 0 1 2 15

sed	-e "s|[@]prefix[@]|$prefix|g" \
	-e "s|[@]bindir[@]|$bindir|g" \
	-e "s|[@]libexecdir[@]|$libexecdir|g" \
	-e "s|[@]datadir[@]|$datadir|g" \
	-e "s|[@]datarootdir[@]|$datarootdir|g" \
	-e "s|[@]sysconfdir[@]|$sysconfdir|g" \
	-e "s|[@]ldap_targets[@]|$ldap_targets|g" \
	-e "s|[@]postgresql_targets[@]|$postgresql_targets|g" \
	-e "s|[@]globus_flavor[@]|$globus_flavor|g" \
	-e "s|[@]globus_location[@]|$globus_location|g" \
	-e "s|[@]RUBY[@]|$RUBY|g" \
	-e "s|[@]PERL[@]|$PERL|g" \
	$src >$tmpfile

@INSTALL_SCRIPT@ "$tmpfile" "$dst"
status=$?
rm -f $tmpfile
