Bug 341223 - Make $MOZCONFIG try $topsrcdir-local paths too
authorHiroyuki Ikezoe <hiikezoe@mozilla-japan.org>
Tue, 02 Aug 2011 18:48:00 -0400
changeset 75229 2b05e85795d113d858534304bf324cde44b97254
parent 75228 5b62f52daa1bf6e7c7f5902e5ff052fd460389c0
child 75230 0adaae140642d5ea379185da71e9b2fd0a519176
push idunknown
push userunknown
push dateunknown
bugs341223
milestone8.0a1
Bug 341223 - Make $MOZCONFIG try $topsrcdir-local paths too
build/autoconf/mozconfig-find
--- a/build/autoconf/mozconfig-find
+++ b/build/autoconf/mozconfig-find
@@ -41,27 +41,39 @@
 #    command-line. The .mozconfig file is searched for in the 
 #    order:
 #       if $MOZCONFIG is set, use that.
 #       Otherwise, use $TOPSRCDIR/.mozconfig
 #       Otherwise, use $HOME/.mozconfig
 #
 topsrcdir=$1
 
-for _config in "$MOZCONFIG" \
-               "$MOZ_MYCONFIG"
-do
-  if [ -n "$_config" ] && ! [ -f "$_config" ]; then
-    echo "Specified MOZCONFIG \"$_config\" does not exist!"
+absolute_path() {
+  if uname -s | grep -q MINGW; then
+    regex='^\([A-Za-z]:\|\\\\\|\/\)'
+  else
+    regex='^\/'
+  fi
+
+  if echo $1 | grep -q $regex; then
+    echo $1
+  else
+    echo $topsrcdir/$1
+  fi
+}
+
+if [ -n "$MOZCONFIG" ]; then
+  MOZCONFIG=`absolute_path "$MOZCONFIG"`
+  if ! [ -f "$MOZCONFIG" ]; then
+    echo "Specified MOZCONFIG \"$MOZCONFIG\" does not exist!"
     exit 1
   fi
-done
+fi
 
 for _config in "$MOZCONFIG" \
-               "$MOZ_MYCONFIG" \
                "$topsrcdir/.mozconfig" \
                "$topsrcdir/mozconfig" \
                "$topsrcdir/mozconfig.sh" \
                "$topsrcdir/myconfig.sh" \
                "$HOME/.mozconfig" \
                "$HOME/.mozconfig.sh" \
                "$HOME/.mozmyconfig.sh"
 do