From c9adf54b01401317113bfbcbdb5295ebefbed814 Mon Sep 17 00:00:00 2001 From: "briano%netscape.com" Date: Tue, 8 Jun 1999 22:32:31 +0000 Subject: [PATCH] Fix for bug 7756. Thanks to jim_nance@yahoo.com for the original idea. --- build/autoconf/match-dir.sh | 43 ++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/build/autoconf/match-dir.sh b/build/autoconf/match-dir.sh index 258e6a34201a..c1a3a6c97cda 100755 --- a/build/autoconf/match-dir.sh +++ b/build/autoconf/match-dir.sh @@ -24,34 +24,37 @@ # Send comments, improvements, bugs to ramiro@netscape.com # -# Make sure a Makefile.in exists -#if [ $# -lt 1 ] -#then -# echo -# echo "Usage: `basename $0` match [dir1 dir2 ... dirn]" -# echo -# -# exit 1 -#fi - -# Make sure a Makefile.in exists -if [ ! -f Makefile.in ] -then - echo - echo "There ain't no 'Makefile.in' over here: $pwd, dude." - echo - - exit 1 +if [ -f Makefile ]; then + MAKEFILE="Makefile" +else + if [ -f Makefile.in ]; then + MAKEFILE="Makefile.in" + else + echo + echo "There ain't no 'Makefile' or 'Makefile.in' over here: $pwd, dude." + echo + exit 1 + fi fi # Use DEPTH in the Makefile.in to determine the depth -depth=`grep -w DEPTH Makefile.in | grep -e "\.\." | awk -F"=" '{ print $2; }'` +depth=`grep -w DEPTH ${MAKEFILE} | grep -e "\.\." | awk -F"=" '{ print $2; }'` # Determine the depth count n=`echo $depth | tr '/' ' ' | wc -w` # Determine the path (strip anything before the mozilla/ root) -path=`pwd | awk -v count=$n -F"/" '\ +# If we are building in the source directory then the Makefile will have +# srcdir set to '.' and we have to get the path from the pwd command. +# If we are building outside of the source tree then we can get the information +# we need from the srcdir statement in the Makefile. + +tpth=`grep '^srcdir.*/mozilla/' ${MAKEFILE}` +if [ "$tpth" = "" ]; then + tpth=`pwd` +fi + +path=`echo $tpth | awk -v count=$n -F"/" '\ { for(i=NF-count+0; i <= NF ; i++) \ { \ if (i!=NF) \