:
# @(#)guess_tuucpsrc	1.4 (16 Jun 1994)
# Locate the Taylor UUCP build directory by searching various directories.
# By default, this script looks in the current and parent directories for 
# things named uucp-*.  
#
# The default search order is: "uucp-1.05", "uucp-1.04-patched", "uucp-1.04"

# We try to find both source and object code (which may be in different trees)

# if srcdir is set in the environment, look in it's parent dir
srcdir=${srcdir-.}

TUUFILE=uuconf/tdial
taylorsrc=''
taylorobj=''
set -f
### EDITING INSTRUCTIONS:
###   If this script doesn't find your taylor uucp source, add the correct
###   path to the following list.  If the compiled uucp relocatables are not
###   in the uucp source directory, you must include the paths of both the
###   source and compiled relocatables below:
for pattern in \
	"$srcdir/../uucp-*" 		\
	"$srcdir/uucp-*" 		\
	"../../*src*/uucp-*"		\
	"../../../*src*/uucp-*"		\
	"../../../../*src*/uucp-*"	\
	"../../*/*obj*/uucp*"		\
	"../../../*/*obj*/uucp*"	\
	"../../../../*/*obj*/uucp*"	\
	"/usr/local/src/uucp-*"		\
; do
	set +f	
	list=
    	for d in $pattern ; do 
	    if test -r "${d}/${TUUFILE}.c" && test -r ${d}/Makefile.in ; then
		v=`sed -n -e 's/^[ 	]*VERSION[ 	]*=[ 	]*\([0-9.]*\)[ 	]*$/\1/p' ${d}/Makefile.in`
		# Accept other than 1.05 only if none yet seen
		test "$v" != "1.05" && test -n "$taylorsrc" && continue
		taylorsrc=${d} taylorobj=""
	        test -r "${d}/${TUUFILE}.o" && taylorobj=${d}
		srcv=$v
	    fi
	    if test -z "$taylorobj" && 
	       test -r "${d}/${TUUFILE}.o" && test -r ${d}/Makefile ; then
		v=`sed -n -e 's/^[ 	]*VERSION[ 	]*=[ 	]*\([0-9.]*\)[ 	]*$/\1/p' ${d}/Makefile`
		if test -n "$srcv" && test "$srcv" != "$v" ; then
		    # This obj dir does not match the source we found before
		    # echo "Ignoring $d (wrong version $v != $srcv)"
		    continue
		fi
		taylorobj=${d}
		objv=$v
	        if test -r "${d}/${TUUFILE}.c" ; then
		    taylorsrc=${d}
		    srcv=$v
		fi
	    fi
	    test -n "$taylorsrc" -a -n "$taylorobj" && break 2
        done
done
test -n "$taylorsrc" && taylorsrc=`(cd $taylorsrc; pwd)`
echo "taylorsrc=$taylorsrc"
test -n "$taylorobj" && taylorobj=`(cd $taylorobj; pwd)`
echo "taylorobj=$taylorobj"
echo "taylorver=$objv"
