summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-12-18 22:41:36 +0000
committerJim Meyering <jim@meyering.net>1999-12-18 22:41:36 +0000
commitdd14c4c5b70b34f8c3aafe14869abc08371193d9 (patch)
tree29a5df10f626c3c1123644ea741112cfe4c17cc8
parentb8d882a71b5c977c6ba6bccd612fda920bac343e (diff)
downloadgnulib-dd14c4c5b70b34f8c3aafe14869abc08371193d9.tar.gz
*** empty log message ***
-rw-r--r--m4/lstat-slash.m441
1 files changed, 41 insertions, 0 deletions
diff --git a/m4/lstat-slash.m4 b/m4/lstat-slash.m4
new file mode 100644
index 0000000000..8f753dadf9
--- /dev/null
+++ b/m4/lstat-slash.m4
@@ -0,0 +1,41 @@
+#serial 1
+
+dnl From Jim Meyering.
+dnl FIXME
+
+AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK,
+[
+ AC_CACHE_CHECK(
+ [whether lstat dereferences a symlink specified with a trailing slash],
+ jm_cv_func_lstat_dereferences_slashed_symlink,
+ [
+ rm -f conftest.sym conftest.file
+ : > conftest.file
+ if ln -s conftest.file conftest.sym; then
+ AC_TRY_RUN([
+# include <sys/types.h>
+# include <sys/stat.h>
+
+ int
+ main ()
+ {
+ struct stat sbuf;
+ exit (lstat ("conftest.sym/", &sbuf) ? 0 : 1);
+ }
+ ],
+ jm_cv_func_lstat_dereferences_slashed_symlink=yes,
+ jm_cv_func_lstat_dereferences_slashed_symlink=no,
+ dnl When crosscompiling, be pessimistic so we'll end up using the
+ dnl replacement version of lstat that checkes for trailing slashes
+ dnl and calls lstat a second time when necessary.
+ jm_cv_func_lstat_dereferences_slashed_symlink=no
+ )
+ ])
+
+ if test $jm_cv_func_lstat_dereferences_slashed_symlink = yes; then
+ AC_SUBST(LIBOBJS)
+ LIBOBJS="$LIBOBJS lstat.$ac_objext"
+ AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, 1,
+ [Define if lstat dereferences a symlink specified with a trailing slash])
+ fi
+])