autoconf-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: shouldn't AC_CONFIG_LINKS make copies if it can't make links?


From: Paul Eggert
Subject: Re: shouldn't AC_CONFIG_LINKS make copies if it can't make links?
Date: Thu, 6 Jun 2002 10:59:50 -0700 (PDT)

> From: Akim Demaille <address@hidden>
> Date: 06 Jun 2002 18:25:17 +0200
> 
> This is wrong to me, as
>         ln -s foo/bar baz/qux
> and
>         ln foo/bar baz/qux
> have completely different semantics.

Good point, thanks.  I installed the following change instead.

2002-06-06  Paul Eggert  <address@hidden>

        * lib/autoconf/status.m4 (_AC_OUTPUT_LINKS): Fall back on cp
        if ln doesn't work.
        * NEWS: Likewise.
        * doc/autoconf.texi (Configuration Links): Likewise.
        (Limitations of Usual Tools): Prefer $(LN_S) to ln -s || ln.

Index: NEWS
===================================================================
RCS file: /cvsroot/autoconf/autoconf/NEWS,v
retrieving revision 1.243
diff -p -u -r1.243 NEWS
--- NEWS        29 May 2002 22:31:36 -0000      1.243
+++ NEWS        6 Jun 2002 17:52:19 -0000
@@ -11,6 +11,7 @@
 
 ** Macros
 
+- AC_CONFIG_LINKS now makes copies if it can't make links.
 - AC_FUNC_FNMATCH now tests only for POSIX compatibility, reverting to
   Autoconf 2.13 behavior.  The new macro AC_FUNC_FNMATCH_GNU also tests for
   GNU extensions to fnmatch.  Both macros now accept an optional argument
Index: doc/autoconf.texi
===================================================================
RCS file: /cvsroot/autoconf/autoconf/doc/autoconf.texi,v
retrieving revision 1.629
diff -p -u -r1.629 autoconf.texi
--- doc/autoconf.texi   29 May 2002 22:30:56 -0000      1.629
+++ doc/autoconf.texi   6 Jun 2002 17:52:23 -0000
@@ -2700,10 +2700,10 @@ built in another directory than its sour
 @cindex Links
 Make @code{AC_OUTPUT} link each of the existing files @var{source} to
 the corresponding link name @var{dest}.  Makes a symbolic link if
-possible, otherwise a hard link.  The @var{dest} and @var{source} names
-should be relative to the top level source or build directory.  This
-macro is one of the instantiating macros, see @ref{Configuration
-Actions}.
+possible, otherwise a hard link if possible, otherwise a copy.  The
address@hidden and @var{source} names should be relative to the top level
+source or build directory.  This macro is one of the instantiating
+macros, see @ref{Configuration Actions}.
 
 For example, this call:
 
@@ -9849,7 +9849,7 @@ extended regular expressions and alterna
 @prindex @command{ln}
 @cindex Symbolic links
 Don't rely on @command{ln} having a @option{-f} option.  Symbolic links
-are not available on old systems, use @samp{ln} as a fall back.
+are not available on old systems; use @samp{$(LN_S)} as a portable substitute.
 
 For versions of the DJGPP before 2.04, @command{ln} emulates soft links
 for executables by generating a stub that in turn calls the real
Index: lib/autoconf/status.m4
===================================================================
RCS file: /cvsroot/autoconf/autoconf/lib/autoconf/status.m4,v
retrieving revision 1.26
diff -p -u -r1.26 status.m4
--- lib/autoconf/status.m4      29 May 2002 22:26:43 -0000      1.26
+++ lib/autoconf/status.m4      6 Jun 2002 17:52:24 -0000
@@ -777,10 +777,11 @@ for ac_file in : $CONFIG_LINKS; do test 
       *) ac_rel_source=$ac_top_builddir$srcdir/$ac_source ;;
   esac
 
-  # Make a symlink if possible; otherwise try a hard link.
+  # Try a symlink, then a hard link, then a copy.
   ln -s $ac_rel_source $ac_dest 2>/dev/null ||
-    ln $srcdir/$ac_source $ac_dest ||
-    AC_MSG_ERROR([cannot link $ac_dest to $srcdir/$ac_source])
+    ln $srcdir/$ac_source $ac_dest 2>/dev/null ||
+    cp -p $srcdir/$ac_source $ac_dest ||
+    AC_MSG_ERROR([cannot link or copy $srcdir/$ac_source to $ac_dest])
 m4_ifset([AC_LIST_LINKS_COMMANDS],
 [  # Run the commands associated with the file.
   case $ac_file in



reply via email to

[Prev in Thread] Current Thread [Next in Thread]