+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
# 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@
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; \
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)