- AC_CACHE_CHECK(
- [whether link(2) dereferences a symlink specified with a trailing slash],
- gl_ac_cv_func_link_follows_symlink,
- [
- # Create a regular file.
- echo > conftest.file
- AC_TRY_RUN(
- [
+ AC_CHECK_FUNCS_ONCE([readlink])
+ dnl Mingw lacks link, although gnulib provides a good replacement.
+ dnl However, it also lacks symlink, so there's nothing to test in
+ dnl the first place, and no reason to need to distinguish between
+ dnl linkat variants. So, we set LINK_FOLLOWS_SYMLINKS to 0.
+ gl_link_follows_symlinks=0 # assume GNU behavior
+ if test $ac_cv_func_readlink = yes; then
+ AC_CACHE_CHECK([whether link(2) dereferences a symlink],
+ gl_cv_func_link_follows_symlink,
+ [
+ # Create a regular file.
+ echo > conftest.file
+ AC_RUN_IFELSE([AC_LANG_SOURCE([[