link: work around IRIX bug
[gnulib.git] / m4 / link.m4
index 2f1a439..ed8427a 100644 (file)
@@ -1,4 +1,4 @@
-# link.m4 serial 6
+# link.m4 serial 7
 dnl Copyright (C) 2009-2011 Free Software Foundation, Inc.
 dnl This file is free software; the Free Software Foundation
 dnl gives unlimited permission to copy and/or distribute it,
@@ -11,7 +11,7 @@ AC_DEFUN([gl_FUNC_LINK],
   if test $ac_cv_func_link = no; then
     HAVE_LINK=0
   else
-    AC_CACHE_CHECK([whether link handles trailing slash correctly],
+    AC_CACHE_CHECK([whether link obeys POSIX],
       [gl_cv_func_link_works],
       [touch conftest.a
        # Assume that if we have lstat, we can also check symlinks.
@@ -28,6 +28,10 @@ AC_DEFUN([gl_FUNC_LINK],
 #if HAVE_LSTAT
              if (!link ("conftest.lnk/", "conftest.b"))
                result |= 2;
+             if (rename ("conftest.a", "conftest.b"))
+               result |= 4;
+             if (!link ("conftest.b", "conftest.lnk"))
+               result |= 8;
 #endif
              return result;
            ]])],