autoconf-patches
[Top][All Lists]
Advanced

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

Re: Overriding LN_S


From: Peter Rosin
Subject: Re: Overriding LN_S
Date: Fri, 15 Oct 2010 09:28:53 +0200
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.9) Gecko/20100915 Thunderbird/3.1.4

[moving to address@hidden

Den 2010-09-07 16:47 skrev Eric Blake:
> On 09/05/2010 03:31 PM, Ralf Wildenhues wrote:
>> Hi Eric,
>>
>> * Eric Blake wrote on Thu, Sep 02, 2010 at 10:47:59PM CEST:
>>> On 09/02/2010 02:43 PM, Ralf Wildenhues wrote:
>>>>
>>>> Well, we /should/ fix Autoconf to allow overriding, and at that point,
>>>> you should be able to override globally with export LN_S=...
>>>> (though I'm not sure if LN_S will be the variable to set, that's not in
>>>> the m4sh name space).
>>>
>>> Well, it's no different than offering overrides for CC, GREP, and
>>> other tool names outside the m4sh name space.  I think the idea of
>>> allowing a pre-existing $LN_S from the user's environment take
>>> precedence makes total sense.
>>
>> Sure.  Question is whether $LN_S should override $as_ln_s also?
> 
> I think so.  In sort, _AS_LN_S_PREPARE should honor an existing LN_S,
> such that $as_ln_s is then set to either the user's preference, or the
> best detected option, among all remaining AS_LN_S invocations.

Like this?

I haven't actually tested the patch, but it seems trivial enough.
The bulk of it is just an indentation change.

I'm starting off with a diff -w of the changes to the m4sh.m4 file
and after that a git patch.

Cheers,
Peter

diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 3c9350a..d20a48f 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -1182,7 +1182,8 @@ _m4_popdef([AS_MESSAGE_LOG_FD], [AS_ERROR])])# _AS_LINENO_
 # config.statuses).  On read-only media, assume 'cp -p' and hope we
 # are just running --help anyway.
 m4_defun([_AS_LN_S_PREPARE],
-[rm -f conf$$ conf$$.exe conf$$.file
+[if test -z "$LN_S"; then
+  rm -f conf$$ conf$$.exe conf$$.file
 if test -d conf$$.dir; then
   rm -f conf$$.dir/conf$$.file
 else
@@ -1208,6 +1209,9 @@ else
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
+else
+  as_ln_s=$LN_S
+endif
 ])# _AS_LN_S_PREPARE


>From 2d11f3141128aa2dec277119b273e455620e280b Mon Sep 17 00:00:00 2001
From: Peter Rosin <address@hidden>
Date: Fri, 15 Oct 2010 09:18:46 +0200
Subject: [PATCH] AS_LN_S: allow overriding with LN_S in the environment.

* lib/m4sugar/m4sh.m4 (_AS_LN_S_PREPARE): If LN_S is non-empty,
let that override the test.
* doc/autoconf.texi (Particular Programs): Mention that LN_S
overrides AC_PROG_LN_S.

Signed-off-by: Peter Rosin <address@hidden>
---
 ChangeLog           |    8 ++++++++
 doc/autoconf.texi   |    3 +++
 lib/m4sugar/m4sh.m4 |   46 +++++++++++++++++++++++++---------------------
 3 files changed, 36 insertions(+), 21 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 9217438..1837512 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2010-10-15  Peter Rosin  <address@hidden>
+
+       AS_LN_S: allow overriding with LN_S in the environment.
+       * lib/m4sugar/m4sh.m4 (_AS_LN_S_PREPARE): If LN_S is non-empty,
+       let that override the test.
+       * doc/autoconf.texi (Particular Programs): Mention that LN_S
+       overrides AC_PROG_LN_S.
+
 2010-10-12  Ralf Wildenhues  <address@hidden>
 
        tests: avoid AC_CACHE_CHECK test failure with dash.
diff --git a/doc/autoconf.texi b/doc/autoconf.texi
index b957083..aeeef0e 100644
--- a/doc/autoconf.texi
+++ b/doc/autoconf.texi
@@ -4119,6 +4119,9 @@ and file system support symbolic links), set the output 
variable
 @code{LN_S} to @samp{ln -s}; otherwise, if @samp{ln} works, set
 @code{LN_S} to @samp{ln}, and otherwise set it to @samp{cp -p}.
 
+The result of this test can be overridden by setting the @code{LN_S}
+variable.
+
 If you make a link in a directory other than the current directory, its
 meaning depends on whether @samp{ln} or @samp{ln -s} is used.  To safely
 create links using @samp{$(LN_S)}, either find out which form is used
diff --git a/lib/m4sugar/m4sh.m4 b/lib/m4sugar/m4sh.m4
index 3c9350a..d20a48f 100644
--- a/lib/m4sugar/m4sh.m4
+++ b/lib/m4sugar/m4sh.m4
@@ -1182,32 +1182,36 @@ _m4_popdef([AS_MESSAGE_LOG_FD], [AS_ERROR])])# 
_AS_LINENO_PREPARE
 # config.statuses).  On read-only media, assume 'cp -p' and hope we
 # are just running --help anyway.
 m4_defun([_AS_LN_S_PREPARE],
-[rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
-  if ln -s conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s='ln -s'
-    # ... but there are two gotchas:
-    # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-    # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
-    ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+[if test -z "$LN_S"; then
+  rm -f conf$$ conf$$.exe conf$$.file
+  if test -d conf$$.dir; then
+    rm -f conf$$.dir/conf$$.file
+  else
+    rm -f conf$$.dir
+    mkdir conf$$.dir 2>/dev/null
+  fi
+  if (echo >conf$$.file) 2>/dev/null; then
+    if ln -s conf$$.file conf$$ 2>/dev/null; then
+      as_ln_s='ln -s'
+      # ... but there are two gotchas:
+      # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+      # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+      # In both cases, we have to default to `cp -p'.
+      ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+       as_ln_s='cp -p'
+    elif ln conf$$.file conf$$ 2>/dev/null; then
+      as_ln_s=ln
+    else
       as_ln_s='cp -p'
-  elif ln conf$$.file conf$$ 2>/dev/null; then
-    as_ln_s=ln
+    fi
   else
     as_ln_s='cp -p'
   fi
+  rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
+  rmdir conf$$.dir 2>/dev/null
 else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
+  as_ln_s=$LN_S
+endif
 ])# _AS_LN_S_PREPARE
 
 
-- 
1.7.1




reply via email to

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