autoconf-patches
[Top][All Lists]
Advanced

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

Re: Something I forgot in my AC_LN_S patch


From: Akim Demaille
Subject: Re: Something I forgot in my AC_LN_S patch
Date: 26 Jan 2001 16:56:14 +0100
User-agent: Gnus/5.0808 (Gnus v5.8.8) XEmacs/21.1 (Crater Lake)

>>>>> "Akim" == Akim Demaille <address@hidden> writes:

>>> How about always running AC_LN_S?

Alexandre> Ok with me.  And make it expand only once, just in case...

Akim> In fact I would have _AC_LN_S and AU_DEFUN AC_LN_S to nothing.

On second thought, it is good to compute LN_S, but parsimony with
AC_SUBST is good IMHO.  And the day Automake wants to use it, it just
needs to AC_REQUIRE it in its AM_INIT.

So this is what I would suggest.

It turns out that all the work is completely useless for Autoconf as
the only place where it could be useful is a place where it must not
be used, since some magic is required to properly set the relative
paths (`ln -s a/b c/d' has nothing to do with `ln a/b c/d').  So I'm
unsure you'd want to apply it anyway...

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        Follow Tim Van Holder's suggestions for a uniform handling of
        symlinks.

        * m4sh.m4: Stay in `as_', not `ac_'.
        (_AS_LN_S_PREPARE): Eve out from...
        * acspecific.m4 (AC_PROG_LN_S): here.  Adjust.
        * m4sh.m4 (AS_LN_S): New.
        (AS_SHELL_PREPARE): Call _AS_LN_S_PREPARE.

Index: acgeneral.m4
===================================================================
RCS file: /cvs/autoconf/acgeneral.m4,v
retrieving revision 1.681
diff -u -u -r1.681 acgeneral.m4
--- acgeneral.m4 2001/01/26 14:34:04 1.681
+++ acgeneral.m4 2001/01/26 15:46:22
@@ -4284,10 +4284,9 @@
   esac

   # Make a symlink if possible; otherwise try a hard link.
-  if ln -s $ac_rel_source $ac_dest 2>/dev/null ||
-     ln $srcdir/$ac_source $ac_dest; then :; else
+  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])
-  fi
 m4_ifset([AC_LIST_LINKS_COMMANDS],
 [  # Run the commands associated with the file.
   case $ac_file in
Index: acspecific.m4
===================================================================
RCS file: /cvs/autoconf/acspecific.m4,v
retrieving revision 1.331
diff -u -u -r1.331 acspecific.m4
--- acspecific.m4 2001/01/23 17:04:36 1.331
+++ acspecific.m4 2001/01/26 15:46:23
@@ -268,28 +268,8 @@
 # ------------
 AC_DEFUN([AC_PROG_LN_S],
 [AC_MSG_CHECKING([whether ln -s works])
-AC_CACHE_VAL(ac_cv_prog_LN_S,
-[rm -f conftest conftest.exe conftest.file
-echo >conftest.file
-dnl Don't use conftest.sym to avoid filename issues on DJGPP, where this
-dnl would yield conftest.sym.exe for DJGPP < 2.04.
-if ln -s conftest.file conftest 2>/dev/null; then
-  # We could just check for DJGPP; but this test a) works b) is more generic
-  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
-  if test -f conftest.exe; then
-    ac_cv_prog_LN_S="cp -p" # Don't use ln at all; we don't have any links
-  else
-    ac_cv_prog_LN_S="ln -s"
-  fi
-elif ln conftest.file conftest 2>/dev/null; then
-  ac_cv_prog_LN_S=ln
-else
-  ac_cv_prog_LN_S=cp
-fi
-rm -f conftest conftest.exe conftest.file])dnl
-ac_ln_s=$ac_cv_prog_LN_S
-AC_SUBST([LN_S], [$ac_cv_prog_LN_S])
-if test "$ac_cv_prog_LN_S" = "ln -s"; then
+AC_SUBST([LN_S], [$as_ln_s])dnl
+if test "$LN_S" = "ln -s"; then
   AC_MSG_RESULT([yes])
 else
   AC_MSG_RESULT([no, using $LN_S])
Index: m4sh.m4
===================================================================
RCS file: /cvs/autoconf/m4sh.m4,v
retrieving revision 1.28
diff -u -u -r1.28 m4sh.m4
--- m4sh.m4 2001/01/24 08:24:44 1.28
+++ m4sh.m4 2001/01/26 15:46:27
@@ -67,6 +67,7 @@
 fi

 _AS_EXPR_PREPARE
+_AS_LN_S_PREPARE
 _AS_TEST_PREPARE
 _AS_UNSET_PREPARE

@@ -82,9 +83,9 @@

 # IFS
 # We need space, tab and new line, in precisely that order.
-ac_nl='
+as_nl='
 '
-IFS="  $ac_nl"
+IFS="  $as_nl"

 # CDPATH.
 AS_UNSET([CDPATH], [:])
@@ -149,7 +150,7 @@
 # AS_UNSET(VAR, [VALUE-IF-UNSET-NOT-SUPPORTED = `'])
 # --------------------------------------------------
 # Try to unset the env VAR, otherwise set it to
-# VALUE-IF-UNSET-NOT-SUPPORTED.  `ac_unset' must have been computed.
+# VALUE-IF-UNSET-NOT-SUPPORTED.  `as_unset' must have been computed.
 m4_defun([AS_UNSET],
 [m4_require([_AS_UNSET_PREPARE])dnl
 $as_unset $1 || test "${$1+set}" != set || { $1=$2; export $1; }])
@@ -313,22 +314,57 @@
 ])# _AS_EXPR_PREPARE


+# _AS_LN_S_PREPARE
+# ----------------
+# Don't use conftest.sym to avoid filename issues on DJGPP, where this
+# would yield conftest.sym.exe for DJGPP < 2.04.
+m4_defun([_AS_LN_S_PREPARE],
+[rm -f conftest conftest.exe conftest.file
+echo >conftest.file
+if ln -s conftest.file conftest 2>/dev/null; then
+  # We could just check for DJGPP; but this test a) works b) is more generic
+  # and c) will remain valid once DJGPP supports symlinks (DJGPP 2.04).
+  if test -f conftest.exe; then
+    # Don't use ln at all; we don't have any links
+    as_ln_s='cp -p'
+  else
+    as_ln_s='ln -s'
+  fi
+elif ln conftest.file conftest 2>/dev/null; then
+  as_ln_s=ln
+else
+  as_ln_s='cp -p'
+fi
+rm -f conftest conftest.exe conftest.file
+])# _AS_LN_S_PREPARE
+
+
+# AS_LN_S(FILE, LINK)
+# -------------------
+# FIXME: Should we add the glue code to handle properly relative symlinks
+# simulated with `ln' or `cp'?
+m4_defun([AS_LN_S],
+[m4_require([_AS_LN_S_PREPARE])dnl
+$as_ln_s $1 $2
+])
+
+
 # AS_MKDIR_P(PATH)
 # ----------------
 # Emulate `mkdir -p' with plain `mkdir'.
 m4_define([AS_MKDIR_P],
 [{ case $1 in
-  [[\\/]]* | ?:[[\\/]]* ) ac_incr_dir=;;
-  *)                      ac_incr_dir=.;;
+  [[\\/]]* | ?:[[\\/]]* ) as_incr_dir=;;
+  *)                      as_incr_dir=.;;
 esac
-ac_dummy=$1
-for ac_mkdir_dir in `IFS='\\/'; set X $ac_dummy; shift; echo 
"address@hidden"`; do
-  case $ac_mkdir_dir in
+as_dummy=$1
+for as_mkdir_dir in `IFS='\\/'; set X $as_dummy; shift; echo 
"address@hidden"`; do
+  case $as_mkdir_dir in
     # Skip DOS drivespec
-    ?:) ac_incr_dir=$ac_mkdir_dir ;;
+    ?:) as_incr_dir=$as_mkdir_dir ;;
     *)
-      ac_incr_dir=$ac_incr_dir/$ac_mkdir_dir
-      test -d "$ac_incr_dir" || mkdir "$ac_incr_dir"
+      as_incr_dir=$as_incr_dir/$as_mkdir_dir
+      test -d "$as_incr_dir" || mkdir "$as_incr_dir"
     ;;
   esac
 done; }
Index: doc/autoconf.texi
===================================================================
RCS file: /cvs/autoconf/doc/autoconf.texi,v
retrieving revision 1.423
diff -u -u -r1.423 autoconf.texi
--- doc/autoconf.texi 2001/01/24 08:24:44 1.423
+++ doc/autoconf.texi 2001/01/26 15:46:44
@@ -2791,7 +2791,7 @@
 If @samp{ln -s} works on the current file system (the operating system
 and file system support symbolic links), set output variable @code{LN_S}
 to @samp{ln -s}, otherwise if @samp{ln} works, set @code{LN_S} to
address@hidden, and otherwise set to @samp{cp}.
address@hidden, and otherwise set to @samp{cp -p}.

 If the link is put in a directory other than the current directory, its
 meaning depends on whether @samp{ln} or @samp{ln -s} is used.  To safely




reply via email to

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