3 dnl Copyright (C) 2009-2024 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 # See if we need to provide symlink replacement.
10 # Written by Eric Blake.
12 AC_DEFUN([gl_FUNC_SYMLINK],
14 AC_REQUIRE([gl_UNISTD_H_DEFAULTS])
15 AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
16 AC_CHECK_FUNCS_ONCE([symlink])
17 dnl The best we can do on mingw is provide a dummy that always fails, so
18 dnl that compilation can proceed with fewer ifdefs. On FreeBSD 7.2, AIX 7.1,
19 dnl and Solaris 9, we want to fix a bug with trailing slash handling.
20 if test $ac_cv_func_symlink = no; then
23 AC_CACHE_CHECK([whether symlink handles trailing slash correctly],
24 [gl_cv_func_symlink_works],
30 if (!symlink ("a", "conftest.link/"))
32 if (symlink ("conftest.f", "conftest.lnk2"))
34 else if (!symlink ("a", "conftest.lnk2/"))
38 [gl_cv_func_symlink_works=yes], [gl_cv_func_symlink_works=no],
40 # Guess yes on Linux systems.
41 linux-* | linux) gl_cv_func_symlink_works="guessing yes" ;;
42 # Guess yes on systems that emulate the Linux system calls.
43 midipix*) gl_cv_func_symlink_works="guessing yes" ;;
44 # Guess yes on glibc systems.
45 *-gnu* | gnu*) gl_cv_func_symlink_works="guessing yes" ;;
46 # If we don't know, obey --enable-cross-guesses.
47 *) gl_cv_func_symlink_works="$gl_cross_guess_normal" ;;
50 rm -f conftest.f conftest.link conftest.lnk2])
51 case "$gl_cv_func_symlink_works" in