libtool-patches
[Top][All Lists]
Advanced

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

libtool-1.5.10.multilib2.patch


From: Daniel Reed
Subject: libtool-1.5.10.multilib2.patch
Date: Tue, 16 Nov 2004 18:32:04 -0500 (EST)

This is my second go at a multilib patch (intended to replace our original
libtool-1.4.2-multilib.patch). Instead of munging sys_lib_search_path_spec, this
new patch causes Libtool to use gcc's -print-file-name feature if present. This
has an added benefit of theoretically supporting multilib on non-Linux,
gcc-using systems. It may also more-closely fit Libtool's .la search algorithm
with what GCC uses.

address@hidden:~/libtool-1.5.10-build$ uname -a
Linux tallest.boston.redhat.com 2.6.9-1.667smp #1 SMP Tue Nov 2 15:09:11 EST 
2004 x86_64 x86_64 x86_64 GNU/Linux
address@hidden:~/libtool-1.5.10-build$ gcc -print-file-name=libpopt.la
/usr/lib/gcc/x86_64-redhat-linux/3.4.2/../../../../lib64/libpopt.la
address@hidden:~/libtool-1.5.10-build$ readlink -f `gcc 
-print-file-name=libpopt.la`
/usr/lib64/libpopt.la
address@hidden:~/libtool-1.5.10-build$ readlink -f `gcc -m32 
-print-file-name=libpopt.la`
/usr/lib/libpopt.la
address@hidden:~/libtool-1.5.10-build$ readlink -f `gcc -m64 
-print-file-name=libpopt.la`
/usr/lib64/libpopt.la
address@hidden:~/libtool-1.5.10-build$


This is to solve the following problem:

address@hidden:~/libtool-1.5.10_orig-build$ ./libtool --mode=link gcc -m64 
-shared -o library.so -lpopt
gcc -m64 -shared -o library.so  /usr/lib/libpopt.so
/usr/lib/libpopt.so: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
address@hidden:~/libtool-1.5.10_orig-build$

Like this:

address@hidden:~/libtool-1.5.10-build$ ./libtool --mode=link gcc -m64 -shared 
-o library.so -lpopt
gcc -m64 -shared -o library.so  /usr/lib64/libpopt.so -Wl,--rpath 
-Wl,/usr/lib64 -Wl,--rpath -Wl,/usr/lib64
address@hidden:~/libtool-1.5.10-build$


Libtool will continue to honor -L paths first, then attempt to use gcc
-print-file-name, then fall back on $sys_lib_search_path and $shlib_search_path.
It should fail to use gcc -print-file-name gracefully if either gcc is not in
use or the gcc in use does not support -print-file-name.



diff -rcN libtool-1.5.10_orig/libltdl/ltmain.sh libtool-1.5.10/libltdl/ltmain.sh
*** libtool-1.5.10_orig/libltdl/ltmain.sh       2004-09-19 08:34:44.000000000 
-0400
--- libtool-1.5.10/libltdl/ltmain.sh    2004-11-16 17:43:19.201193000 -0500
***************
*** 44,50 ****
  PROGRAM=ltmain.sh
  PACKAGE=libtool
  VERSION=1.5.10
! TIMESTAMP=" (1.1220.2.130 2004/09/19 12:13:49)"

  # See if we are running on zsh, and set the options which allow our
  # commands through without removal of \ escapes.
--- 44,50 ----
  PROGRAM=ltmain.sh
  PACKAGE=libtool
  VERSION=1.5.10
! TIMESTAMP=" (1.1220.2.131 2004/09/19 12:46:56)"

  # See if we are running on zsh, and set the options which allow our
  # commands through without removal of \ escapes.
***************
*** 1990,1996 ****
            continue
          fi
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
!         for searchdir in $newlib_search_path $lib_search_path 
$sys_lib_search_path $shlib_search_path; do
            for search_ext in .la $std_shrext .so .a; do
              # Search the libtool library
              lib="$searchdir/lib${name}${search_ext}"
--- 1990,1997 ----
            continue
          fi
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
!         found=unknown
!         for searchdir in $newlib_search_path $lib_search_path; do
            for search_ext in .la $std_shrext .so .a; do
              # Search the libtool library
              lib="$searchdir/lib${name}${search_ext}"
***************
*** 2004,2009 ****
--- 2005,2039 ----
              fi
            done
          done
+         if test "$found,$with_gcc" = "unknown,yes" && $compile_command 
-print-file-name=dummy >/dev/null 2>&1; then
+           for search_ext in .la $std_shrext .so .a; do
+             lib=`$compile_command -print-file-name=lib${name}${search_ext}`
+             if test "$lib" != "lib${name}${search_ext}"; then
+               if test "$search_ext" = ".la"; then
+                 found=yes
+               else
+                 found=no
+               fi
+               break
+             fi
+           done
+         fi
+         if test "$found" = "unknown"; then
+           for searchdir in $sys_lib_search_path $shlib_search_path; do
+             for search_ext in .la $std_shrext .so .a; do
+               # Search the libtool library
+               lib="$searchdir/lib${name}${search_ext}"
+               if test -f "$lib"; then
+                 if test "$search_ext" = ".la"; then
+                   found=yes
+                 else
+                   found=no
+                 fi
+                 break 2
+               fi
+             done
+           done
+         fi
          if test "$found" != yes; then
            # deplib doesn't seem to be a libtool library
            if test "$linkmode,$pass" = "prog,link"; then
diff -rcN libtool-1.5.10_orig/ltmain.in libtool-1.5.10/ltmain.in
*** libtool-1.5.10_orig/ltmain.in       2004-09-19 08:15:12.000000000 -0400
--- libtool-1.5.10/ltmain.in    2004-11-16 17:43:06.039362000 -0500
***************
*** 1990,1996 ****
            continue
          fi
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
!         for searchdir in $newlib_search_path $lib_search_path 
$sys_lib_search_path $shlib_search_path; do
            for search_ext in .la $std_shrext .so .a; do
              # Search the libtool library
              lib="$searchdir/lib${name}${search_ext}"
--- 1990,1997 ----
            continue
          fi
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
!         found=unknown
!         for searchdir in $newlib_search_path $lib_search_path; do
            for search_ext in .la $std_shrext .so .a; do
              # Search the libtool library
              lib="$searchdir/lib${name}${search_ext}"
***************
*** 2004,2009 ****
--- 2005,2039 ----
              fi
            done
          done
+         if test "$found,$with_gcc" = "unknown,yes" && $compile_command 
-print-file-name=dummy >/dev/null 2>&1; then
+           for search_ext in .la $std_shrext .so .a; do
+             lib=`$compile_command -print-file-name=lib${name}${search_ext}`
+             if test "$lib" != "lib${name}${search_ext}"; then
+               if test "$search_ext" = ".la"; then
+                 found=yes
+               else
+                 found=no
+               fi
+               break
+             fi
+           done
+         fi
+         if test "$found" = "unknown"; then
+           for searchdir in $sys_lib_search_path $shlib_search_path; do
+             for search_ext in .la $std_shrext .so .a; do
+               # Search the libtool library
+               lib="$searchdir/lib${name}${search_ext}"
+               if test -f "$lib"; then
+                 if test "$search_ext" = ".la"; then
+                   found=yes
+                 else
+                   found=no
+                 fi
+                 break 2
+               fi
+             done
+           done
+         fi
          if test "$found" != yes; then
            # deplib doesn't seem to be a libtool library
            if test "$linkmode,$pass" = "prog,link"; then
diff -rcN libtool-1.5.10_orig/ltmain.sh libtool-1.5.10/ltmain.sh
*** libtool-1.5.10_orig/ltmain.sh       2004-09-19 08:34:44.000000000 -0400
--- libtool-1.5.10/ltmain.sh    2004-11-16 17:43:19.189201000 -0500
***************
*** 44,50 ****
  PROGRAM=ltmain.sh
  PACKAGE=libtool
  VERSION=1.5.10
! TIMESTAMP=" (1.1220.2.130 2004/09/19 12:13:49)"

  # See if we are running on zsh, and set the options which allow our
  # commands through without removal of \ escapes.
--- 44,50 ----
  PROGRAM=ltmain.sh
  PACKAGE=libtool
  VERSION=1.5.10
! TIMESTAMP=" (1.1220.2.131 2004/09/19 12:46:56)"

  # See if we are running on zsh, and set the options which allow our
  # commands through without removal of \ escapes.
***************
*** 1990,1996 ****
            continue
          fi
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
!         for searchdir in $newlib_search_path $lib_search_path 
$sys_lib_search_path $shlib_search_path; do
            for search_ext in .la $std_shrext .so .a; do
              # Search the libtool library
              lib="$searchdir/lib${name}${search_ext}"
--- 1990,1997 ----
            continue
          fi
          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
!         found=unknown
!         for searchdir in $newlib_search_path $lib_search_path; do
            for search_ext in .la $std_shrext .so .a; do
              # Search the libtool library
              lib="$searchdir/lib${name}${search_ext}"
***************
*** 2004,2009 ****
--- 2005,2039 ----
              fi
            done
          done
+         if test "$found,$with_gcc" = "unknown,yes" && $compile_command 
-print-file-name=dummy >/dev/null 2>&1; then
+           for search_ext in .la $std_shrext .so .a; do
+             lib=`$compile_command -print-file-name=lib${name}${search_ext}`
+             if test "$lib" != "lib${name}${search_ext}"; then
+               if test "$search_ext" = ".la"; then
+                 found=yes
+               else
+                 found=no
+               fi
+               break
+             fi
+           done
+         fi
+         if test "$found" = "unknown"; then
+           for searchdir in $sys_lib_search_path $shlib_search_path; do
+             for search_ext in .la $std_shrext .so .a; do
+               # Search the libtool library
+               lib="$searchdir/lib${name}${search_ext}"
+               if test -f "$lib"; then
+                 if test "$search_ext" = ".la"; then
+                   found=yes
+                 else
+                   found=no
+                 fi
+                 break 2
+               fi
+             done
+           done
+         fi
          if test "$found" != yes; then
            # deplib doesn't seem to be a libtool library
            if test "$linkmode,$pass" = "prog,link"; then



--
Daniel Reed <address@hidden>      http://people.redhat.com/djr/   Desktop and 
Cygwin




reply via email to

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