symlink even if it is "dangling" (it doesn't resolve to a real file).
2005-06-25 Paul D. Smith <psmith@gnu.org>
+ * make.h [WINDOWS32]: #include <direct.h>.
+ Fixes Savannah bug #13478.
+
+ * remake.c (name_mtime): If the stat() of a file fails and the -L
+ option was given and the file is a symlink, take the best mtime of
+ the symlink we can get as the mtime of the file and don't fail.
+ Fixes Savannah bug #13280.
+
Fix Savannah bug #1454.
* read.c (find_char_unquote): Accept a new argument IGNOREVARS.
+2005-06-25 Paul D. Smith <psmith@gnu.org>
+
+ * fnmatch.h, glob.h [WINDOWS32]: Fix ifdefs in headers.
+ Fixes Savannah bug #13477.
+
2005-03-11 Paul D. Smith <psmith@gnu.org>
* glob.c (glob_in_dir): Change FNM_CASEFOLD to be enabled if
#endif
#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
-# if !defined __GLIBC__ || !defined __P
+# if !defined __GLIBC__
# undef __P
# define __P(protos) protos
# endif
#endif /* C++ or ANSI C. */
#ifndef const
-# if (defined __STDC__ && __STDC__) || defined __cplusplus
+# if (defined __STDC__ && __STDC__) || defined __cplusplus || defined WINDOWS32
# define __const const
# else
# define __const
static int prefix_array __P ((const char *prefix, char **array, size_t n));
static int collated_compare __P ((const __ptr_t, const __ptr_t));
-#ifdef VMS
-/* these compilers like prototypes */
#if !defined _LIBC || !defined NO_GLOB_PATTERN_P
-int __glob_pattern_p (const char *pattern, int quote);
-#endif
+int __glob_pattern_p __P ((const char *pattern, int quote));
#endif
/* Find the end of the sub-pattern in a brace expression. We define
#undef __ptr_t
#if defined __cplusplus || (defined __STDC__ && __STDC__) || defined WINDOWS32
-# if !defined __GLIBC__ || !defined __P
+# if !defined __GLIBC__
# undef __P
# undef __PMT
# define __P(protos) protos
# define PATH_SEPARATOR_CHAR ':'
#endif
+/* This is needed for getcwd() and chdir(). */
+#if defined(_MSC_VER) || defined(__BORLANDC__)
+# include <direct.h>
+#endif
+
#ifdef WINDOWS32
# include <fcntl.h>
# include <malloc.h>
#ifdef HAVE_GETCWD
# if !defined(VMS) && !defined(__DECC)
extern char *getcwd ();
-#endif
+# endif
#else
extern char *getwd ();
# define getcwd(buf, len) getwd (buf)
{
unsigned int string_len = 0;
register char *p = string;
- int pcount = 0;
- char openparen;
- char closeparen;
if (ignorevars)
ignorevars = '$';
int e;
EINTRLOOP (e, stat (name, &st));
- if (e != 0)
+ if (e == 0)
+ mtime = FILE_TIMESTAMP_STAT_MODTIME (name, st);
+ else if (errno == ENOENT || errno == ENOTDIR)
+ mtime = NONEXISTENT_MTIME;
+ else
{
- if (errno != ENOENT && errno != ENOTDIR)
- perror_with_name ("stat: ", name);
+ perror_with_name ("stat: ", name);
return NONEXISTENT_MTIME;
}
- mtime = FILE_TIMESTAMP_STAT_MODTIME (name, st);
+
+ /* If we get here we either found it, or it doesn't exist.
+ If it doesn't exist see if we can use a symlink mtime instead. */
#ifdef MAKE_SYMLINKS
#ifndef S_ISLNK
EINTRLOOP (e, lstat (lpath, &st));
if (e)
{
- /* Eh? Just take what we have. */
- perror_with_name ("lstat: ", lpath);
+ /* Just take what we have so far. */
+ if (errno != ENOENT && errno != ENOTDIR)
+ perror_with_name ("lstat: ", lpath);
break;
}
2005-06-25 Paul D. Smith <psmith@gnu.org>
+ * scripts/options/symlinks: Test symlinks to non-existent files.
+ Tests fix for Savannah bug #13280.
+
* scripts/misc/general3: Test semicolons in variable references.
Tests fix for Savannah bug #1454.
run_make_test(undef, '-L', "make targ from sym");
rmfiles('targ', 'dep', 'sym', 'dep1');
+
+ # Check handling when symlinks point to non-existent files. Without -L we
+ # should get an error: with -L we should use the timestamp of the symlink.
+
+ symlink("../$dirname/dep", 'sym');
+ run_make_test('targ: sym ; @echo make $@ from $<', '',
+ "#MAKE#: *** No rule to make target `sym', needed by `targ'. Stop.", 512);
+
+ run_make_test('targ: sym ; @echo make $@ from $<', '-L',
+ 'make targ from sym');
+
+
+ rmfiles('targ', 'sym');
}
1;