X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Flstat-slash.m4;h=4015f34ed7be1c205fa37f3ae154819e1214f70d;hb=cffbc793a1a9291ed6b09d401a4c3816847a656c;hp=8f753dadf9e4f8e3922b9ebea8a46351e531bcae;hpb=dd14c4c5b70b34f8c3aafe14869abc08371193d9;p=gnulib.git diff --git a/m4/lstat-slash.m4 b/m4/lstat-slash.m4 index 8f753dadf..4015f34ed 100644 --- a/m4/lstat-slash.m4 +++ b/m4/lstat-slash.m4 @@ -1,7 +1,7 @@ #serial 1 dnl From Jim Meyering. -dnl FIXME +dnl FIXME: describe AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, [ @@ -20,22 +20,38 @@ AC_DEFUN(jm_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK, main () { struct stat sbuf; + /* Linux will dereference the symlink and fail. + That is better in the sense that it means we will not + have to compile and use the lstat wrapper. */ 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 When crosscompiling, be pessimistic so we will 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 ) + else + # If the `ln -s' command failed, then we probably don't even + # have an lstat function. + jm_cv_func_lstat_dereferences_slashed_symlink=no + fi ]) - if test $jm_cv_func_lstat_dereferences_slashed_symlink = yes; then + test $jm_cv_func_lstat_dereferences_slashed_symlink = yes \ + && zero_one=1 \ + || zero_one=0 + AC_DEFINE_UNQUOTED(LSTAT_FOLLOWS_SLASHED_SYMLINK, $zero_one, + [Define if lstat dereferences a symlink specified with a trailing slash]) + + if test $jm_cv_func_lstat_dereferences_slashed_symlink = no; 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]) + # Append lstat.o if it's not already in $LIBOBJS. + case "$LIBOBJS" in + *lstat.$ac_objext*) ;; + *) LIBOBJS="$LIBOBJS lstat.$ac_objext" ;; + esac fi ])