[ moving to the libtool-patches list; see
  http://thread.gmane.org/gmane.comp.gnu.libtool.general/7097 ]

Hi Gary,

>>>* Gary Kumfert wrote on Thu, Jan 12, 2006 at 09:07:52PM CET:
>>>>
>>>> I'm learning that libtool 1.5.22 "fixed" the -static flag so that
>>>> static libraries are linked in the build directory, but
>>>> shared libraries in the install directory.  But I don't
>>>> understand why this is considered "better" behavior.

Here are preliminary patches that add `-static-libtool-libs' to
branch-1-5 and HEAD, with the semantics of pre-1.5.22 `-static'.

Tests to make sure this works as desired are still necessary, before
this can be applied (and a NEWS entry).  It would help me to write the
tests if you could point me to where in your packages this would make a
difference.  And, of course it would help if you could test this patch.
;-)

Cheers,
Ralf

        * libltdl/config/ltmain.m4sh (func_mode_link)
        < -static-libtool-libs >: New option.
        * doc/libtool.texi (Link mode, Distributing libltdl):
        Document it.
        Suggested by Gary Kumfert <[EMAIL PROTECTED]>.
        * libltdl/config/ltmain.m4sh (func_mode_link)
        < -static-libtool-libs >: New option.
        * doc/libtool.texi (Link mode, Distributing libltdl):
        Document it.
        Suggested by Gary Kumfert <[EMAIL PROTECTED]>.

Index: doc/libtool.texi
===================================================================
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.208
diff -u -r1.208 libtool.texi
--- doc/libtool.texi    4 Dec 2005 17:57:46 -0000       1.208
+++ doc/libtool.texi    23 Jan 2006 17:36:15 -0000
@@ -1332,9 +1332,10 @@
 @item -dlopen @var{file}
 Same as @option{-dlpreopen @var{file}}, if native dlopening is not
 supported on the host platform (@pxref{Dlopened modules}) or if
-the program is linked with @option{-static} or @option{-all-static}.
-Otherwise, no effect.  If @var{file} is @code{self} Libtool will make
-sure that the program can @code{dlopen} itself, either by enabling
+the program is linked with @option{-static},
[EMAIL PROTECTED], or @option{-all-static}.  Otherwise, no
+effect.  If @var{file} is @code{self} Libtool will make sure that the
+program can @code{dlopen} itself, either by enabling
 @option{-export-dynamic} or by falling back to @option{-dlpreopen self}.
 
 @item -dlpreopen @var{file}
@@ -1440,6 +1441,11 @@
 uninstalled shared libtool libraries.  If @var{output-file} is a
 library, then only create a static library.
 
[EMAIL PROTECTED] -static-libtool-libs
+If @var{output-file} is a program, then do not link it against any
+shared libtool libraries.  If @var{output-file} is a library, then only
+create a static library.
+
 @item -version-info @var{current}[:@var{revision}[:@var{age}]]
 If @var{output-file} is a libtool library, use interface version
 information @var{current}, @var{revision}, and @var{age} to build it
@@ -4419,7 +4425,8 @@
 You should probably also use the @samp{dlopen} option to @code{LT_INIT}
 in your @file{configure.ac}, otherwise libtool will assume no dlopening
 mechanism is supported, and revert to dlpreopening, which is probably not
-what you want.  Avoid using the @option{-static} or @option{-all-static}
+what you want.  Avoid using the @option{-static},
[EMAIL PROTECTED], or @option{-all-static}
 switches when linking programs with libltdl.  This will not work on
 all platforms, because the dlopening functions may not be available
 for static linking.
Index: libltdl/config/ltmain.m4sh
===================================================================
RCS file: /cvsroot/libtool/libtool/libltdl/config/ltmain.m4sh,v
retrieving revision 1.30
diff -u -r1.30 ltmain.m4sh
--- libltdl/config/ltmain.m4sh  21 Jan 2006 16:44:41 -0000      1.30
+++ libltdl/config/ltmain.m4sh  23 Jan 2006 17:36:15 -0000
@@ -331,9 +331,9 @@
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   -export-symbols SYMFILE
-                   try to export only the symbols listed in SYMFILE
+                    try to export only the symbols listed in SYMFILE
   -export-symbols-regex REGEX
-                   try to export only the symbols matching REGEX
+                    try to export only the symbols matching REGEX
   -LLIBDIR          search LIBDIR for required installed libraries
   -lNAME            OUTPUT-FILE requires the installed library libNAME
   -module           build a library that can dlopened
@@ -349,9 +349,11 @@
   -R[[ ]]LIBDIR       add LIBDIR to the runtime path of programs and libraries
   -shared           only do dynamic linking of libtool libraries
   -shrext SUFFIX    override the standard shared library file extension
-  -static           do not do any dynamic linking of libtool libraries
+  -static           do not do any dynamic linking of uninstalled libtool 
libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
   -version-info CURRENT[[:REVISION[:AGE]]]
-                   specify library version info [[each variable defaults to 0]]
+                    specify library version info [[each variable defaults to 
0]]
   -weak LIBNAME     declare that the target provides the LIBNAME interface
 
 All other options (arguments beginning with \`-') are ignored.
@@ -2230,8 +2232,9 @@
        build_old_libs=no
        break
        ;;
-      -all-static | -static)
-       if test "X$arg" = "X-all-static"; then
+      -all-static | -static | -static-libtool-libs)
+       case $arg in
+       -all-static)
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; 
then
            func_warning "complete static linking is impossible in this 
configuration"
          fi
@@ -2242,12 +2245,20 @@
            finalize_command="$finalize_command $link_static_flag"
          fi
          prefer_static_libs=yes
-       else
+         ;;
+       -static)
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
            dlopen_self=$dlopen_self_static
          fi
          prefer_static_libs=built
-       fi
+         ;;
+       -static-libtool-libs)
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=yes
+         ;;
+       esac
        build_libtool_libs=no
        build_old_libs=yes
        break
@@ -2768,7 +2779,7 @@
        continue
        ;;
 
-      -static)
+      -static | -static-libtool-libs)
        # The effects of -static are defined in a previous loop.
        # We used to do the same as -all-static on platforms that
        # didn't have a PIC flag, but the assumption that the effects
        * ltmain.in (link mode) < -static-libtool-libs >: New option.
        * doc/libtool.texi (Link mode, Distributing libltdl):
        Document it.
        Suggested by Gary Kumfert <[EMAIL PROTECTED]>.

Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/Attic/ltmain.in,v
retrieving revision 1.334.2.118
diff -u -r1.334.2.118 ltmain.in
--- ltmain.in   21 Jan 2006 16:46:08 -0000      1.334.2.118
+++ ltmain.in   23 Jan 2006 16:08:07 -0000
@@ -1145,8 +1145,9 @@
     for arg
     do
       case $arg in
-      -all-static | -static)
-       if test "X$arg" = "X-all-static"; then
+      -all-static | -static | -static-libtool-libs)
+       case $arg in
+       -all-static)
          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; 
then
            $echo "$modename: warning: complete static linking is impossible in 
this configuration" 1>&2
          fi
@@ -1154,12 +1155,20 @@
            dlopen_self=$dlopen_self_static
          fi
          prefer_static_libs=yes
-       else
+         ;;
+       -static)
          if test -z "$pic_flag" && test -n "$link_static_flag"; then
            dlopen_self=$dlopen_self_static
          fi
          prefer_static_libs=built
-       fi
+         ;;
+       -static-libtool-libs)
+         if test -z "$pic_flag" && test -n "$link_static_flag"; then
+           dlopen_self=$dlopen_self_static
+         fi
+         prefer_static_libs=yes
+         ;;
+       esac
        build_libtool_libs=no
        build_old_libs=yes
        break
@@ -1719,7 +1728,7 @@
        continue
        ;;
 
-      -static)
+      -static | -static-libtool-libs)
        # The effects of -static are defined in a previous loop.
        # We used to do the same as -all-static on platforms that
        # didn't have a PIC flag, but the assumption that the effects
@@ -6782,9 +6791,9 @@
   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
   -export-symbols SYMFILE
-                   try to export only the symbols listed in SYMFILE
+                    try to export only the symbols listed in SYMFILE
   -export-symbols-regex REGEX
-                   try to export only the symbols matching REGEX
+                    try to export only the symbols matching REGEX
   -LLIBDIR          search LIBDIR for required installed libraries
   -lNAME            OUTPUT-FILE requires the installed library libNAME
   -module           build a library that can dlopened
@@ -6798,9 +6807,11 @@
   -release RELEASE  specify package release information
   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
-  -static           do not do any dynamic linking of libtool libraries
+  -static           do not do any dynamic linking of uninstalled libtool 
libraries
+  -static-libtool-libs
+                    do not do any dynamic linking of libtool libraries
   -version-info CURRENT[:REVISION[:AGE]]
-                   specify library version info [each variable defaults to 0]
+                    specify library version info [each variable defaults to 0]
 
 All other options (arguments beginning with \`-') are ignored.
 
Index: doc/libtool.texi
===================================================================
RCS file: /cvsroot/libtool/libtool/doc/libtool.texi,v
retrieving revision 1.134.2.14
diff -u -r1.134.2.14 libtool.texi
--- doc/libtool.texi    16 Dec 2005 18:11:47 -0000      1.134.2.14
+++ doc/libtool.texi    23 Jan 2006 16:08:08 -0000
@@ -1217,10 +1217,11 @@
 @item -dlopen @var{file}
 Same as @samp{-dlpreopen @var{file}}, if native dlopening is not
 supported on the host platform (@pxref{Dlopened modules}) or if
-the program is linked with @samp{-static} or @samp{-all-static}.
-Otherwise, no effect.  If @var{file} is @code{self} libtool will make
-sure that the program can @code{dlopen} itself, either by enabling
[EMAIL PROTECTED] or by falling back to @samp{-dlpreopen self}.
+the program is linked with @samp{-static}, @samp{-static-libtool-libs},
+or @samp{-all-static}.  Otherwise, no effect.  If @var{file} is
[EMAIL PROTECTED] libtool will make sure that the program can @code{dlopen}
+itself, either by enabling @code{-export-dynamic} or by falling back to
[EMAIL PROTECTED] self}.
 
 @item -dlpreopen @var{file}
 Link @var{file} into the output program, and add its symbols to
@@ -1318,6 +1319,11 @@
 uninstalled shared libtool libraries.  If @var{output-file} is a
 library, then only create a static library.
 
[EMAIL PROTECTED] -static-libtool-libs
+If @var{output-file} is a program, then do not link it against any
+shared libtool libraries (@samp{.la} files).  If @var{output-file} is a
+library, then only create a static library.
+
 @item -version-info @var{current}[:@var{revision}[:@var{age}]]
 If @var{output-file} is a libtool library, use interface version
 information @var{current}, @var{revision}, and @var{age} to build it
@@ -3592,9 +3598,10 @@
 libtool will assume no dlopening mechanism is supported, and revert to
 dlpreopening, which is probably not what you want.
 
-Avoid using the @code{-static} or @code{-all-static} switches when
-linking programs with libltdl.  This will not work on all platforms,
-because the dlopening functions may not be available for static linking.
+Avoid using the @code{-static}, @code{-static-libtool-libs} or
[EMAIL PROTECTED] switches when linking programs with libltdl.  This
+will not work on all platforms, because the dlopening functions may not
+be available for static linking.
 
 The following example shows you how to embed the convenience libltdl in
 your package.  In order to use the installable variant just replace

Reply via email to