X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=m4%2Flink.m4;h=ed8427a9b2dff7ec8827528ece19ef6f2ca69e40;hb=effe7821374f8b7e22e9de3df9cc4e5f285712bd;hp=0ca85d3a8bed25fa4c2bf6133b1ba5dca59f7255;hpb=b2e2010c7c902235b5efb5bd3c6529f61b093aa4;p=gnulib.git diff --git a/m4/link.m4 b/m4/link.m4 index 0ca85d3a8..ed8427a9b 100644 --- a/m4/link.m4 +++ b/m4/link.m4 @@ -1,5 +1,5 @@ -# link.m4 serial 4 -dnl Copyright (C) 2009, 2010 Free Software Foundation, Inc. +# 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, dnl with or without modifications, as long as this notice is preserved. @@ -10,9 +10,8 @@ AC_DEFUN([gl_FUNC_LINK], AC_CHECK_FUNCS_ONCE([link]) if test $ac_cv_func_link = no; then HAVE_LINK=0 - AC_LIBOBJ([link]) 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. @@ -22,17 +21,25 @@ AC_DEFUN([gl_FUNC_LINK], AC_RUN_IFELSE( [AC_LANG_PROGRAM( [[#include -]], [[if (!link ("conftest.a", "conftest.b/")) return 1; + ]], + [[int result = 0; + if (!link ("conftest.a", "conftest.b/")) + result |= 1; #if HAVE_LSTAT - if (!link ("conftest.lnk/", "conftest.b")) return 2; + 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; ]])], [gl_cv_func_link_works=yes], [gl_cv_func_link_works=no], [gl_cv_func_link_works="guessing no"]) rm -f conftest.a conftest.b conftest.lnk]) if test "$gl_cv_func_link_works" != yes; then REPLACE_LINK=1 - AC_LIBOBJ([link]) fi fi ])