Replaced run-time detection of hard-link support with compile- time
authorDavid Levine <levinedl@acm.org>
Mon, 11 Jun 2012 03:50:24 +0000 (22:50 -0500)
committerDavid Levine <levinedl@acm.org>
Mon, 11 Jun 2012 03:50:24 +0000 (22:50 -0500)
detection.  This way, Cygwin packages can be built on NTFS or other
filesystems but still bee installed on FAT file systems, which do not
support hard links.

Makefile.am
configure.ac

index d64fa3c..d55479c 100644 (file)
@@ -417,10 +417,6 @@ etc/sendfiles: $(srcdir)/etc/sendfiles.in Makefile
 ##
 ## This rule gets called at "make install" time; we use it to create links
 ## between different programs.
-## On Cygwin, the choice of ln or ln -s must be made at install time,
-## not configure time, because some filesystems (NTFS) support hard
-## links but others (FAT32) don't.  The fallback to cp -p might not be
-## needed, but it's here just in case.
 ##
 install-exec-hook:
        rm -f $(DESTDIR)$(bindir)/flists$(EXEEXT)
@@ -430,29 +426,13 @@ install-exec-hook:
        rm -f $(DESTDIR)$(bindir)/unseen$(EXEEXT)
        rm -f $(DESTDIR)$(bindir)/prev$(EXEEXT)
        rm -f $(DESTDIR)$(bindir)/next$(EXEEXT)
-       cd $(DESTDIR)$(bindir) && \
-         if ln flist$(EXEEXT) flists$(EXEEXT) 2>/dev/null && \
-           ln folder$(EXEEXT) folders$(EXEEXT) && \
-           ln new$(EXEEXT) fnext$(EXEEXT) && \
-           ln new$(EXEEXT) fprev$(EXEEXT) && \
-           ln new$(EXEEXT) unseen$(EXEEXT) && \
-           ln show$(EXEEXT) prev$(EXEEXT) && \
-           ln show$(EXEEXT) next$(EXEEXT); then :; \
-         elif ln -s flist$(EXEEXT) flists$(EXEEXT) 2>/dev/null && \
-           ln -s folder$(EXEEXT) folders$(EXEEXT) && \
-           ln -s new$(EXEEXT) fnext$(EXEEXT) && \
-           ln -s new$(EXEEXT) fprev$(EXEEXT) && \
-           ln -s new$(EXEEXT) unseen$(EXEEXT) && \
-           ln -s show$(EXEEXT) prev$(EXEEXT) && \
-           ln -s show$(EXEEXT) next$(EXEEXT); then :; \
-         else cp -p flist$(EXEEXT) flists$(EXEEXT) && \
-           cp -p folder$(EXEEXT) folders$(EXEEXT) && \
-           cp -p new$(EXEEXT) fnext$(EXEEXT) && \
-           cp -p new$(EXEEXT) fprev$(EXEEXT) && \
-           cp -p new$(EXEEXT) unseen$(EXEEXT) && \
-           cp -p show$(EXEEXT) prev$(EXEEXT) && \
-           cp -p show$(EXEEXT) next$(EXEEXT); \
-         fi
+       @LINK_FILE@ $(DESTDIR)$(bindir)/flist$(EXEEXT) $(DESTDIR)$(bindir)/flists$(EXEEXT)
+       @LINK_FILE@ $(DESTDIR)$(bindir)/folder$(EXEEXT) $(DESTDIR)$(bindir)/folders$(EXEEXT)
+       @LINK_FILE@ $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/fnext$(EXEEXT)
+       @LINK_FILE@ $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/fprev$(EXEEXT)
+       @LINK_FILE@ $(DESTDIR)$(bindir)/new$(EXEEXT) $(DESTDIR)$(bindir)/unseen$(EXEEXT)
+       @LINK_FILE@ $(DESTDIR)$(bindir)/show$(EXEEXT) $(DESTDIR)$(bindir)/prev$(EXEEXT)
+       @LINK_FILE@ $(DESTDIR)$(bindir)/show$(EXEEXT) $(DESTDIR)$(bindir)/next$(EXEEXT)
        if test x$(SETGID_MAIL) != x; then \
                chgrp $(MAIL_SPOOL_GRP) $(DESTDIR)$(bindir)/inc$(EXEEXT) && \
                chmod 2755 $(DESTDIR)$(bindir)/inc$(EXEEXT); \
index daec29c..a0602df 100644 (file)
@@ -327,6 +327,13 @@ dnl then use `vi' as the default.
 AS_IF([test -z "$editorpath"], [editorpath="$vipath"])
 AC_SUBST([editorpath])dnl
 
+dnl Cygwin FAT filesystems do not support hard links.  So use cp instead,
+dnl even if running on an NTFS or other filesystem.
+AS_CASE(["$host_os"],
+  [cygwin*],[LINK_FILE=cp],
+  [LINK_FILE=ln])
+AC_SUBST([LINK_FILE])
+
 dnl ----------------------------------------------------------
 dnl FIND MAIL SPOOL AND SEE IF WE NEED TO MAKE inc SETGID MAIL
 dnl ----------------------------------------------------------