#!/bin/sh
#
# $Id: mmf,v 1.1 2000/10/14 19:16:06 amai Exp $
#
# This version finds out where the configuration files are
# by going up the directory tree.
# It assumes two things :
#	- there is a config.status in some parent directory
#	  (infinite loop potential)
#	- there's also a configure command in some parent
#	  directory relative to the directory above, and that's
#	  LessTif's root directory
#
# If the loop gets to /, the script quits (to avoid infinite loops).
#
D=`pwd`
#
# Find directory from which we configured.
#
while true
do
	if [ -r config.status ]; then
		CONFIGDIR=`pwd`
		echo "Build directory is $CONFIGDIR"
		break
	fi
	if [ `pwd` = '/' ]; then
		echo "$0: There's a problem: I got to /"
		exit 1
	fi
	cd ..
done
LD=`echo $D | sed -e "s:$CONFIGDIR/::"`
while true
do
	if [ -r configure ]; then
		ROOTDIR=`pwd`
		echo "ROOT directory is $ROOTDIR"
		break
	fi
	if [ `pwd` = '/' ]; then
		echo "$0: There's a problem: I got to /"
		exit 1
	fi
	cd ..
done
cd $ROOTDIR
automake -i $LD/Makefile
cd $CONFIGDIR
CONFIG_FILES=$LD/Makefile config.status
