2009-09-23 Eric Blake <ebb9@byu.net>
+ lstat: avoid mingw compilation error
+ * m4/lstat.m4 (gl_FUNC_LSTAT): Avoid duplicate calls to
+ AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, and deal with missing
+ lstat ourselves.
+ * lib/lstat.c [!HAVE_LSTAT]: Do nothing if <sys/stat.h> override
+ was adequate.
+ * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Let lstat module handle
+ the checks for lstat.
+ (gl_SYS_STAT_H_DEFAULTS): Set default for HAVE_LSTAT.
+
link: fix test failure on Solaris 9
* lib/link.c (rpl_link): Don't assume link will catch bogus
trailing slash on source.
#include <config.h>
+#if !HAVE_LSTAT
+/* On systems that lack symlinks, our replacement <sys/stat.h> already
+ defined lstat as stat, so there is nothing further to do other than
+ avoid an empty file. */
+typedef int dummy;
+#else /* HAVE_LSTAT */
+
/* Get the original definition of lstat. It might be defined as a macro. */
-#define __need_system_sys_stat_h
-#include <sys/types.h>
-#include <sys/stat.h>
-#undef __need_system_sys_stat_h
+# define __need_system_sys_stat_h
+# include <sys/types.h>
+# include <sys/stat.h>
+# undef __need_system_sys_stat_h
static inline int
orig_lstat (const char *filename, struct stat *buf)
}
/* Specification. */
-#include <sys/stat.h>
+# include <sys/stat.h>
-#include <string.h>
-#include <errno.h>
+# include <string.h>
+# include <errno.h>
/* lstat works differently on Linux and Solaris systems. POSIX (see
`pathname resolution' in the glossary) requires that programs like
}
return stat (file, sbuf);
}
+
+#endif /* HAVE_LSTAT */
-# serial 19
+# serial 20
# Copyright (C) 1997-2001, 2003-2009 Free Software Foundation, Inc.
#
[
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
dnl If lstat does not exist, the replacement <sys/stat.h> does
- dnl "#define lstat stat", and lstat.c does not need to be compiled.
+ dnl "#define lstat stat", and lstat.c is a no-op.
AC_CHECK_FUNCS_ONCE([lstat])
if test $ac_cv_func_lstat = yes; then
- AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
- dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ([lstat]).
+ AC_REQUIRE([AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK])
if test $ac_cv_func_lstat_dereferences_slashed_symlink = no; then
+ dnl Note: AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK does AC_LIBOBJ([lstat]).
REPLACE_LSTAT=1
fi
# Prerequisites of lib/lstat.c.
AC_REQUIRE([AC_C_INLINE])
+ else
+ HAVE_LSTAT=0
fi
])
-# sys_stat_h.m4 serial 16 -*- Autoconf -*-
+# sys_stat_h.m4 serial 17 -*- Autoconf -*-
dnl Copyright (C) 2006-2009 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
dnl gives unlimited permission to copy and/or distribute it,
[
AC_REQUIRE([gl_SYS_STAT_H_DEFAULTS])
- dnl Check for lstat. Systems that lack it (mingw) also lack symlinks, so
- dnl stat is a good replacement.
- AC_CHECK_FUNCS_ONCE([lstat])
- if test $ac_cv_func_lstat = yes; then
- HAVE_LSTAT=1
- else
- HAVE_LSTAT=0
- fi
- AC_SUBST([HAVE_LSTAT])
-
dnl For the mkdir substitute.
AC_REQUIRE([AC_C_INLINE])
HAVE_FCHMODAT=1; AC_SUBST([HAVE_FCHMODAT])
HAVE_FSTATAT=1; AC_SUBST([HAVE_FSTATAT])
HAVE_LCHMOD=1; AC_SUBST([HAVE_LCHMOD])
+ HAVE_LSTAT=1; AC_SUBST([HAVE_LSTAT])
HAVE_MKDIRAT=1; AC_SUBST([HAVE_MKDIRAT])
HAVE_MKFIFOAT=1; AC_SUBST([HAVE_MKFIFOAT])
HAVE_MKNODAT=1; AC_SUBST([HAVE_MKNODAT])