]> git.ipfire.org Git - thirdparty/libtool.git/commitdiff
* ltconfig.in: re-enable deplibs
authorToshio Kuratomi <badger@prtr-13.ucsc.edu>
Wed, 11 Nov 1998 01:47:02 +0000 (01:47 +0000)
committerAlexandre Oliva <aoliva@redhat.com>
Wed, 11 Nov 1998 01:47:02 +0000 (01:47 +0000)
* ltmain.in: support deplibs, at least for GNU/Linux/x86

ChangeLog
ltconfig.in
ltmain.in
mail/deplibs

index 5f5e7273c3a462e342e4551a74abbde8f632a5cd..232a371483366e73bf409ca36ccb8e3aab86bc0e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+1998-11-10  Toshio Kuratomi  <badger@prtr-13.ucsc.edu>
+
+       * ltconfig.in: re-enable deplibs
+       * ltmain.in: support deplibs, at least for GNU/Linux/x86
+       Updated to current libtool by Thomas Tanner  <tanner@gmx.de>
+
 1998-11-10  Gordon Matzigkeit  <gord@trick.fig.org>
 
        * ltmain.in (link): Make the relink warning less harsh.
index 257f9901753b18f95f3371aa72716cc6c03ddeaf..0a0ee6a3d7550343b70b4b7afa1e1648a3fb7c4e 100755 (executable)
@@ -920,7 +920,7 @@ if test "$with_gnu_ld" = yes; then
     ;;
 
   sunos4*)
-    archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
+    archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs$deplibs'
     hardcode_direct=yes
     hardcode_minus_L=yes
     hardcode_shlibpath_var=no
@@ -947,11 +947,11 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
       archive_cmds='$CC -c '"`pwd`"'/ltdll.c; echo EXPORTS > $lib.exp;
       if test -z "$export_symbols"; then $NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;\
       else cat "$export_symbols" > $lib.exp; fi;\
-      $LD -s --base-file $soname-base --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
+      $LD -s --base-file $soname-base --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs$deplibs;\
       $DLLTOOL --as=$AS --dllname $soname --def $lib.exp --base-file $soname-base --output-exp $soname-exp;\
-      $LD -s --base-file $soname-base $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
+      $LD -s --base-file $soname-base $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs$deplibs;\
       $DLLTOOL --as=$AS --dllname $soname --def $lib.exp --base-file $soname-base --output-exp $soname-exp;\
-      $LD $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
+      $LD $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs$deplibs;\
       $rm libtool.$objext $soname-base $soname-exp'
       old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $lib.exp --output-lib $objdir/$libname.a;$rm $lib.exp'
     else
@@ -976,7 +976,7 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
 
   *)
     if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
-      archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs'
+      archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs'
     else
       ld_shlibs=no
     fi
@@ -995,7 +995,7 @@ else
   aix3*)
     allow_undefined_flag=unsupported
     archive_cmds='if test -z "$export_symbols"; then $NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp;\
-        else cat "$export_symbols" > $lib.exp; fi;$LD -o $objdir/$soname$libobjs -bE:$lib.exp -T512 -H512 -bM:SRE;$AR cru $lib $objdir/$soname'
+        else cat "$export_symbols" > $lib.exp; fi;$LD -o $objdir/$soname$libobjs$deplibs -bE:$lib.exp -T512 -H512 -bM:SRE;$AR cru $lib $objdir/$soname'
     # Note: this linker hardcodes the directories in LIBPATH if there
     # are no directories specified by -L.
     hardcode_minus_L=yes
@@ -1009,7 +1009,7 @@ else
   aix4*)
     allow_undefined_flag=unsupported
     archive_cmds='if test -z "$export_symbols"; then $NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\' | sort | uniq' > $lib.exp;\
-        else cat "$export_symbols" > $lib.exp; fi; $CC -o $objdir/$soname$libobjs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry;$AR cru $lib $objdir/$soname'
+        else cat "$export_symbols" > $lib.exp; fi; $CC -o $objdir/$soname$libobjs$deplibs ${wl}-bE:$lib.exp ${wl}-bM:SRE ${wl}-bnoentry;$AR cru $lib $objdir/$soname'
     hardcode_direct=yes
     hardcode_minus_L=yes
     ;;
@@ -1041,11 +1041,11 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
       archive_cmds='$CC -c '"`pwd`"'/ltdll.c; echo EXPORTS > $lib.exp;
       if test -z "$export_symbols"; then $NM$libobjs | $global_symbol_pipe | sed '\''s/.* //'\'' > $lib.exp;\
       else cat "$export_symbols" > $lib.exp; fi;\
-      $LD -s --base-file $soname-base --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
+      $LD -s --base-file $soname-base --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs$deplibs;\
       $DLLTOOL --as=$AS --dllname $soname --def $lib.exp --base-file $soname-base --output-exp $soname-exp;\
-      $LD -s --base-file $soname-base $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
+      $LD -s --base-file $soname-base $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs$deplibs;\
       $DLLTOOL --as=$AS --dllname $soname --def $lib.exp --base-file $soname-base --output-exp $soname-exp;\
-      $LD $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs;\
+      $LD $soname-exp --dll -e ___dll_entry@12 -o $lib libtool.$objext$libobjs$deplibs;\
       $rm libtool.$objext $soname-base $soname-exp'
       old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $lib.exp --output-lib $objdir/$libname.a;$rm $lib.exp'
     else
@@ -1072,7 +1072,7 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
   # does not break anything, and helps significantly (at the cost of a little
   # extra space).
   freebsd2.2*)
-    archive_cmds='$LD -Bshareable -o $lib$libobjs /usr/lib/c++rt0.o'
+    archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs /usr/lib/c++rt0.o'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
     hardcode_minus_L=yes
@@ -1081,7 +1081,7 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
 
   # Unfortunately, older versions of FreeBSD 2 do not have this feature.
   freebsd2*)
-    archive_cmds='$LD -Bshareable -o $lib$libobjs'
+    archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
     hardcode_direct=yes
     hardcode_minus_L=yes
     hardcode_shlibpath_var=no
@@ -1089,7 +1089,7 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
 
   # FreeBSD 3, at last, uses gcc -shared to do shared libraries.
   freebsd3*)
-    archive_cmds='$CC -shared -o $lib$libobjs'
+    archive_cmds='$CC -shared -o $lib$libobjs$deplibs'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
     hardcode_minus_L=no
@@ -1097,7 +1097,7 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
     ;;
 
   hpux9*)
-    archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs;test $objdir/$soname = $lib || mv $objdir/$soname $lib'
+    archive_cmds='$rm $objdir/$soname;$LD -b +s +b $install_libdir -o $objdir/$soname$libobjs$deplibs;test $objdir/$soname = $lib || mv $objdir/$soname $lib'
     hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
     hardcode_direct=yes
     hardcode_minus_L=yes
@@ -1105,7 +1105,7 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
     ;;
 
   hpux10* | hpux11*)
-    archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs'
+    archive_cmds='$LD -b +h $soname +s +b $install_libdir -o $lib$libobjs$deplibs'
     hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
     hardcode_direct=yes
     hardcode_minus_L=yes
@@ -1114,23 +1114,23 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
 
   irix5* | irix6*)
     if test "$with_gcc" = yes; then
-      archive_cmds='$CC -shared -o $lib ${wl}-soname ${wl}$soname ${wl}-set_version ${wl}$verstring$libobjs'
+      archive_cmds='$CC -shared -o $lib ${wl}-soname ${wl}$soname ${wl}-set_version ${wl}$verstring$libobjs$deplibs'
     else
-      archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs'
+      archive_cmds='$LD -shared -o $lib -soname $soname -set_version $verstring$libobjs$deplibs'
     fi
     hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
     ;;
 
   netbsd*)
     # Tested with NetBSD 1.2 ld
-    archive_cmds='$LD -Bshareable -o $lib$libobjs'
+    archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
     hardcode_shlibpath_var=no
     ;;
 
   openbsd*)
-    archive_cmds='$LD -Bshareable -o $lib$libobjs'
+    archive_cmds='$LD -Bshareable -o $lib$libobjs$deplibs'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_direct=yes
     hardcode_shlibpath_var=no
@@ -1140,7 +1140,7 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
     hardcode_libdir_flag_spec='-L$libdir'
     hardcode_minus_L=yes
     allow_undefined_flag=unsupported
-    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;$echo DATA >> $objdir/$libname.def;$echo " SINGLE NONSHARED" >> $objdir/$libname.def;$echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs $objdir/$libname.def'
+    archive_cmds='$echo "LIBRARY $libname INITINSTANCE" > $objdir/$libname.def;$echo "DESCRIPTION \"$libname\"" >> $objdir/$libname.def;$echo DATA >> $objdir/$libname.def;$echo " SINGLE NONSHARED" >> $objdir/$libname.def;$echo EXPORTS >> $objdir/$libname.def;emxexp$libobjs >> $objdir/$libname.def;$CC -Zdll -Zcrtdll -o $lib$libobjs$deplibs $objdir/$libname.def'
     old_archive_from_new_cmds='emximp -o $objdir/$libname.a $objdir/$libname.def'
     ;;
 
@@ -1152,13 +1152,13 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
     ;;
 
   sco3.2v5*)
-    archive_cmds='$LD -G -o $lib$libobjs'
+    archive_cmds='$LD -G -o $lib$libobjs$deplibs'
     hardcode_direct=yes
     ;;
 
   solaris2*)
     no_undefined_flag=' -z text'
-    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib$libobjs'
+    archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib$libobjs$deplibs'
     hardcode_libdir_flag_spec='-R$libdir'
     hardcode_shlibpath_var=no
 
@@ -1171,7 +1171,7 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
     ;;
 
   sunos4*)
-    archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs'
+    archive_cmds='$LD -assert pure-text -Bstatic -o $lib$libobjs$deplibs'
     hardcode_libdir_flag_spec='-L$libdir'
     hardcode_direct=yes
     hardcode_minus_L=yes
@@ -1179,7 +1179,7 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
     ;;
 
   uts4*)
-    archive_cmds='$LD -G -h $soname -o $lib$libobjs'
+    archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs'
     hardcode_libdir_flag_spec='-L$libdir'
     hardcode_direct=no
     hardcode_minus_L=no
@@ -1187,7 +1187,7 @@ __dll_entry (HINSTANCE hinst, DWORD reason, LPVOID reserved)
     ;;
 
   dgux*)
-    archive_cmds='$LD -G -h $soname -o $lib$libobjs'
+    archive_cmds='$LD -G -h $soname -o $lib$libobjs$deplibs'
     hardcode_libdir_flag_spec='-L$libdir'
     hardcode_direct=no
     hardcode_minus_L=no
@@ -1427,6 +1427,19 @@ finish_eval=
 shlibpath_var=
 version_type=none
 dynamic_linker="$host_os ld.so"
+check_shared_deplibs_method='none'
+# Need to set the preceding variable on all platforms that support
+# interlibrary dependencies.
+# 'none' -- dependencies disabled.
+# 'pass_all' -- all dependencies passed with no checks.
+# 'test_compile' -- check by making test program.
+# 'file_regex' -- check by looking for filenames that look like the shared
+# library in the library path.
+# 'file_magic [regex]' -- check by looking for files in library path which
+# responds to the "file" command with a given regex.  This is actually a
+# superset of the file_regex command.  If you have file on your system, you'll
+# want to use this instead.
+# Notes: regexes are run through expr.
 
 echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
 case "$host_os" in
@@ -1508,6 +1521,7 @@ linux-gnu*)
   soname_spec='${libname}${release}.so$major'
   finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
   shlibpath_var=LD_LIBRARY_PATH
+  check_shared_deplibs_method='file_magic ELF 32-bit LSB shared object'
 
   if test -f /lib/ld.so.1; then
     dynamic_linker='GNU ld.so'
@@ -1539,6 +1553,7 @@ osf3* | osf4*)
   soname_spec='${libname}${release}.so'
   library_names_spec='${libname}${release}.so$versuffix $libname.so'
   shlibpath_var=LD_LIBRARY_PATH
+  check_shared_deplibs_method='pass_all'
   ;;
 
 sco3.2v5*)
@@ -1648,7 +1663,7 @@ case "$ltmain" in
     whole_archive_flag_spec libname_spec library_names_spec soname_spec \
     RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \
     old_postuninstall_cmds archive_cmds postinstall_cmds postuninstall_cmds \
-    allow_undefined_flag no_undefined_flag \
+    check_shared_deplibs_method allow_undefined_flag no_undefined_flag \
     finish_cmds finish_eval global_symbol_pipe \
     hardcode_libdir_flag_spec hardcode_libdir_separator \
     compiler_c_o compiler_o_lo need_locks; do
@@ -1854,6 +1869,9 @@ archive_cmds=$archive_cmds
 postinstall_cmds=$postinstall_cmds
 postuninstall_cmds=$postuninstall_cmds
 
+# Method to check whether dependent libraries are shared objects.
+check_shared_deplibs_method=$check_shared_deplibs_method
+
 # Flag that allows shared libraries with undefined symbols to be built.
 allow_undefined_flag=$allow_undefined_flag
 
index 006b21469b1edeb9dd80cdd81cbd2d73d4fd4cb2..daa3a0e0f92cc90c75abe004d31e898edff7674f 100644 (file)
--- a/ltmain.in
+++ b/ltmain.in
@@ -567,6 +567,9 @@ compiler."
     convenience=
     old_convenience=
     deplibs=
+    extradeplibs=
+    lib_search_path="/lib /usr/lib"
+    
     dlfiles=
     dlprefiles=
     export_dynamic=no
@@ -730,9 +733,12 @@ compiler."
           ;;
         esac
         deplibs="$deplibs $arg"
+        extradeplibs="$extradeplibs $arg"
+        lib_search_path="$lib_search_path `expr $arg : '-L\(.*\)'`"
         ;;
 
       -l*) deplibs="$deplibs $arg" ;;
+      -El*) extradeplibs="$extradeplibs -`expr $arg : '-E\(.*\)'`" ;;
 
       -no-undefined)
        allow_undefined=no
@@ -1298,6 +1304,185 @@ compiler."
       fi
 
       if test "$build_libtool_libs" = yes; then
+         # Transform deplibs into only deplibs that can be linked in shared.
+         ## Gordon: Do you check for the existence of the libraries in deplibs
+         ## on the system?  That should maybe be merged in here someplace....
+         ## Actually: I think test_compile and file_magic do this... file_regex
+         ## sorta does this. Only pas_all needs to be changed.  -Toshio
+         name_save=$name
+         libname_save=$libname
+         release_save=$release
+         versuffix_save=$versuffix
+         major_save=$major
+         # I'm not sure if I'm treating the release correctly.  I think
+         # release should show up in the -l (ie -lgmp5) so we don't want to
+         # add it in twice.  Is that correct?
+         release=""
+         versuffix=""
+         major=""
+         newdeplibs=
+         case "$check_shared_deplibs_method" in
+         pass_all)   ;; # Don't check for shared/static.  Everything works.
+                        # This might be a little naive.  We might want to check
+                        # whether the library exists or not.  But this is on
+                        # osf3 & osf4 and I'm not really sure... Just
+                        # implementing what was already the behaviour.
+         test_compile)
+           # This code stresses the "libraries are programs" paradigm to its
+           # limits. Maybe even breaks it.  We compile a program, linking it
+           # against the deplibs as a proxy for the library.  Then we can check
+           # whether they linked in statically or dynamically with ldd.
+           $rm conftest.c
+           cat > conftest.c <<EOF
+           int main() { return 0; }
+EOF
+           $rm a.out
+           $CC conftest.c $deplibs $extradeplibs
+           if test $? -eq 0 ; then
+             ldd_output=`ldd a.out`
+             for i in $deplibs; do
+               name="`expr $i : '-l\(.*\)'`"
+               # If $name is empty we are operating on a -L argument.
+               if test "$name" != "" ; 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
+                   echo
+                   echo "*** Warning: This library needs some functionality provided by $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."
+                 fi
+               else
+                 newdeplibs="$newdeplibs $i"
+               fi
+             done
+           else
+           # Error occured in the first compile.  Let's try to salvage the situation:
+             # 1) Is the error in the extradeplibs?
+             $rm a.out
+             $CC conftest.c $extradeplibs
+             if test $? -ne 0 ; then
+               echo
+               echo "*** Warning! Not all libraries necessary to the dependent libraries are"
+               echo "*** working!  You will probably need to install some of:"
+               echo "*** $extradeplibs"
+               echo "*** before this library will be fully functional.  Installing these"
+               echo "***  libraries before continuing would be even better."
+               newextradeplibs=
+               for i in $extradeplibs; do
+                 if test `expr "$i" : '-L'` -ne 0 ; then
+                   newextradeplibs="$newextradeplibs $i"
+                 fi
+               done
+               extradeplibs=$newextradeplibs
+             fi
+             # 2) Compile a seperate 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" != "" ; then
+                 $rm a.out
+                 $CC conftest.c $i $extradeplibs
+                 # Did it work?
+                 if test $? -eq 0 ; then
+                   ldd_output=`ldd a.out`
+                     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
+                       echo
+                       echo "*** Warning: This library needs some functionality provided by $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."
+                     fi
+                 else
+                   echo
+                   echo "*** Warning!  Library $i is needed by this library but I was not able to"
+                   echo "***  make it link in!  You will probably need to install it or some"
+                   echo "*** library that it depends on before this library will be fully"
+                   echo "*** functional.  Installing it before continuing would be even better."
+                 fi
+               else
+                 newdeplibs="$newdeplibs $i"
+               fi
+             done
+           fi
+           deplibs=$newdeplibs
+           ;;
+         file_magic* | file_regex)
+           set dummy $check_shared_deplibs_method
+           file_magic_regex="`expr \"$check_shared_deplibs_method\" : \"$2\(.*\)\"`"
+           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" != "" ; then
+               libname=`eval \\$echo \"$libname_spec\"`
+               case "$check_shared_deplibs_method" in
+                 file_magic*)
+                   for i in $lib_search_path; do
+                    # This needs to be more general than file_regex in order to
+                    # catch things like glibc on linux.  Maybe file_regex
+                    # should be more general as well, but maybe not.  Since
+                    # library names are supposed to conform to
+                    # library_name_spec, I think file_regex should remain
+                    # strict.  What do you think Gordon?
+                     potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
+                     for potent_lib in $potential_libs; do
+                       file_output=`file $potent_lib`
+                       if test `expr "$file_output" : ".*$file_magic_regex"` -ne 0 ; then
+                         newdeplibs="$newdeplibs $a_deplib"
+                         a_deplib=""
+                         break 2
+                       fi
+                     done
+                   done
+                   ;;
+                 file_regex)
+                   deplib_matches=`eval \\$echo \"$library_names_spec\"`
+                   set dummy $deplib_matches
+                   deplib_match=$2
+                   for i in $lib_search_path; do
+                     potential_libs=`ls $i/$deplib_match* 2>/dev/null`
+                     if test "$potential_libs" != "" ; then
+                       newdeplibs="$newdeplibs $a_deplib"
+                       a_deplib=""
+                       break
+                     fi
+                   done
+                   ;;
+               esac
+               if test "$a_deplib" != "" ; then
+                 echo
+                 echo "*** Warning: This library needs some functionality provided by $a_deplib."
+                 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."
+               fi
+             else
+               # Add a -L argument.
+               newdeplibs="$newdeplibs $a_deplib"
+             fi
+           done # Gone through all deplibs.
+           ;;
+         none | *)  deplibs="" ;;
+         esac
+         versuffix=$versuffix_save
+         major=$major_save
+         release=$release_save
+         libname=$libname_save
+         name=$name_save
+         deplibs=$newdeplibs
+        # Done checking deplibs!
        # Get the real and link names of the library.
        eval library_names=\"$library_names_spec\"
        set dummy $library_names
index 33a80fc6bf5d4c0d684a86781ec1867c8438ea67..dcfcb22de5955260c381c46d2c05c5e7a7444929 100644 (file)
@@ -1,398 +1,3 @@
-From nobody Wed Oct 14 16:43:54 1998
-X-From-Line: badger@prtr-13.ucsc.edu Sat Mar 07 06:09:15 1998
-Return-Path: <badger@prtr-13.ucsc.edu>
-Delivered-To: gord@trick.profitpress.com
-Received: (qmail 29304 invoked from network); 7 Mar 1998 06:09:10 -0000
-Received: from unknown (HELO bambam.m-tech.ab.ca) (127.0.0.1)
-  by 127.0.0.1 with SMTP; 7 Mar 1998 06:09:10 -0000
-Received: from mail.cwo.com (gateway.m-tech.ab.ca [10.0.0.1]) by bambam.m-tech.ab.ca (8.8.5/8.6.9) with ESMTP id WAA18468 for <gord@m-tech.ab.ca>; Fri, 6 Mar 1998 22:55:43 -0700
-Received: from Greyeyes.ucsc.edu (badger@port-sac31.cwo.com [207.173.173.146])
-       by mail.cwo.com (8.8.8/8.8.8) with ESMTP id VAA08756
-       for <gord@m-tech.ab.ca>; Fri, 6 Mar 1998 21:59:21 -0800
-Received: (from badger@localhost)
-       by Greyeyes.ucsc.edu (8.8.7/8.8.7) id VAA27714;
-       Fri, 6 Mar 1998 21:54:09 -0800
-Message-ID: <19980306215408.59334@prtr-13.ucsc.edu>
-Date: Fri, 6 Mar 1998 21:54:08 -0800
-From: Toshio Kuratomi <badger@prtr-13.ucsc.edu>
-To: Gordon Matzigkeit <gord@m-tech.ab.ca>
-Subject: Re: InterLibrary Dependency
-References: <19980225175901.56084@prtr-13.ucsc.edu> <8690qzyqqx.fsf@trick.profitpress.com> <19980225214804.59179@prtr-13.ucsc.edu> <863eh2547a.fsf@trick.profitpress.com> <19980303213204.27408@prtr-13.ucsc.edu> <86k9a9du5z.fsf@trick.profitpress.com>
-Mime-Version: 1.0
-Content-Type: multipart/signed; protocol="application/pgp-signature";
-       micalg=pgp-md5; boundary="Ew/8QCHSq3SnV5pl"
-X-Mailer: Mutt 0.88
-In-Reply-To: <86k9a9du5z.fsf@trick.profitpress.com>; from Gordon Matzigkeit on Thu, Mar 05, 1998 at 08:38:48AM -0700
-Xref: trick.profitpress.com mail.libtool:1135
-Lines: 366
-X-Gnus-Article-Number: 1   Mon Nov  2 17:17:55 1998
-
-
---Ew/8QCHSq3SnV5pl
-Content-Type: multipart/mixed; boundary="D7pdK0Ng3jPPYy/f"
-
-
---D7pdK0Ng3jPPYy/f
-Content-Type: text/plain; charset=us-ascii
-
-Okay!  Here's a complete patch!  It works well for me -- I haven't had it do
-anything unexpected.
-
-The best thing to do is probably just to look at the patch itself.  But the
-basic architecture is this:
-in ltconfig.in, the person who writes libtool makes sure $deplibs is included
-in $archive_cmds somewhere and also sets the $check_shared_deplibs_method.
-check_shared_deplibs_method can be any of five things:
-    test_compile
-    file_regex
-    file_magic [regex]
-    pass_all
-    none
-
-I think that file_magic works the best:  It looks in the library link path for
-libraries that have the right libname.  Then it runs file on the library and
-checks for a match against [regex] using expr.  I currently have linux-elf
-looking for the string: "ELF 32-bit LSB shared object" which seems to work well.
-(I don't know whether the "32-bit" would have to change on linux-alpha
-though....  change to 'ELF [0-9]+-bit LSB shared object' might work.  I don't
-know.)
-
-file_regex will look for a filename in the link path.  It doesn't take an
-argument because I use the libname_spec and library_names_spec variables to
-create the string to look for.  I don't like it because symlinks and random
-files can make it give false positives.
-
-test_compile has been overhauled since the last patch.  It now handles -L
-correctly, I hope.  It also takes the names of it's libraries from
-libname_spec instead of a hardcoded lib`expr $a_deplib : '-l/(.*/)'`.so line.
-
-pass_all will pass everything without any checking.  I put it in because
-osf3&4 appear to be treated that way right now... It might be wise to perform
-checks here to see if the libraries exist on the system, but I don't know how
-osf3&4 handle that, so I thought it would be better just to do it the way the
-current code does.
-
-none is the default for all systems unless overridden in ltconfig.in
-(Currently, linux-elf is the only system that overrides.)  It causes deplibs
-to be reassigned deplibs="".  That way archive_cmds can contain deplibs on all
-platforms, but not have deplibs used unless needed.
-
-Okay:: Then in ltmain.in we have the real workhorse: a litle initialization
-and postprocessing (to setup/release variables for use with eval echo
-libname_spec etc.) and a case statement that decides which method is being
-used.  This is the real code... I wish I could condense it a little more, but
-I don't think I can without function calls.  I've mostly optimized it (moved
-things out of loops, etc.) but there is probably some fat left.  I thought I
-should stop while I was ahead, work on whatever bugs you discover, etc before
-thinking about more than obvious optimizations.
-
-Uhm... Anything else?  Ahh -- I can't seem to access my mail server right now,
-I have a feeling the network between it and the outside world has gone down
-again.  I hope this situation is resolved soon, but I have no assurancances
-(These things always happen on a Friday, no?)
-
-If you need to reach me and your mail bounces off my normal address, you can
-send mail to my parent's account mrk-chri@cwo.com and they'll see that I get
-it.
-
--Toshio
-
-(This patch is against libtool-1.0i)
--- 
-badger  \"The Difference between today and yesterday is not so much what has
-@prtr-13 \ changed between then and now as what I hope to change by tomorrow."
-.ucsc.edu  \~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~=~
-
---D7pdK0Ng3jPPYy/f
-Content-Type: text/plain; charset=us-ascii
-Content-Disposition: attachment; filename="libtool-interlibdep.diff"
-
---- libtool-1.0i/ltconfig.in.orig      Fri Feb  6 00:23:19 1998
-+++ libtool-1.0i/ltconfig.in   Fri Mar  6 20:34:39 1998
-@@ -709,7 +709,7 @@
-   # See if GNU ld supports shared libraries.
-   if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
--    archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs'
-+    archive_cmds='$CC -shared ${wl}-soname $wl$soname -o $lib$libobjs$deplibs'
-     runpath_var=LD_RUN_PATH
-     ld_shlibs=yes
-   else
-@@ -1098,6 +1098,19 @@
- shlibpath_var=
- version_type=none
- dynamic_linker="$host_os ld.so"
-+check_shared_deplibs_method='none'
-+# Need to set the preceding variable on all platforms that support
-+# interlibrary dependencies.
-+# 'none' -- dependencies disabled.
-+# 'pass_all' -- all dependencies passed with no checks.
-+# 'test_compile' -- check by making test program.
-+# 'file_regex' -- check by looking for filenames that look like the shared
-+# library in the library path.
-+# 'file_magic [regex]' -- check by looking for files in library path which
-+# responds to the "file" command with a given regex.  This is actually a
-+# superset of the file_regex command.  If you have file on your system, you'll
-+# want to use this instead.
-+# Notes: regexes are run through expr.
- echo $ac_n "checking dynamic linker characteristics... $ac_c" 1>&6
- case "$host_os" in
-@@ -1160,6 +1173,7 @@
-   soname_spec='${libname}${release}.so.$major'
-   finish_cmds='PATH="$PATH:/sbin" ldconfig -n $libdir'
-   shlibpath_var=LD_LIBRARY_PATH
-+  check_shared_deplibs_method='file_magic ELF 32-bit LSB shared object'
-   if test -f /lib/ld.so.1; then
-     dynamic_linker='GNU ld.so'
-@@ -1191,6 +1205,7 @@
-   soname_spec='${libname}${release}.so'
-   library_names_spec='${libname}${release}.so.$versuffix $libname.so'
-   shlibpath_var=LD_LIBRARY_PATH
-+  check_shared_deplibs_method='pass_all'
-   ;;
- sco3.2v5*)
-@@ -1411,6 +1426,9 @@
- archive_cmds="$archive_cmds"
- postinstall_cmds="$postinstall_cmds"
- postuninstall_cmds="$postuninstall_cmds"
-+
-+# Method to check whether dependent libraries are shared objects.
-+check_shared_deplibs_method="$check_shared_deplibs_method"
- # Flag that allows shared libraries with undefined symbols to be built.
- allow_undefined_flag="$allow_undefined_flag"
---- libtool-1.0i/ltmain.in.orig        Fri Feb  6 00:06:22 1998
-+++ libtool-1.0i/ltmain.in     Fri Mar  6 20:56:51 1998
-@@ -363,6 +363,9 @@
-     compile_shlibpath=
-     finalize_shlibpath=
-     deplibs=
-+    extradeplibs=
-+    lib_search_path="/lib /usr/lib"
-+    
-     dlfiles=
-     dlprefiles=
-     export_dynamic=no
-@@ -492,9 +495,12 @@
-           ;;
-         esac
-         deplibs="$deplibs $arg"
-+        extradeplibs="$extradeplibs $arg"
-+        lib_search_path="$lib_search_path `expr $arg : '-L\(.*\)'`"
-         ;;
-       -l*) deplibs="$deplibs $arg" ;;
-+      -El*) extradeplibs="$extradeplibs -`expr $arg : '-E\(.*\)'`" ;;
-       -no-undefined)
-       allow_undefined=no
-@@ -987,6 +993,185 @@
-       fi
-       if test "$build_libtool_libs" = yes; then
-+        # Transform deplibs into only deplibs that can be linked in shared.
-+        ## Gordon: Do you check for the existence of the libraries in deplibs
-+        ## on the system?  That should maybe be merged in here someplace....
-+        ## Actually: I think test_compile and file_magic do this... file_regex
-+        ## sorta does this. Only pas_all needs to be changed.  -Toshio
-+        name_save=$name
-+        libname_save=$libname
-+        release_save=$release
-+        versuffix_save=$versuffix
-+        major_save=$major
-+        # I'm not sure if I'm treating the release correctly.  I think
-+        # release should show up in the -l (ie -lgmp5) so we don't want to
-+        # add it in twice.  Is that correct?
-+        release=""
-+        versuffix=""
-+        major=""
-+        newdeplibs=
-+        case "$check_shared_deplibs_method" in
-+        pass_all)   ;; # Don't check for shared/static.  Everything works.
-+                       # This might be a little naive.  We might want to check
-+                       # whether the library exists or not.  But this is on
-+                       # osf3 & osf4 and I'm not really sure... Just
-+                       # implementing what was already the behaviour.
-+        test_compile)
-+          # This code stresses the "libraries are programs" paradigm to its
-+          # limits. Maybe even breaks it.  We compile a program, linking it
-+          # against the deplibs as a proxy for the library.  Then we can check
-+          # whether they linked in statically or dynamically with ldd.
-+          $rm conftest.c
-+          cat > conftest.c <<EOF
-+          int main() { return 0; }
-+EOF
-+          $rm a.out
-+          $CC conftest.c $deplibs $extradeplibs
-+          if test $? -eq 0 ; then
-+            ldd_output=`ldd a.out`
-+            for i in $deplibs; do
-+              name="`expr $i : '-l\(.*\)'`"
-+              # If $name is empty we are operating on a -L argument.
-+              if test "$name" != "" ; 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
-+                  echo
-+                  echo "*** Warning: This library needs some functionality provided by $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."
-+                fi
-+              else
-+                newdeplibs="$newdeplibs $i"
-+              fi
-+            done
-+          else
-+          # Error occured in the first compile.  Let's try to salvage the situation:
-+            # 1) Is the error in the extradeplibs?
-+            $rm a.out
-+            $CC conftest.c $extradeplibs
-+            if test $? -ne 0 ; then
-+              echo
-+              echo "*** Warning! Not all libraries necessary to the dependent libraries are"
-+              echo "*** working!  You will probably need to install some of:"
-+              echo "*** $extradeplibs"
-+              echo "*** before this library will be fully functional.  Installing these"
-+              echo "***  libraries before continuing would be even better."
-+              newextradeplibs=
-+              for i in $extradeplibs; do
-+                if test `expr "$i" : '-L'` -ne 0 ; then
-+                  newextradeplibs="$newextradeplibs $i"
-+                fi
-+              done
-+              extradeplibs=$newextradeplibs
-+            fi
-+            # 2) Compile a seperate 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" != "" ; then
-+                $rm a.out
-+                $CC conftest.c $i $extradeplibs
-+                # Did it work?
-+                if test $? -eq 0 ; then
-+                  ldd_output=`ldd a.out`
-+                    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
-+                      echo
-+                      echo "*** Warning: This library needs some functionality provided by $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."
-+                    fi
-+                else
-+                  echo
-+                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
-+                  echo "***  make it link in!  You will probably need to install it or some"
-+                  echo "*** library that it depends on before this library will be fully"
-+                  echo "*** functional.  Installing it before continuing would be even better."
-+                fi
-+              else
-+                newdeplibs="$newdeplibs $i"
-+              fi
-+            done
-+          fi
-+          deplibs=$newdeplibs
-+          ;;
-+        file_magic* | file_regex)
-+          set dummy $check_shared_deplibs_method
-+          file_magic_regex="`expr \"$check_shared_deplibs_method\" : \"$2\(.*\)\"`"
-+          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" != "" ; then
-+              libname=`eval \\$echo \"$libname_spec\"`
-+              case "$check_shared_deplibs_method" in
-+                file_magic*)
-+                  for i in $lib_search_path; do
-+                   # This needs to be more general than file_regex in order to
-+                   # catch things like glibc on linux.  Maybe file_regex
-+                   # should be more general as well, but maybe not.  Since
-+                   # library names are supposed to conform to
-+                   # library_name_spec, I think file_regex should remain
-+                   # strict.  What do you think Gordon?
-+                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
-+                    for potent_lib in $potential_libs; do
-+                      file_output=`file $potent_lib`
-+                      if test `expr "$file_output" : ".*$file_magic_regex"` -ne 0 ; then
-+                        newdeplibs="$newdeplibs $a_deplib"
-+                        a_deplib=""
-+                        break 2
-+                      fi
-+                    done
-+                  done
-+                  ;;
-+                file_regex)
-+                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
-+                  set dummy $deplib_matches
-+                  deplib_match=$2
-+                  for i in $lib_search_path; do
-+                    potential_libs=`ls $i/$deplib_match* 2>/dev/null`
-+                    if test "$potential_libs" != "" ; then
-+                      newdeplibs="$newdeplibs $a_deplib"
-+                      a_deplib=""
-+                      break
-+                    fi
-+                  done
-+                  ;;
-+              esac
-+              if test "$a_deplib" != "" ; then
-+                echo
-+                echo "*** Warning: This library needs some functionality provided by $a_deplib."
-+                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."
-+              fi
-+            else
-+              # Add a -L argument.
-+              newdeplibs="$newdeplibs $a_deplib"
-+            fi
-+          done # Gone through all deplibs.
-+          ;;
-+        none | *)  deplibs="" ;;
-+        esac
-+        versuffix=$versuffix_save
-+        major=$major_save
-+        release=$release_save
-+        libname=$libname_save
-+        name=$name_save
-+        deplibs=$newdeplibs
-+       # Done checking deplibs!
-+
-         # Get the real and link names of the library.
-         library_names=`eval \\$echo \"$library_names_spec\"`
-         set dummy $library_names
-
---D7pdK0Ng3jPPYy/f--
-
---Ew/8QCHSq3SnV5pl
-Content-Type: application/pgp-signature
-
------BEGIN PGP SIGNATURE-----
-Version: 2.6.3ia
-
-iQCVAwUBNQDg/2I4kZK9uLMpAQGQfwQAo5wbFpHA4588S6R+zTjgIYPa1caMFZhM
-ehwKr0JSyu8mSkp9tSavavTkyq/AE6+NnvZeNU5NpWxvfCk32f5lhEzWaU69HFfy
-CjpxiDUi/74EeQrobfchoYeC6KhN66Y6JsSi1ayZa52P7hFibS674ORVXxw2zNq3
-NUfJkmb2mTY=
-=q0bH
------END PGP SIGNATURE-----
-
---Ew/8QCHSq3SnV5pl--
-
 From nobody Wed Oct 14 16:45:01 1998
 X-From-Line: ian@cygnus.com Fri Apr 17 23:33:18 1998
 Return-Path: <ian@cygnus.com>