libtool-patches
[Top][All Lists]
Advanced

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

Fix for 'Cygwin List O' Issues' #1: static runtime libs


From: Charles Wilson
Subject: Fix for 'Cygwin List O' Issues' #1: static runtime libs
Date: Sat, 02 Nov 2002 22:40:44 -0500
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:0.9.4) Gecko/20011019 Netscape6/6.2

Charles Wilson wrote:

I really think that "The Right Thing" is the following:

1) create a new "official" libtool variable (like $max_cmd_len)
that appears in every tag.  "check_for_runtime_shlibs".  Defaults
to "no". "yes" is current behavior (mostly -- see 3).

2) If "no", then avoid -nostdlibs. Behave like the current C tag.
This way, static runtimes are ok, even if building a sharedlib.
cygwin/windows would set this "no".  Maybe linux/solaries.  I dunno.

3) If "yes", then all tags should behave like C++ does now
(*** including *** the C tag).  Figure out the name of the runtime libs
for this tag (GNU C++: libgcc libstdc++ libsupc++.  GNU F77: libg2c.
etc).  Use -nostdlibs, but explicitly add the libs back to the
command line, and let the "$file_magic_cmd" take over.


Here's an attempt to address this problem. Right now, (with one exception) it directly affects only cygwin/mingw/ but could be extended in the future.

I've pulled the "determine what extra libs are added by the compiler" code out of the AC_LIBTOOL_LANG_CXX_CONFIG and made it into its own function AC_LIBTOOL_POSTDEP_PREDEP. I've attempted to make that function multi-tag compliant -- but right now it is only called by the CXX_CONFIG. (Hopefully that will change later, but one step at a time).

I've added a new libtool variable (that gets added to each tag in the generated libtool script) "allow_libtool_libs_with_static runtimes" (generated by _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) ). It's set to "no" for all tags and architectures except cygwin/mingw right now -- which means that the *existing* behavior is unchanged for all but cygwin/mingw.

When allow_libtool_libs_with_static runtimes = yes, then we skip $postdeps, $predeps when checking for "dynamicness".

Eventually, even the "C" tag should call AC_LIBTOOL_POSTDEP_PREDEP, so that the behavior in all tags is the same (e.g. if NOT allow_libtool_libs_with_static_runtimes, then the C tag should check libgcc for "dynamicness" -- existing behavior is to allow static libgcc.a when creating C shared libs, but disallow in C++. ???) But, again, one thing at a time.

Now, this last part of the patch affects all platforms (the "exception" I mentioned earlier). It removes the postdeps, predeps, and compiler_lib_search_path from dependency_libs.

Why should the .la libtool library list something like this:
dependency_libs=' -L/usr/lib -L/usr/lib/w32api -L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-9 -lstdc++-2
 -lgcc -lcygwin -luser32 -lkernel32 -ladvapi32 -lshell32 -lgcc'

...when libtool itself will *re-determine* all of these dependencies when it's linking a project that depends on this libtool library? And do we really want to include compiler specific paths like -L/usr/lib/gcc-lib/i686-pc-cygwin/2.95.3-9 in it? (*)

I've done the following tests on a libtool patched as described:
  built on cygwin, ran the testsuite (no regressions), and used
    it to successfully build ImageMagick on cygwin.  (Of course,
    it also successfully builds the demo project attached to the first
    message in this thread.)
  built on linux, ran the testsuite (no regressions), and used
    it to successfully build ImageMagic on linux.

I'd expect that this patch would need some testing on lots of other platforms before inclusion...but it does solve the problem on cygwin, and doesn't break linux.

--Chuck

(*) This can sometimes lead to counterintuitive -- but still pedantically correct -- results. For instance, suppose allow_libtool_libs_with_static_runtimes = no, but the platform's runtime libraries ARE static, and we try to build a shared library (in C++, since only the C++ tag currently checks this).

libtool will complain
*** Warning: linker path does not have real file for library -lstdc++.
      ...
*** The inter-library dependencies that have been dropped here will be
*** automatically added whenever a program is linked with this library
*** or is declared to -dlopen it.

But because the dependencies at fault are stdlibs, they are NOT explicitly added to the "dependency_libs" variable in the libtool library (because the last part of my patch removes such stdlibs from that variable). But that IS correct behavior -- the compiler/libtool WILL automatically add **standard runtime libs** to the link command whenever you link to this libtool library -- there's no reason to list them in the .la file.

---------------------------------------------

2002-11-02  Charles Wilson  <address@hidden>

        * libtool.m4 (AC_LIBTOOL_POSTDEP_PREDEP): new function.
        moved the "find hidden library dependencies" code here
        from AC_LIBTOOL_LANG_CXX_CONFIG.  Attempted to make it
        multi-tag compatible, but currently only CXX calls it.
        (AC_LIBTOOL_LANG_CXX_CONFIG): set
        enable_shared_with_static_runtimes to 'no' by default
        Set it to 'yes' for cygwin, mingw, pw32. Replace
        "find hidden library dependencies" code with a call
        to the new function AC_LIBTOOL_POSTDEP_PREDEP.
        (AC_LIBTOOL_LANG_F77_CONFIG): set
        enable_shared_with_static_runtimes to 'no' by default
        (AC_LIBTOOL_CONFIG): add
        enable_shared_with_static_runtimes to the list of variables
        to write into ltmain.sh; include it in the libtool script
        template as allow_libtool_libs_with_static_runtimes.
        (AC_LIBTOOL_PROG_LD_SHLIBS): set
        enable_shared_with_static_runtimes to 'no' by default
        Set it to 'yes' for cygwin, mingw, pw32.
        
        * ltmain.in (case deplibs_check_method): for all appropriate
        cases, if allow_libtool_libs_with_static_runtimes, then remove
        predeps and postdeps from the list of dependencies that must
        be checked for "dynamicness".  For the "none" case, the
        presence of compiler-generated postdeps and predeps should
        not trigger "inter-library dependencies not supported" error.

        * ltmain.in (for pass in $passes loop): remove predeps,
        postdeps, and compiler_lib_search_path from dependency_libs.

Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.273
diff -u -r1.273 libtool.m4
--- libtool.m4  31 Oct 2002 00:52:39 -0000      1.273
+++ libtool.m4  2 Nov 2002 23:41:25 -0000
@@ -2423,6 +2423,7 @@
 _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
 _LT_AC_TAGVAR(no_undefined_flag, $1)=
 _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
 
 # Dependencies to place before and after the object being linked:
 _LT_AC_TAGVAR(predep_objects, $1)=
@@ -2646,6 +2647,7 @@
     # as there is no search path for DLLs.
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
     _LT_AC_TAGVAR(always_export_symbols, $1)=no
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
 
     if $LD --help 2>&1 | egrep 'auto-import' > /dev/null; then
       _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects 
$libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname 
${wl}--image-base=0x10000000 ${wl}--out-implib,$lib'
@@ -2658,6 +2660,7 @@
   mingw* | pw32* )
     _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
     _LT_AC_TAGVAR(always_export_symbols, $1)=no
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
 
     if $LD --help 2>&1 | egrep 'auto-import' > /dev/null; then
       _LT_AC_TAGVAR(archive_cmds, $1)='$CC '$lt_cv_cc_dll_switch' $libobjs 
$deplibs $compiler_flags -o $output_objdir/$soname ${wl}--out-implib,${lib}'
@@ -3138,9 +3141,46 @@
 AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
 test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
 
-# Figure out "hidden" C++ library dependencies from verbose
-# compiler output whening linking a shared library.
-cat > conftest.$ac_ext <<EOF
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+## CAVEAT EMPTOR:
+## There is no encapsulation within the following macros, do not change
+## the running order or otherwise move them around unless you know exactly
+## what you are doing...
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_DLOPEN_SELF($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library.  It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
 class Foo
 {
 public:
@@ -3149,8 +3189,25 @@
   int a;
 };
 EOF
-
-
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+      subroutine foo
+      implicit none
+      integer*4 a
+      a=0
+      return
+      end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+  private int a;
+  public void bar (void) {
+    a = 0;
+  }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
 if AC_TRY_EVAL(ac_compile); then
   # Parse the compiler output and extract the necessary
   # objects, libraries and library flags.
@@ -3233,7 +3290,7 @@
   # Clean up.
   rm -f a.out a.exe
 else
-  echo "libtool.m4: error: problem compiling C++ test program"
+  echo "libtool.m4: error: problem compiling $1 test program"
 fi
 
 $rm -f confest.$objext
@@ -3242,29 +3299,7 @@
 *" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
 *) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes ;;
 esac
-
-_LT_AC_TAGVAR(GCC, $1)="$GXX"
-_LT_AC_TAGVAR(LD, $1)="$LD"
-
-## CAVEAT EMPTOR:
-## There is no encapsulation within the following macros, do not change
-## the running order or otherwise move them around unless you know exactly
-## what you are doing...
-AC_LIBTOOL_PROG_COMPILER_PIC($1)
-AC_LIBTOOL_PROG_CC_C_O($1)
-AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
-AC_LIBTOOL_PROG_LD_SHLIBS($1)
-AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-AC_LIBTOOL_SYS_LIB_STRIP
-AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
-AC_LIBTOOL_DLOPEN_SELF($1)
-
-AC_LIBTOOL_CONFIG($1)
-
-AC_LANG_POP
-CC="$lt_save_CC"
-])# AC_LIBTOOL_LANG_CXX_CONFIG
-
+])# AC_LIBTOOL_POSTDEP_PREDEP
 
 # AC_LIBTOOL_LANG_F77_CONFIG
 # ------------------------
@@ -3289,6 +3324,7 @@
 _LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
 _LT_AC_TAGVAR(no_undefined_flag, $1)=
 _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
 
 # Source file extension for f77 test sources.
 ac_ext=f
@@ -3490,6 +3526,7 @@
     _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
     _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
     _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+    _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
     _LT_AC_TAGVAR(old_archive_cmds, $1) \
     _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
     _LT_AC_TAGVAR(predep_objects, $1) \
@@ -3604,6 +3641,9 @@
 # Whether or not to add -lc for building shared libraries.
 build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
 
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes,
 $1)
+
 # Whether or not to optimize for fast installation.
 fast_install=$enable_fast_install
 
@@ -4551,7 +4591,7 @@
 ],[
   runpath_var=
   _LT_AC_TAGVAR(allow_undefined_flag, $1)=
-
+  _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
   _LT_AC_TAGVAR(archive_cmds, $1)=
   _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=
   _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
@@ -4650,6 +4690,7 @@
       # as there is no search path for DLLs.
       _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
       _LT_AC_TAGVAR(always_export_symbols, $1)=no
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
 
       if $LD --help 2>&1 | egrep 'auto-import' > /dev/null; then
         _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs 
$compiler_flags -o $output_objdir/$soname ${wl}--image-base=0x10000000 
${wl}--out-implib,$lib'
@@ -4886,6 +4927,7 @@
       # FIXME: Should let the user specify the lib program.
       _LT_AC_TAGVAR(old_archive_cmds, $1)='lib 
/OUT:$oldlib$oldobjs$old_deplibs'
       fix_srcfile_path='`cygpath -w "$srcfile"`'
+      _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
       ;;
 
     darwin* | rhapsody*)
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.308
diff -u -r1.308 ltmain.in
--- ltmain.in   31 Oct 2002 00:52:39 -0000      1.308
+++ ltmain.in   2 Nov 2002 23:42:02 -0000
@@ -2520,6 +2520,29 @@
          eval $var=\"$tmp_libs\"
        done # for var
       fi
+      # Last step: remove runtime libs from dependency_libs (they stay in 
deplibs)
+      tmp_libs=
+      for i in $dependency_libs ; do
+       case "$postdeps" in
+       *" $i "* | "$i "* | *" $i" | "$i" )
+         i=""
+         ;;
+       esac
+       case "$predeps" in
+       *" $i "* | "$i "* | *" $i" | "$i" )
+         i=""
+         ;;
+       esac
+       case "$compiler_lib_search_path" in
+       *" $i "* | "$i "* | *" $i" | "$i" )
+         i=""
+         ;;
+       esac
+       if test -n "$i" ; then
+         tmp_libs="$tmp_libs $i"
+       fi
+      done
+      dependency_libs=$tmp_libs
     done # for pass
     if test "$linkmode" = prog; then
       dlfiles="$newdlfiles"
@@ -2943,22 +2966,38 @@
            for i in $deplibs; do
              name="`expr $i : '-l\(.*\)'`"
              # If $name is empty we are operating on a -L argument.
-             if test "$name" != "" && test "$name" -ne "0"; then
-               libname=`eval \\$echo \"$libname_spec\"`
-               deplib_matches=`eval \\$echo \"$library_names_spec\"`
-               set dummy $deplib_matches
-               deplib_match=$2
-               if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-                 newdeplibs="$newdeplibs $i"
-               else
-                 droppeddeps=yes
-                 echo
-                 echo "*** Warning: dynamic linker does not accept needed 
library $i."
-                 echo "*** I have the capability to make that library 
automatically link in when"
-                 echo "*** you link to this library.  But I can only do this 
if you have a"
-                 echo "*** shared version of the library, which I believe you 
do not have"
-                 echo "*** because a test_compile did reveal that the linker 
did not use it for"
-                 echo "*** its dynamic dependency list that programs get 
resolved with at runtime."
+              if test "$name" != "" && test "$name" -ne "0"; then
+               if test "X$allow_libtool_libs_with_static_runtimes" == "Xyes" ; 
then
+                 case "$postdeps" in
+                 *" $i "* | "$i "* | *" $i" | "$i" ) 
+                   newdeplibs="$newdeplibs $i"
+                   i=""
+                   ;;             
+                 esac 
+                 case "$predeps" in
+                 *" $i "* | "$i "* | *" $i" | "$i" )
+                   newdeplibs="$newdeplibs $i"
+                   i=""
+                   ;;
+                 esac
+               fi
+               if test -n "$i" ; then
+                 libname=`eval \\$echo \"$libname_spec\"`
+                 deplib_matches=`eval \\$echo \"$library_names_spec\"`
+                 set dummy $deplib_matches
+                 deplib_match=$2
+                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
+                   newdeplibs="$newdeplibs $i"
+                 else
+                   droppeddeps=yes
+                   echo
+                   echo "*** Warning: dynamic linker does not accept needed 
library $i."
+                   echo "*** I have the capability to make that library 
automatically link in when"
+                   echo "*** you link to this library.  But I can only do this 
if you have a"
+                   echo "*** shared version of the library, which I believe 
you do not have"
+                   echo "*** because a test_compile did reveal that the linker 
did not use it for"
+                   echo "*** its dynamic dependency list that programs get 
resolved with at runtime."
+                 fi
                fi
              else
                newdeplibs="$newdeplibs $i"
@@ -2969,28 +3008,44 @@
            # the situation: Compile a separate program for each library.
            for i in $deplibs; do
              name="`expr $i : '-l\(.*\)'`"
-            # If $name is empty we are operating on a -L argument.
-             if test "$name" != "" && test "$name" != "0"; then
+             # If $name is empty we are operating on a -L argument.
+              if test "$name" != "" && test "$name" != "0"; then
                $rm conftest
                $LTCC -o conftest conftest.c $i
                # Did it work?
                if test "$?" -eq 0 ; then
                  ldd_output=`ldd conftest`
-                 libname=`eval \\$echo \"$libname_spec\"`
-                 deplib_matches=`eval \\$echo \"$library_names_spec\"`
-                 set dummy $deplib_matches
-                 deplib_match=$2
-                 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
-                   newdeplibs="$newdeplibs $i"
-                 else
-                   droppeddeps=yes
-                   echo
-                   echo "*** Warning: dynamic linker does not accept needed 
library $i."
-                   echo "*** I have the capability to make that library 
automatically link in when"
-                   echo "*** you link to this library.  But I can only do this 
if you have a"
-                   echo "*** shared version of the library, which you do not 
appear to have"
-                   echo "*** because a test_compile did reveal that the linker 
did not use this one"
-                   echo "*** as a dynamic dependency that programs can get 
resolved with at runtime."
+                 if test "X$allow_libtool_libs_with_static_runtimes" == "Xyes" 
; then
+                   case "$postdeps" in
+                   *" $i "* | "$i "* | *" $i" | "$i" ) 
+                     newdeplibs="$newdeplibs $i"
+                     i=""
+                     ;;             
+                   esac 
+                   case "$predeps" in
+                   *" $i "* | "$i "* | *" $i" | "$i" )
+                     newdeplibs="$newdeplibs $i"
+                     i=""
+                     ;;
+                   esac
+                 fi
+                 if test -n "$i" ; then
+                   libname=`eval \\$echo \"$libname_spec\"`
+                   deplib_matches=`eval \\$echo \"$library_names_spec\"`
+                   set dummy $deplib_matches
+                   deplib_match=$2
+                   if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; 
then
+                     newdeplibs="$newdeplibs $i"
+                   else
+                     droppeddeps=yes
+                     echo
+                     echo "*** Warning: dynamic linker does not accept needed 
library $i."
+                     echo "*** I have the capability to make that library 
automatically link in when"
+                     echo "*** you link to this library.  But I can only do 
this if you have a"
+                     echo "*** shared version of the library, which you do not 
appear to have"
+                     echo "*** because a test_compile did reveal that the 
linker did not use this one"
+                     echo "*** as a dynamic dependency that programs can get 
resolved with at runtime."
+                   fi
                  fi
                else
                  droppeddeps=yes
@@ -3012,11 +3067,26 @@
          for a_deplib in $deplibs; do
            name="`expr $a_deplib : '-l\(.*\)'`"
            # If $name is empty we are operating on a -L argument.
-           if test "$name" != "" && test  "$name" != "0"; then
-             libname=`eval \\$echo \"$libname_spec\"`
-             for i in $lib_search_path $sys_lib_search_path 
$shlib_search_path; do
-                   potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-                   for potent_lib in $potential_libs; do
+            if test "$name" != "" && test  "$name" != "0"; then
+             if test "X$allow_libtool_libs_with_static_runtimes" == "Xyes" ; 
then
+               case "$postdeps" in
+               *" $a_deplib "* | "$a_deplib "* | *" $a_deplib" | "$a_deplib" ) 
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""    
+                 ;;             
+               esac 
+               case "$predeps" in
+               *" $a_deplib "* | "$a_deplib "* | *" $a_deplib" | "$a_deplib" )
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""    
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval \\$echo \"$libname_spec\"`
+               for i in $lib_search_path $sys_lib_search_path 
$shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
                      # Follow soft links.
                      if ls -lLd "$potent_lib" 2>/dev/null \
                         | grep " -> " >/dev/null; then
@@ -3042,8 +3112,9 @@
                        a_deplib=""
                        break 2
                      fi
-                   done
-             done
+                 done
+               done
+             fi
              if test -n "$a_deplib" ; then
                droppeddeps=yes
                echo
@@ -3072,20 +3143,36 @@
            name="`expr $a_deplib : '-l\(.*\)'`"
            # If $name is empty we are operating on a -L argument.
            if test -n "$name" && test "$name" != "0"; then
-             libname=`eval \\$echo \"$libname_spec\"`
-             for i in $lib_search_path $sys_lib_search_path 
$shlib_search_path; do
-               potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-               for potent_lib in $potential_libs; do
-                 potlib="$potent_lib" # see symlink-check above in file_magic 
test
-                 if eval echo \"$potent_lib\" 2>/dev/null \
-                     | ${SED} 10q \
-                     | egrep "$match_pattern_regex" > /dev/null; then
-                   newdeplibs="$newdeplibs $a_deplib"
-                   a_deplib=""
-                   break 2
-                 fi
+             if test "X$allow_libtool_libs_with_static_runtimes" == "Xyes" ; 
then
+               case "$postdeps" in
+               *" $a_deplib "* | "$a_deplib "* | *" $a_deplib" | "$a_deplib" ) 
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""    
+                 ;;             
+               esac 
+               case "$predeps" in
+               *" $a_deplib "* | "$a_deplib "* | *" $a_deplib" | "$a_deplib" )
+                 newdeplibs="$newdeplibs $a_deplib"
+                 a_deplib=""    
+                 ;;
+               esac
+             fi
+             if test -n "$a_deplib" ; then
+               libname=`eval \\$echo \"$libname_spec\"`
+               for i in $lib_search_path $sys_lib_search_path 
$shlib_search_path; do
+                 potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                 for potent_lib in $potential_libs; do
+                   potlib="$potent_lib" # see symlink-check above in 
file_magic test
+                   if eval echo \"$potent_lib\" 2>/dev/null \
+                       | ${SED} 10q \
+                       | egrep "$match_pattern_regex" > /dev/null; then
+                     newdeplibs="$newdeplibs $a_deplib"
+                     a_deplib=""
+                     break 2
+                   fi
+                 done
                done
-             done
+             fi
              if test -n "$a_deplib" ; then
                droppeddeps=yes
                echo
@@ -3109,9 +3196,18 @@
          ;;
        none | unknown | *)
          newdeplibs=""
-         if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
-              -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
-            grep . >/dev/null; then
+         tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+           -e 's/ -[LR][^ ]*//g'`
+         if test "X$allow_libtool_libs_with_static_runtimes" == "Xyes" ; then
+           for i in $postdeps ; do
+             tmp_deplibs=`$echo "X $tmp_deplibs" | $Xsed -e "s/$i//"`
+           done
+           for i in $predeps ; do
+             tmp_deplibs=`$echo "X $tmp_deplibs" | $Xsed -e "s/$i//"`
+           done
+         fi
+         if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
+           | grep . >/dev/null; then
            echo
            if test "X$deplibs_check_method" = "Xnone"; then
              echo "*** Warning: inter-library dependencies are not supported 
in this platform."

reply via email to

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