Some Windows fixes to allow builds to succeed.
authorPaul Smith <psmith@gnu.org>
Wed, 10 Oct 2007 04:32:15 +0000 (04:32 +0000)
committerPaul Smith <psmith@gnu.org>
Wed, 10 Oct 2007 04:32:15 +0000 (04:32 +0000)
ChangeLog
build_w32.bat
dir.c
make.h

index fa6847d27b26301d3f3df7265df65128457d20dd..c9d3eb165aa0ed25b0b9efeab16fbcfffd4bed8b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2007-10-10  Eli Zaretskii  <eliz@gnu.org>
+
+       * dir.c (find_directory) [WINDOWS32]: Remove trailing slashes from
+       pathnames, with const strings.
+       * build_w32.bat [WINDOWS32]: If no config.h.W32 exists, create one
+       from the template (used for building from CVS, not a dist).
+
+2007-10-10  Paul Smith  <psmith@gnu.org>
+
+       * make.h: Add a prototype for w32_kill() (change suggested by
+       Yongwei Wu <wuyongwei@gmail.com>).
+
 2007-08-15  Paul Smith  <psmith@gnu.org>
 
        * doc/make.texi (GNU Free Documentation License): The fdl.texi
index 7d10e61c47350fb1fe99a94518878fc5a6573241..38c9e806d5f5f6187163d65c3138219c260f7f8c 100644 (file)
@@ -16,6 +16,11 @@ rem
 rem You should have received a copy of the GNU General Public License along\r
 rem with this program.  If not, see <http://www.gnu.org/licenses/>.\r
 \r
+if exist config.h.W32 GoTo NotCVS\r
+sed -n "s/^AC_INIT(\[GNU make\],\[\([^]]\+\)\].*/s,%%VERSION%%,\1,g/p" configure.in > config.h.W32.sed\r
+echo s,%%PACKAGE%%,make,g >> config.h.W32.sed\r
+sed -f config.h.W32.sed config.h.W32.template > config.h.W32\r
+:NotCVS\r
 if not exist config.h copy config.h.W32 config.h\r
 cd w32\subproc\r
 echo "Creating the subproc library"\r
diff --git a/dir.c b/dir.c
index 7a3cdba5f0510e5b9e3da091111c08670a7d1f30..4f3732a1526ca8a421d010bf1c877c40e05c6869 100644 (file)
--- a/dir.c
+++ b/dir.c
@@ -454,26 +454,29 @@ find_directory (const char *name)
       /* The directory is not in the name hash table.
         Find its device and inode numbers, and look it up by them.  */
 
-#ifdef WINDOWS32
-      /* Remove any trailing '\'.  Windows32 stat fails even on valid
-         directories if they end in '\'. */
-      if (p[-1] == '\\')
-        p[-1] = '\0';
-#endif
-
 #ifdef VMS
       r = vmsstat_dir (name, &st);
+#elif defined(WINDOWS32)
+      {
+        char tem[MAXPATHLEN], *tstart, *tend;
+
+        /* Remove any trailing slashes.  Windows32 stat fails even on
+           valid directories if they end in a slash. */
+        memcpy (tem, name, p - name + 1);
+        tstart = tem;
+        if (tstart[1] == ':')
+          tstart += 2;
+        for (tend = tem + (p - name - 1);
+             tend > tstart && (*tend == '/' || *tend == '\\');
+             tend--)
+          *tend = '\0';
+
+        r = stat (tem, &st);
+      }
 #else
       EINTRLOOP (r, stat (name, &st));
 #endif
 
-#ifdef WINDOWS32
-      /* Put back the trailing '\'.  If we don't, we're permanently
-         truncating the value!  */
-      if (p[-1] == '\0')
-        p[-1] = '\\';
-#endif
-
       if (r < 0)
         {
        /* Couldn't stat the directory.  Mark this by
diff --git a/make.h b/make.h
index b379ff602ac7ba032f6fd2aa02156a5b729b51a0..6cdcfb96db164a7537fad17b6c507e747ee1b0b6 100644 (file)
--- a/make.h
+++ b/make.h
@@ -329,7 +329,7 @@ char *strsignal (int signum);
 # define kill(_pid,_sig) w32_kill((_pid),(_sig))
 
 void sync_Path_environment (void);
-int kill (int pid, int sig);
+int w32_kill (int pid, int sig);
 char *end_of_token_w32 (const char *s, char stopchar);
 int find_and_set_default_shell (const char *token);