Replace AC_PROG_LN_S by a less strict configure test
authorGlenn Morris <rgm@gnu.org>
Thu, 18 Apr 2013 05:03:53 +0000 (22:03 -0700)
committerGlenn Morris <rgm@gnu.org>
Thu, 18 Apr 2013 05:03:53 +0000 (22:03 -0700)
* configure.ac (AC_PROG_LN_S): Remove, too restrictive.
(LN_S_FILEONLY): New output variable.
* Makefile.in (LN_S): Remove.
(LN_S_FILEONLY): New, set by configure.
(install-arch-dep): Use LN_S_FILEONLY rather than LN_S.

ChangeLog
Makefile.in
configure.ac

index f8a3a5e..573a802 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2013-04-18  Glenn Morris  <rgm@gnu.org>
+
+       * configure.ac (AC_PROG_LN_S): Remove, too restrictive.
+       (LN_S_FILEONLY): New output variable.
+       * Makefile.in (LN_S): Remove.
+       (LN_S_FILEONLY): New, set by configure.
+       (install-arch-dep): Use LN_S_FILEONLY rather than LN_S.
+
 2013-04-12  Ken Brown  <kbrown@cornell.edu>
 
        * configure.ac (canonical): Adapt to 64-bit Cygwin, for which
index bd77fa6..019460a 100644 (file)
@@ -253,7 +253,8 @@ INSTALL_INFO = @INSTALL_INFO@
 # By default, we uphold the dignity of our programs.
 INSTALL_STRIP =
 MKDIR_P = @MKDIR_P@
-LN_S = @LN_S@
+# Create a link to a file in the same directory as the target.
+LN_S_FILEONLY = @LN_S_FILEONLY@
 
 # We use gzip to compress installed .el files.
 GZIP_PROG = @GZIP_PROG@
@@ -455,7 +456,7 @@ install-arch-dep: src install-arch-indep install-doc
          chmod 1755 $(DESTDIR)${bindir}/$(EMACSFULL) || true; \
          if test "x${NO_BIN_LINK}" = x; then \
            rm -f $(DESTDIR)${bindir}/$(EMACS) ; \
-           cd $(DESTDIR)${bindir} && $(LN_S) $(EMACSFULL) $(EMACS); \
+           cd $(DESTDIR)${bindir} && $(LN_S_FILEONLY) $(EMACSFULL) $(EMACS); \
          fi; \
        else \
          subdir=${ns_appresdir}/site-lisp; \
index c950724..39a0477 100644 (file)
@@ -799,7 +799,38 @@ dnl AC_PROG_MKDIR_P
 dnl if test "x$RANLIB" = x; then
 dnl   AC_PROG_RANLIB
 dnl fi
-AC_PROG_LN_S
+
+
+dnl Sadly, AC_PROG_LN_S is too restrictive.  It also tests whether links
+dnl can be made to directories.  This is not relevant for our usage, and
+dnl excludes some cases that work fine for us.  Eg MS Windows or files
+dnl hosted on AFS, both examples where simple links work, but links to
+dnl directories fail.  We use a cut-down version instead.
+dnl AC_PROG_LN_S
+
+AC_MSG_CHECKING([whether ln -s works for files in the same directory])
+rm -f conf$$ conf$$.file
+
+LN_S_FILEONLY='cp -p'
+
+if (echo >conf$$.file) 2>/dev/null; then
+  if ln -s conf$$.file conf$$ 2>/dev/null; then
+    LN_S_FILEONLY='ln -s'
+  elif ln conf$$.file conf$$ 2>/dev/null; then
+    LN_S_FILEONLY=ln
+  fi
+fi
+
+rm -f conf$$ conf$$.file
+
+if test "$LN_S_FILEONLY" = "ln -s"; then
+   AC_MSG_RESULT([yes])
+else
+   AC_MSG_RESULT([no, using $LN_S_FILEONLY])
+fi
+
+AC_SUBST(LN_S_FILEONLY)
+
 
 AC_PATH_PROG(INSTALL_INFO, install-info, :,
   $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin)