libtool-patches
[Top][All Lists]
Advanced

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

[Patch #40] Use ln -sf when installing library links


From: Jeff Dubrule
Subject: [Patch #40] Use ln -sf when installing library links
Date: Thu, 18 Oct 2001 18:03:24 -0400
User-agent: Mutt/1.2.5i

This patch detects support for the -f flag to the ln program, and, if
available uses it when installing the links for libraries instead of
rm -f'ing the original link.

This is important for our application, because we put our libraries on
NFS mounts, and programs that use them are constantly starting up on
many different machines.  Therefore, if we can make the period of time
when there is no libfoo.so.# link as short as possible, the likelihood
of any program being started and not being able to find its library is
minimized.

-jeff


Index: configure.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/configure.in,v
retrieving revision 1.52.2.4
diff -u -r1.52.2.4 configure.in
--- configure.in        2001/09/11 03:33:37     1.52.2.4
+++ configure.in        2001/10/18 21:55:05
@@ -36,6 +36,7 @@
 AM_PROG_NM
 AC_SUBST(NM)
 AC_PROG_LN_S
+AC_LIBTOOL_PROG_LN_SF
 
 # Declare win32 dll support
 AC_LIBTOOL_WIN32_DLL
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.166.2.27
diff -u -r1.166.2.27 libtool.m4
--- libtool.m4  2001/09/11 03:18:52     1.166.2.27
+++ libtool.m4  2001/10/18 21:55:05
@@ -2448,7 +2448,7 @@
   # careful not to overquote the AC_SUBSTed values.  We take copies of the
   # variables and quote the copies for generation of the libtool script.
   for var in echo old_CC old_CFLAGS \
-    AR AR_FLAGS CC LD LN_S NM SHELL \
+    AR AR_FLAGS CC LD LN_S LN_SF NM SHELL \
     reload_flag reload_cmds wl \
     pic_flag link_static_flag no_builtin_flag export_dynamic_flag_spec \
     thread_safe_flag_spec whole_archive_flag_spec libname_spec \
@@ -2558,6 +2558,9 @@
 # Whether we need hard or soft links.
 LN_S=$lt_LN_S
 
+# Whether ln -sf works
+LN_SF=$lt_LN_SF
+
 # A BSD-compatible nm program.
 NM=$lt_NM
 
@@ -3558,6 +3561,24 @@
     LIBLTDL="-lltdl"
     INCLTDL=
   fi
+])
+
+AC_DEFUN(AC_LIBTOOL_PROG_LN_SF,
+[AC_MSG_CHECKING(whether ln -sf works)
+AC_CACHE_VAL(ac_cv_prog_LN_SF,
+[rm -f conftestdata
+if ln -sf X conftestdata 2>/dev/null
+then
+  rm -f conftestdata
+  ac_cv_prog_LN_SF="ln -sf"
+fi])dnl
+LN_SF="$ac_cv_prog_LN_SF"
+if test -n "$ac_cv_prog_LN_SF"; then
+  AC_MSG_RESULT(yes)
+else
+  AC_MSG_RESULT(no)
+fi
+AC_SUBST(LN_SF)dnl
 ])
 
 # old names
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.259.2.9
diff -u -r1.259.2.9 ltmain.in
--- ltmain.in   2001/09/11 00:05:33     1.259.2.9
+++ ltmain.in   2001/10/18 21:55:05
@@ -4191,8 +4191,13 @@
            for linkname
            do
              if test "$linkname" != "$realname"; then
-               $show "(cd $destdir && $rm $linkname && $LN_S $realname 
$linkname)"
-               $run eval "(cd $destdir && $rm $linkname && $LN_S $realname 
$linkname)"
+               if test -n "$LN_SF"; then
+                 $show "(cd $destdir && $LN_SF $realname $linkname)"
+                 $run eval "(cd $destdir && $LN_SF $realname $linkname)"
+               else
+                 $show "(cd $destdir && $rm $linkname && $LN_S $realname 
$linkname)"
+                 $run eval "(cd $destdir && $rm $linkname && $LN_S $realname 
$linkname)"
+               fi
              fi
            done
          fi



reply via email to

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