#!/bin/sh
m4src=@datadir@/m4

if ! test -e configure.ac ; then
	echo "$0: error: configure.ac not found" >&2
	exit 1
fi

mkdir -p m4 intl po
for i in $m4src/*.m4 ; do
	cp -f $i m4/
done

dirprefix=""
while read line
do
  if [ "${line##*AC_CONFIG_AUX_DIR}" != "$line" ]; then
    dirprefix="${line##*([}"
    dirprefix="${dirprefix%%])*}"
    mkdir -p "${dirprefix}"
  fi
  
  if [ "${line##*po/Makefile.in}" != "$line" ]; then
    poprefix="${line##*[}"
    poprefix="${poprefix%%po/Makefile.in*}"
    install -D -m 644 @datadir@/data/autopoint_Makefile.in "./${poprefix}/po/Makefile.in.in"
  fi
done < "configure.ac"

touch "./${dirprefix}/config.rpath" ABOUT-NLS

for i in intl/Makefile.in po/Makefile.in.in ; do
	install -D -m 644 @datadir@/data/autopoint_Makefile.in "$i"
done

install -D -m 644 @datadir@/data/Makevars.template po/Makevars.template
true
