Bug 40967 - Avoid leaking MSYS paths in Makefiles: use c:/dir/path paths whenever possible, r=ted
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 09 Mar 2009 10:55:41 -0400
changeset 25869 61041f3cf7dae48de97101a243054eef8990c593
parent 25868 3155b813495994acd68d48825832b0171c8411c5
child 25870 ba6065ce59ac30188d71615a9feaacd1f24e2806
push id5793
push userbsmedberg@mozilla.com
push dateMon, 09 Mar 2009 14:56:08 +0000
treeherdermozilla-central@61041f3cf7da [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersted
bugs40967
milestone1.9.2a1pre
Bug 40967 - Avoid leaking MSYS paths in Makefiles: use c:/dir/path paths whenever possible, r=ted
aclocal.m4
build/autoconf/make-makefile
build/autoconf/mozprog.m4
build/unix/mddepend.pl
config/rules.mk
configure.in
js/src/aclocal.m4
js/src/build/autoconf/make-makefile
js/src/build/autoconf/mozprog.m4
js/src/build/unix/mddepend.pl
js/src/config/rules.mk
js/src/configure.in
toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/Makefile.in
--- a/aclocal.m4
+++ b/aclocal.m4
@@ -6,14 +6,17 @@ dnl
 builtin(include, build/autoconf/glib.m4)dnl
 builtin(include, build/autoconf/libIDL.m4)dnl
 builtin(include, build/autoconf/nspr.m4)dnl
 builtin(include, build/autoconf/nss.m4)dnl
 builtin(include, build/autoconf/pkg.m4)dnl
 builtin(include, build/autoconf/freetype2.m4)dnl
 builtin(include, build/autoconf/codeset.m4)dnl
 builtin(include, build/autoconf/altoptions.m4)dnl
+builtin(include, build/autoconf/mozprog.m4)dnl
+
+MOZ_PROG_CHECKMSYS()
 
 # Read the user's .mozconfig script.  We can't do this in
 # configure.in: autoconf puts the argument parsing code above anything
 # expanded from configure.in, and we need to get the configure options
 # from .mozconfig in place before that argument parsing code.
 MOZ_READ_MOZCONFIG(.)
--- a/build/autoconf/make-makefile
+++ b/build/autoconf/make-makefile
@@ -39,23 +39,30 @@
 #      Also, creates any needed subdirectories.
 #
 # usage: make-makefiles [ -t <topsrcdir> -p <print_topsrcdir> -d <depth> ] [ <subdir> | <subdir>/Makefile ] ...
 
 # Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
 
 #$debug = 1;
 
+if ($^O eq 'msys') {
+  $pwdcmd = 'pwd -W';
+}
+else {
+  $pwdcmd = 'pwd';
+}
+
 # Determine various tree path variables
 #
 ($topsrcdir, $ptopsrcdir, $depth, @makefiles) = parse_arguments(@ARGV);
 
-$object_fullpath = `pwd`;
+$object_fullpath = `$pwdcmd`;
 chdir $depth;
-$object_root = `pwd`;
+$object_root = `$pwdcmd`;
 chomp $object_fullpath;
 chomp $object_root;
 
 # $source_subdir is the path from the object root to where
 #    'make-makefile' was called. For example, if make-makefile was
 #    called from "mozilla/gfx/src", then $source_subdir would be
 #    "gfx/src/".
 $source_subdir = "$object_fullpath/";
@@ -252,17 +259,17 @@ sub update_makefiles {
     }
 
     if ($debug) {
       print "ac_dir     = $ac_dir\n";
       print "ac_file    = $ac_file\n";
       print "ac_file_in = $ac_file_in\n";
       print "srcdir     = $srcdir\n";
       print "top_srcdir = $top_srcdir\n";
-      print "cwd        = " . `pwd` . "\n";
+      print "cwd        = " . `$pwdcmd` . "\n";
     }
 
     # Copy the file and make substitutions.
     #    @srcdir@     -> value of $srcdir
     #    @top_srcdir@ -> value of $top_srcdir
     #
     if (-e $ac_file) {
       next if -M _ < -M $ac_file_in;  # Next if Makefile is up-to-date.
new file mode 100644
--- /dev/null
+++ b/build/autoconf/mozprog.m4
@@ -0,0 +1,70 @@
+dnl ***** BEGIN LICENSE BLOCK *****
+dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
+dnl
+dnl The contents of this file are subject to the Mozilla Public License Version
+dnl 1.1 (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl http://www.mozilla.org/MPL/
+dnl
+dnl Software distributed under the License is distributed on an "AS IS" basis,
+dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+dnl for the specific language governing rights and limitations under the
+dnl License.
+dnl
+dnl The Original Code is mozilla.org code.
+dnl
+dnl The Initial Developer of the Original Code is the
+dnl Mozilla Foundation <http://www.mozilla.org>
+dnl
+dnl Portions created by the Initial Developer are Copyright (C) 2009
+dnl the Initial Developer. All Rights Reserved.
+dnl
+dnl Contributor(s):
+dnl   Benjamin Smedberg
+dnl
+dnl Alternatively, the contents of this file may be used under the terms of
+dnl either of the GNU General Public License Version 2 or later (the "GPL"),
+dnl or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+dnl in which case the provisions of the GPL or the LGPL are applicable instead
+dnl of those above. If you wish to allow use of your version of this file only
+dnl under the terms of either the GPL or the LGPL, and not to allow others to
+dnl use your version of this file under the terms of the MPL, indicate your
+dnl decision by deleting the provisions above and replace them with the notice
+dnl and other provisions required by the GPL or the LGPL. If you do not delete
+dnl the provisions above, a recipient may use your version of this file under
+dnl the terms of any one of the MPL, the GPL or the LGPL.
+dnl
+dnl ***** END LICENSE BLOCK *****
+
+AC_DEFUN(MOZ_PROG_CHECKMSYS,
+[AC_REQUIRE([AC_INIT_BINSH])dnl
+if test `uname -o` = Msys; then
+  msyshost=1
+fi
+])
+
+AC_DEFUN(MOZ_PATH_PROG,
+[ AC_PATH_PROG($1,$2,$3,$4)
+  if test "$msyshost"; then
+    case "[$]$1" in
+    /*)
+      $1="$(cd $(dirname [$]$1) && pwd -W)/$(basename [$]$1)"
+      if test -e "[$]$1.exe"; then
+        $1="[$]$1.exe"
+      fi
+    esac
+  fi
+])
+
+AC_DEFUN(MOZ_PATH_PROGS,
+[  AC_PATH_PROGS($1,$2,$3,$4)
+  if test "$msyshost"; then
+    case "[$]$1" in
+    /*)
+      $1="$(cd $(dirname [$]$1) && pwd -W)/$(basename [$]$1)"
+      if test -e "[$]$1.exe"; then
+        $1="[$]$1.exe"
+      fi
+    esac
+  fi
+])
--- a/build/unix/mddepend.pl
+++ b/build/unix/mddepend.pl
@@ -59,16 +59,18 @@ my %alldeps;
 while (<>) {
   s/\r?\n$//; # Handle both unix and DOS line endings
   $line .= $_;
   if ($line =~ /\\$/) {
     chop $line;
     next;
   }
 
+  $line =~ s|\\|/|g;
+
   my ($obj,$rest) = split /\s*:\s+/, $line, 2;
   $line = '';
   next if !$obj || !$rest;
 
   my @deps = split /\s+/, $rest;
   push @{$alldeps{$obj}}, @deps;
   if (DEBUG >= 2) {
     foreach my $dep (@deps) { print "add $obj $dep\n"; }
--- a/config/rules.mk
+++ b/config/rules.mk
@@ -76,18 +76,17 @@ endif
 
 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
 ifndef GNU_CC
 _LIBNAME_RELATIVE_PATHS=1
 endif
 endif
 
 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
-PWD := $(shell pwd)
-_VPATH_SRCS = $(if $(filter /%,$<),$<,$(PWD)/$<)
+_VPATH_SRCS = $(if $(filter /%,$<),$<,$(CURDIR)/$<)
 else
 _VPATH_SRCS = $<
 endif
 
 # Add $(DIST)/lib to VPATH so that -lfoo dependencies are followed
 VPATH += $(DIST)/lib
 ifdef LIBXUL_SDK
 VPATH += $(LIBXUL_SDK)/lib
--- a/configure.in
+++ b/configure.in
@@ -362,26 +362,26 @@ if test -n "$CROSS_COMPILE" && test "$ta
         dnl (see --with-macos-sdk below).
         CFLAGS=$_SAVE_CFLAGS
         CXXFLAGS=$_SAVE_CXXFLAGS
         ;;
     esac
 
     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
-    AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
+    MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
     AC_DEFINE(CROSS_COMPILE)
 else
     AC_PROG_CC
     AC_PROG_CXX
     AC_PROG_RANLIB
-    AC_PATH_PROGS(AS, $AS as, $CC)
+    MOZ_PATH_PROGS(AS, $AS as, $CC)
     AC_CHECK_PROGS(AR, ar, :)
     AC_CHECK_PROGS(LD, ld, :)
     AC_CHECK_PROGS(STRIP, strip, :)
     AC_CHECK_PROGS(WINDRES, windres, :)
     if test -z "$HOST_CC"; then
         HOST_CC="$CC"
     fi
     if test -z "$HOST_CFLAGS"; then
@@ -738,17 +738,17 @@ AC_SUBST(GNU_CXX)
 AC_SUBST(INTEL_CC)
 AC_SUBST(INTEL_CXX)
 
 dnl ========================================================
 dnl Checks for programs.
 dnl ========================================================
 AC_PROG_INSTALL
 AC_PROG_LN_S
-AC_PATH_PROGS(PERL, $PERL perl5 perl )
+MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
 if test -z "$PERL" || test "$PERL" = ":"; then
     AC_MSG_ERROR([perl not found in \$PATH])
 fi
 
 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
 _perl_res=$?
@@ -764,39 +764,39 @@ AC_MSG_CHECKING([for full perl installat
 _perl_res=$?
 if test "$_perl_res" != 0; then
     AC_MSG_RESULT([no])
     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
 else
     AC_MSG_RESULT([yes])    
 fi
 
-AC_PATH_PROGS(PYTHON, $PYTHON python)
+MOZ_PATH_PROGS(PYTHON, $PYTHON python)
 if test -z "$PYTHON"; then
     AC_MSG_ERROR([python was not found in \$PATH])
 fi
 
-AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
+MOZ_PATH_PROGS(NSINSTALL_BIN, nsinstall )
 if test -z "$COMPILE_ENVIRONMENT"; then
 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
 fi
 fi
 AC_SUBST(NSINSTALL_BIN)
 
-AC_PATH_PROG(DOXYGEN, doxygen, :)
-AC_PATH_PROG(WHOAMI, whoami, :)
-AC_PATH_PROG(AUTOCONF, autoconf, :)
-AC_PATH_PROG(UNZIP, unzip, :)
-AC_PATH_PROGS(ZIP, zip)
+MOZ_PATH_PROG(DOXYGEN, doxygen, :)
+MOZ_PATH_PROG(WHOAMI, whoami, :)
+MOZ_PATH_PROG(AUTOCONF, autoconf, :)
+MOZ_PATH_PROG(UNZIP, unzip, :)
+MOZ_PATH_PROGS(ZIP, zip)
 if test -z "$ZIP" || test "$ZIP" = ":"; then
     AC_MSG_ERROR([zip not found in \$PATH])
 fi
-AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
-AC_PATH_PROG(XARGS, xargs)
+MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
+MOZ_PATH_PROG(XARGS, xargs)
 if test -z "$XARGS" || test "$XARGS" = ":"; then
     AC_MSG_ERROR([xargs not found in \$PATH .])
 fi
 
 if test "$COMPILE_ENVIRONMENT"; then
 
 dnl ========================================================
 dnl = Mac OS X toolchain support
@@ -823,32 +823,32 @@ darwin*)
 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
 from building Mozilla. Upgrade to Xcode 2.1 or later.])
         fi
     fi
 
     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
-    AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
+    MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
 
     case "$PBBUILD" in
       *xcodebuild*)
         changequote(,)
         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
         changequote([,])
         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
           HAS_XCODE_2_1=1;
         fi
       ;;
     esac
 
     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
     dnl it has moved into /usr/bin.
-    AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
+    MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
     ;;
 esac
 
 AC_SUBST(GCC_VERSION)
 AC_SUBST(XCODEBUILD_VERSION)
 AC_SUBST(HAS_XCODE_2_1)
 
 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
@@ -971,20 +971,20 @@ tools are selected during the Xcode/Deve
 fi
 
 fi # COMPILE_ENVIRONMENT
 
 dnl Be sure the make we use is GNU make.
 dnl on win32, gmake.exe is the generally the wrong version
 case "$host_os" in
 cygwin*|mingw*|mks*|msvc*)
-    AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
+    MOZ_PATH_PROGS(MAKE, $MAKE make gmake, :)
     ;;
 *)
-    AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
+    MOZ_PATH_PROGS(MAKE, $MAKE gmake make, :)
     ;;
 esac
 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
 if test ! "$_make_try"
 then
 	echo
 	echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
 	echo
@@ -2220,27 +2220,28 @@ case "$target" in
     esac
     case "$host" in
     *-mingw*|*-cygwin*|*-msvc*|*-mks*)
 
     if test -z "$MOZ_TOOLS"; then
         AC_MSG_ERROR([MOZ_TOOLS is not set])
     fi
 
-    MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd`
+    MOZ_TOOLS_DIR=`cd $MOZ_TOOLS && pwd -W`
     if test "$?" != "0" || test -z "$MOZ_TOOLS_DIR"; then
         AC_MSG_ERROR([cd \$MOZ_TOOLS failed. MOZ_TOOLS ==? $MOZ_TOOLS])
     fi
-    if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_DIR/bin:"` = 0; then
+    MOZ_TOOLS_BIN_DIR="$(cd "$MOZ_TOOLS_DIR/bin" && pwd)"
+    if test `echo ${PATH}: | grep -ic "$MOZ_TOOLS_BINDIR:"` = 0; then
         AC_MSG_ERROR([\$MOZ_TOOLS\\bin must be in your path.])
     fi
     MOZ_TOOLS_DIR=`$CYGPATH_W $MOZ_TOOLS_DIR | $CYGPATH_S`
 
     if test -n "$GLIB_PREFIX"; then
-        _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd`
+        _GLIB_PREFIX_DIR=`cd $GLIB_PREFIX && pwd -W`
         if test "$?" = "0"; then
             if test `echo ${PATH}: | grep -ic "$_GLIB_PREFIX_DIR/bin:"` = 0; then
                 AC_MSG_ERROR([GLIB_PREFIX must be in your \$PATH.])
             fi
             _GLIB_PREFIX_DIR=`$CYGPATH_W $_GLIB_PREFIX_DIR | $CYGPATH_S`
         else
             AC_MSG_ERROR([GLIB_PREFIX is set but "${GLIB_PREFIX}" is not a directory.])
         fi
@@ -2255,17 +2256,17 @@ case "$target" in
         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2_s.lib"
     elif test -f "${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"; then
         GLIB_LIBS="${_GLIB_PREFIX_DIR}/lib/glib-1.2.lib"
     else
         AC_MSG_ERROR([Cannot find $_GLIB_PREFIX_DIR/lib/glib-1.2.lib or $_GLIB_PREFIX_DIR/lib/glib-1.2_s.lib])
     fi
 
     if test -n "$LIBIDL_PREFIX"; then
-        _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd`
+        _LIBIDL_PREFIX_DIR=`cd $LIBIDL_PREFIX && pwd -W`
         if test "$?" = "0"; then
             if test `echo ${PATH}: | grep -ic "$_LIBIDL_PREFIX_DIR/bin:"` = 0; then
                 AC_MSG_ERROR([LIBIDL_PREFIX must be in your \$PATH.])
             fi
             _LIBIDL_PREFIX_DIR=`$CYGPATH_W $_LIBIDL_PREFIX_DIR | $CYGPATH_S`
         else
             AC_MSG_ERROR([LIBIDL_PREFIX is set but "${LIBIDL_PREFIX}" is not a directory.])
         fi
@@ -5603,19 +5604,19 @@ if test -n "${MOZ_JAVAXPCOM}"; then
   if test -n "${JAVA_BIN_PATH}"; then
     dnl Look for javac and jar in the specified path.
     JAVA_PATH="$JAVA_BIN_PATH"
   else
     dnl No path specified, so look for javac and jar in $JAVA_HOME & $PATH.
     JAVA_PATH="$JAVA_HOME/bin:$PATH"
   fi
 
-  AC_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
-  AC_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
-  AC_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
+  MOZ_PATH_PROG(JAVA, java, :, [$JAVA_PATH])
+  MOZ_PATH_PROG(JAVAC, javac, :, [$JAVA_PATH])
+  MOZ_PATH_PROG(JAR, jar, :, [$JAVA_PATH])
   if test -z "$JAVA" || test "$JAVA" = ":" || test -z "$JAVAC" || test "$JAVAC" = ":" || test -z "$JAR" || test "$JAR" = ":"; then
     AC_MSG_ERROR([The programs java, javac and jar were not found.  Set \$JAVA_HOME to your java sdk directory, use --with-java-bin-path={java-bin-dir}, or reconfigure with --disable-javaxpcom.])
   fi
 fi
 
 dnl ========================================================
 dnl = Breakpad crash reporting (on by default on supported platforms)
 dnl ========================================================
@@ -5902,23 +5903,23 @@ esac
 
 MOZ_ARG_DISABLE_BOOL(installer,
 [  --disable-installer     Disable building of installer],
     MOZ_INSTALLER=,
     MOZ_INSTALLER=1 )
 if test -n "$MOZ_INSTALLER" -a "$OS_ARCH" = "WINNT"; then
     # Disable installer for Windows builds that use the new toolkit if NSIS
     # isn't in the path.
-    AC_PATH_PROGS(MAKENSIS, makensis)
+    MOZ_PATH_PROGS(MAKENSIS, makensis)
     if test -z "$MAKENSIS" || test "$MAKENSIS" = ":"; then
         AC_MSG_ERROR([To build the installer makensis is required in your path. To build without the installer reconfigure using --disable-installer.])
     fi
     # The Windows build for NSIS requires the iconv command line utility to
     # convert the charset of the locale files.
-    AC_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
+    MOZ_PATH_PROGS(HOST_ICONV, $HOST_ICONV "iconv", "")
     if test -z "$HOST_ICONV"; then
         AC_MSG_ERROR([To build the installer iconv is required in your path. To build without the installer reconfigure using --disable-installer.])
     fi
 fi
 
 # Automatically disable installer if xpinstall isn't built
 if test -z "$MOZ_XPINSTALL"; then
     MOZ_INSTALLER=
@@ -7423,17 +7424,17 @@ then
             PKG_CHECK_MODULES(LIBIDL, libIDL-2.0 >= 0.8.0,_LIBIDL_FOUND=1)
         fi
     fi
     dnl
     dnl If we don't have a libIDL config program & not cross-compiling, 
     dnl     look for orbit-config instead.
     dnl
     if test -z "$_LIBIDL_FOUND" && test -z "$CROSS_COMPILE"; then
-        AC_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
+        MOZ_PATH_PROGS(ORBIT_CONFIG, $ORBIT_CONFIG orbit-config)
         if test -n "$ORBIT_CONFIG"; then
             AC_MSG_CHECKING([for ORBit libIDL usability])
         	_ORBIT_CFLAGS=`${ORBIT_CONFIG} client --cflags`
     	    _ORBIT_LIBS=`${ORBIT_CONFIG} client --libs`
             _ORBIT_INC_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-I/); } }' -- ${_ORBIT_CFLAGS}`
             _ORBIT_LIB_PATH=`${PERL} -e '{ for $f (@ARGV) { print "$f " if ($f =~ m/^-L/); } }' -- ${_ORBIT_LIBS}`
             LIBIDL_CFLAGS="$_ORBIT_INC_PATH"
             LIBIDL_LIBS="$_ORBIT_LIB_PATH -lIDL -lglib"
--- a/js/src/aclocal.m4
+++ b/js/src/aclocal.m4
@@ -2,8 +2,11 @@ dnl
 dnl Local autoconf macros used with mozilla
 dnl The contents of this file are under the Public Domain.
 dnl 
 
 builtin(include, build/autoconf/pkg.m4)dnl
 builtin(include, build/autoconf/nspr.m4)dnl
 builtin(include, build/autoconf/altoptions.m4)dnl
 builtin(include, build/autoconf/moznbytetype.m4)dnl
+builtin(include, build/autoconf/mozprog.m4)dnl
+
+MOZ_PROG_CHECKMSYS()
--- a/js/src/build/autoconf/make-makefile
+++ b/js/src/build/autoconf/make-makefile
@@ -39,23 +39,30 @@
 #      Also, creates any needed subdirectories.
 #
 # usage: make-makefiles [ -t <topsrcdir> -p <print_topsrcdir> -d <depth> ] [ <subdir> | <subdir>/Makefile ] ...
 
 # Send comments, improvements, bugs to Steve Lamm (slamm@netscape.com).
 
 #$debug = 1;
 
+if ($^O eq 'msys') {
+  $pwdcmd = 'pwd -W';
+}
+else {
+  $pwdcmd = 'pwd';
+}
+
 # Determine various tree path variables
 #
 ($topsrcdir, $ptopsrcdir, $depth, @makefiles) = parse_arguments(@ARGV);
 
-$object_fullpath = `pwd`;
+$object_fullpath = `$pwdcmd`;
 chdir $depth;
-$object_root = `pwd`;
+$object_root = `$pwdcmd`;
 chomp $object_fullpath;
 chomp $object_root;
 
 # $source_subdir is the path from the object root to where
 #    'make-makefile' was called. For example, if make-makefile was
 #    called from "mozilla/gfx/src", then $source_subdir would be
 #    "gfx/src/".
 $source_subdir = "$object_fullpath/";
@@ -252,17 +259,17 @@ sub update_makefiles {
     }
 
     if ($debug) {
       print "ac_dir     = $ac_dir\n";
       print "ac_file    = $ac_file\n";
       print "ac_file_in = $ac_file_in\n";
       print "srcdir     = $srcdir\n";
       print "top_srcdir = $top_srcdir\n";
-      print "cwd        = " . `pwd` . "\n";
+      print "cwd        = " . `$pwdcmd` . "\n";
     }
 
     # Copy the file and make substitutions.
     #    @srcdir@     -> value of $srcdir
     #    @top_srcdir@ -> value of $top_srcdir
     #
     if (-e $ac_file) {
       next if -M _ < -M $ac_file_in;  # Next if Makefile is up-to-date.
new file mode 100644
--- /dev/null
+++ b/js/src/build/autoconf/mozprog.m4
@@ -0,0 +1,70 @@
+dnl ***** BEGIN LICENSE BLOCK *****
+dnl Version: MPL 1.1/GPL 2.0/LGPL 2.1
+dnl
+dnl The contents of this file are subject to the Mozilla Public License Version
+dnl 1.1 (the "License"); you may not use this file except in compliance with
+dnl the License. You may obtain a copy of the License at
+dnl http://www.mozilla.org/MPL/
+dnl
+dnl Software distributed under the License is distributed on an "AS IS" basis,
+dnl WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+dnl for the specific language governing rights and limitations under the
+dnl License.
+dnl
+dnl The Original Code is mozilla.org code.
+dnl
+dnl The Initial Developer of the Original Code is the
+dnl Mozilla Foundation <http://www.mozilla.org>
+dnl
+dnl Portions created by the Initial Developer are Copyright (C) 2009
+dnl the Initial Developer. All Rights Reserved.
+dnl
+dnl Contributor(s):
+dnl   Benjamin Smedberg
+dnl
+dnl Alternatively, the contents of this file may be used under the terms of
+dnl either of the GNU General Public License Version 2 or later (the "GPL"),
+dnl or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+dnl in which case the provisions of the GPL or the LGPL are applicable instead
+dnl of those above. If you wish to allow use of your version of this file only
+dnl under the terms of either the GPL or the LGPL, and not to allow others to
+dnl use your version of this file under the terms of the MPL, indicate your
+dnl decision by deleting the provisions above and replace them with the notice
+dnl and other provisions required by the GPL or the LGPL. If you do not delete
+dnl the provisions above, a recipient may use your version of this file under
+dnl the terms of any one of the MPL, the GPL or the LGPL.
+dnl
+dnl ***** END LICENSE BLOCK *****
+
+AC_DEFUN(MOZ_PROG_CHECKMSYS,
+[AC_REQUIRE([AC_INIT_BINSH])dnl
+if test `uname -o` = Msys; then
+  msyshost=1
+fi
+])
+
+AC_DEFUN(MOZ_PATH_PROG,
+[ AC_PATH_PROG($1,$2,$3,$4)
+  if test "$msyshost"; then
+    case "[$]$1" in
+    /*)
+      $1="$(cd $(dirname [$]$1) && pwd -W)/$(basename [$]$1)"
+      if test -e "[$]$1.exe"; then
+        $1="[$]$1.exe"
+      fi
+    esac
+  fi
+])
+
+AC_DEFUN(MOZ_PATH_PROGS,
+[  AC_PATH_PROGS($1,$2,$3,$4)
+  if test "$msyshost"; then
+    case "[$]$1" in
+    /*)
+      $1="$(cd $(dirname [$]$1) && pwd -W)/$(basename [$]$1)"
+      if test -e "[$]$1.exe"; then
+        $1="[$]$1.exe"
+      fi
+    esac
+  fi
+])
--- a/js/src/build/unix/mddepend.pl
+++ b/js/src/build/unix/mddepend.pl
@@ -59,16 +59,18 @@ my %alldeps;
 while (<>) {
   s/\r?\n$//; # Handle both unix and DOS line endings
   $line .= $_;
   if ($line =~ /\\$/) {
     chop $line;
     next;
   }
 
+  $line =~ s|\\|/|g;
+
   my ($obj,$rest) = split /\s*:\s+/, $line, 2;
   $line = '';
   next if !$obj || !$rest;
 
   my @deps = split /\s+/, $rest;
   push @{$alldeps{$obj}}, @deps;
   if (DEBUG >= 2) {
     foreach my $dep (@deps) { print "add $obj $dep\n"; }
--- a/js/src/config/rules.mk
+++ b/js/src/config/rules.mk
@@ -76,18 +76,17 @@ endif
 
 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
 ifndef GNU_CC
 _LIBNAME_RELATIVE_PATHS=1
 endif
 endif
 
 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
-PWD := $(shell pwd)
-_VPATH_SRCS = $(if $(filter /%,$<),$<,$(PWD)/$<)
+_VPATH_SRCS = $(if $(filter /%,$<),$<,$(CURDIR)/$<)
 else
 _VPATH_SRCS = $<
 endif
 
 # Add $(DIST)/lib to VPATH so that -lfoo dependencies are followed
 VPATH += $(DIST)/lib
 ifdef LIBXUL_SDK
 VPATH += $(LIBXUL_SDK)/lib
--- a/js/src/configure.in
+++ b/js/src/configure.in
@@ -280,32 +280,32 @@ if test "$target" != "$host"; then
         dnl (see --with-macos-sdk below).
         CFLAGS=$_SAVE_CFLAGS
         CXXFLAGS=$_SAVE_CXXFLAGS
         ;;
     esac
 
     AC_CHECK_PROGS(RANLIB, $RANLIB "${target_alias}-ranlib" "${target}-ranlib", :)
     AC_CHECK_PROGS(AR, $AR "${target_alias}-ar" "${target}-ar", :)
-    AC_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
+    MOZ_PATH_PROGS(AS, $AS "${target_alias}-as" "${target}-as", :)
     AC_CHECK_PROGS(LD, $LD "${target_alias}-ld" "${target}-ld", :)
     AC_CHECK_PROGS(STRIP, $STRIP "${target_alias}-strip" "${target}-strip", :)
     AC_CHECK_PROGS(WINDRES, $WINDRES "${target_alias}-windres" "${target}-windres", :)
     AC_DEFINE(CROSS_COMPILE)
 
     dnl If we cross compile for ppc on Mac OS X x86, cross_compiling will
     dnl have erroneously been set to "no", because the x86 build host is
     dnl able to run ppc code in a translated environment, making a cross
     dnl compiler appear native.  So we override that here.
     cross_compiling=yes
 else
     AC_PROG_CC
     AC_PROG_CXX
     AC_PROG_RANLIB
-    AC_PATH_PROGS(AS, $AS as, $CC)
+    MOZ_PATH_PROGS(AS, $AS as, $CC)
     AC_CHECK_PROGS(AR, ar, :)
     AC_CHECK_PROGS(LD, ld, :)
     AC_CHECK_PROGS(STRIP, strip, :)
     AC_CHECK_PROGS(WINDRES, windres, :)
     if test -z "$HOST_CC"; then
         HOST_CC="$CC"
     fi
     if test -z "$HOST_CFLAGS"; then
@@ -611,17 +611,17 @@ AC_SUBST(GNU_CXX)
 AC_SUBST(INTEL_CC)
 AC_SUBST(INTEL_CXX)
 
 dnl ========================================================
 dnl Checks for programs.
 dnl ========================================================
 AC_PROG_INSTALL
 AC_PROG_LN_S
-AC_PATH_PROGS(PERL, $PERL perl5 perl )
+MOZ_PATH_PROGS(PERL, $PERL perl5 perl )
 if test -z "$PERL" || test "$PERL" = ":"; then
     AC_MSG_ERROR([perl not found in \$PATH])
 fi
 
 if test -z "$TINDERBOX_SKIP_PERL_VERSION_CHECK"; then
 AC_MSG_CHECKING([for minimum required perl version >= $PERL_VERSION])
 _perl_version=`PERL_VERSION=$PERL_VERSION $PERL -e 'print "$]"; if ($] >= $ENV{PERL_VERSION}) { exit(0); } else { exit(1); }' 2>&5`
 _perl_res=$?
@@ -637,39 +637,39 @@ AC_MSG_CHECKING([for full perl installat
 _perl_res=$?
 if test "$_perl_res" != 0; then
     AC_MSG_RESULT([no])
     AC_MSG_ERROR([Cannot find Config.pm or \$Config{archlib}.  A full perl installation is required.])
 else
     AC_MSG_RESULT([yes])    
 fi
 
-AC_PATH_PROGS(PYTHON, $PYTHON python)
+MOZ_PATH_PROGS(PYTHON, $PYTHON python)
 if test -z "$PYTHON"; then
     AC_MSG_ERROR([python was not found in \$PATH])
 fi
 
-AC_PATH_PROGS(NSINSTALL_BIN, nsinstall )
+MOZ_PATH_PROGS(NSINSTALL_BIN, nsinstall )
 if test -z "$COMPILE_ENVIRONMENT"; then
 if test -z "$NSINSTALL_BIN" || test "$NSINSTALL_BIN" = ":"; then
     NSINSTALL_BIN='$(PYTHON) $(topsrcdir)/config/nsinstall.py'
 fi
 fi
 AC_SUBST(NSINSTALL_BIN)
 
-AC_PATH_PROG(DOXYGEN, doxygen, :)
-AC_PATH_PROG(WHOAMI, whoami, :)
-AC_PATH_PROG(AUTOCONF, autoconf, :)
-AC_PATH_PROG(UNZIP, unzip, :)
-AC_PATH_PROGS(ZIP, zip)
+MOZ_PATH_PROG(DOXYGEN, doxygen, :)
+MOZ_PATH_PROG(WHOAMI, whoami, :)
+MOZ_PATH_PROG(AUTOCONF, autoconf, :)
+MOZ_PATH_PROG(UNZIP, unzip, :)
+MOZ_PATH_PROGS(ZIP, zip)
 if test -z "$ZIP" || test "$ZIP" = ":"; then
     AC_MSG_ERROR([zip not found in \$PATH])
 fi
-AC_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
-AC_PATH_PROG(XARGS, xargs)
+MOZ_PATH_PROG(SYSTEM_MAKEDEPEND, makedepend)
+MOZ_PATH_PROG(XARGS, xargs)
 if test -z "$XARGS" || test "$XARGS" = ":"; then
     AC_MSG_ERROR([xargs not found in \$PATH .])
 fi
 
 if test "$COMPILE_ENVIRONMENT"; then
 
 dnl ========================================================
 dnl = Mac OS X toolchain support
@@ -696,32 +696,32 @@ darwin*)
 This compiler was supplied with Xcode 2.0, and contains bugs that prevent it
 from building Mozilla. Upgrade to Xcode 2.1 or later.])
         fi
     fi
 
     dnl xcodebuild needs GCC_VERSION defined in the environment, since it
     dnl doesn't respect the CC/CXX setting.  With GCC_VERSION set, it will use
     dnl /usr/bin/g(cc|++)-$GCC_VERSION.
-    AC_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
+    MOZ_PATH_PROGS(PBBUILD, pbbuild xcodebuild pbxbuild)
 
     case "$PBBUILD" in
       *xcodebuild*)
         changequote(,)
         XCODEBUILD_VERSION=`$PBBUILD -version 2>/dev/null | xargs | sed -e 's/.*DevToolsCore-\([0-9]*\).*/\1/'`
         changequote([,])
         if test -n "$XCODEBUILD_VERSION" && test "$XCODEBUILD_VERSION" -ge 620 ; then
           HAS_XCODE_2_1=1;
         fi
       ;;
     esac
 
     dnl sdp was formerly in /Developer/Tools.  As of Mac OS X 10.4 (Darwin 8),
     dnl it has moved into /usr/bin.
-    AC_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
+    MOZ_PATH_PROG(SDP, sdp, :, [$PATH:/usr/bin:/Developer/Tools])
     ;;
 esac
 
 AC_SUBST(GCC_VERSION)
 AC_SUBST(XCODEBUILD_VERSION)
 AC_SUBST(HAS_XCODE_2_1)
 
 dnl The universal machinery sets UNIVERSAL_BINARY to inform packager.mk
@@ -844,20 +844,20 @@ tools are selected during the Xcode/Deve
 fi
 
 fi # COMPILE_ENVIRONMENT
 
 dnl Be sure the make we use is GNU make.
 dnl on win32, gmake.exe is the generally the wrong version
 case "$host_os" in
 cygwin*|mingw*|mks*|msvc*)
-    AC_PATH_PROGS(MAKE, $MAKE make gmake, :)
+    MOZ_PATH_PROGS(MAKE, $MAKE make gmake, :)
     ;;
 *)
-    AC_PATH_PROGS(MAKE, $MAKE gmake make, :)
+    MOZ_PATH_PROGS(MAKE, $MAKE gmake make, :)
     ;;
 esac
 _make_try=`$MAKE --version 2>/dev/null | grep GNU`
 if test ! "$_make_try"
 then
 	echo
 	echo "*** $MAKE is not GNU Make.  You will not be able to build Mozilla without GNU Make."
 	echo
--- a/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/Makefile.in
+++ b/toolkit/crashreporter/google-breakpad/src/client/windows/crash_generation/Makefile.in
@@ -40,17 +40,17 @@ topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE		= crash_generation
 LIBRARY_NAME	= crash_generation_s
 
-LOCAL_INCLUDES 	= -I$(srcdir)/../../..
+LOCAL_INCLUDES 	= -I$(topsrcdir)/toolkit/crashreporter/google-breakpad/src
 DEFINES += -DUNICODE -D_UNICODE
 
 #XXX: We're not currently building the other parts,
 # which would only be needed on the server side of the equation.
 CPPSRCS		= \
 		crash_generation_client.cc \
 		$(NULL)