Further to my last posting...

Having spent the weekend pre-binding libraries with the aid of libtool,
only to discover that the X11 libs aren't prebound (hear me growl)... :-)

patch attached, though I'm not recommending it for inclusion into CVS -
it's more by way of an FYI: here's the libtool that I'm now using at home.

it's much simpler than my previous patches because this time I'm not
including my own lt-dyld dl wrapper. instead I'm using the excellent
dlcompat (which still needs one or two kinks ironed out, but that's well
in hand).

also, rather than make support for @executable_path install_name explicit
I've added support for defining -bundle_loader and -install_name in
configure; see the macros in dyld.m4, which need to be used prior to
AC_PROG_LIBTOOL. (I haven't tested the -bundle_loader bit yet.)

if prebinding, seg1addr can be specified like:

libMyLib_la_LDFLAGS = -no-undefined -Xlinker -seg1addr -Xlinker 1234abcd

finally, libstdc++ and libgcc are provided only as static libs on Darwin,
and the -no-undefined flag causes libtool to regard this as a problem. I
added a hack to treat these two libs as special cases.

fwiw,
Frank

Francis James Franklin
[EMAIL PROTECTED]

  `Medium atomic weights are available: Gold, Lead, Copper, Jet, Diamond,
Radium, Sapphire, Silver and Steel.
  `Sapphire and Steel have been assigned...'
diff -Naur libtool/bootstrap libtool.mod/bootstrap
--- libtool/bootstrap   Wed Jul 31 21:15:27 2002
+++ libtool.mod/bootstrap       Sun Oct 13 18:09:02 2002
@@ -23,7 +23,7 @@
     ;;
   libltdl)
     top_srcdir=..
-    acfiles="$top_srcdir/libtool.m4 $top_srcdir/ltdl.m4"
+    acfiles="$top_srcdir/libtool.m4 $top_srcdir/ltdl.m4 $top_srcdir/dyld.m4"
     AUTOMAKE_FLAGS="--gnits --add-missing"
     ;;
   *)
diff -Naur libtool/dyld.m4 libtool.mod/dyld.m4
--- libtool/dyld.m4     Thu Jan  1 01:00:00 1970
+++ libtool.mod/dyld.m4 Sun Oct 13 18:09:02 2002
@@ -0,0 +1,40 @@
+# dyld.m4 - Configure libtool for the host system. -*-Autoconf-*-
+## Copyright 1996, 1997, 1998, 1999, 2000, 2001
+## Free Software Foundation, Inc.
+## Originally by Gordon Matzigkeit <[EMAIL PROTECTED]>, 1996
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful, but
+## WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+## General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+##
+## As a special exception to the GNU General Public License, if you
+## distribute this file as part of a program that contains a
+## configuration script generated by Autoconf, you may include it under
+## the same distribution terms that you use for the rest of that program.
+
+# DYLD_INSTALL_PATH(INSTALLATION-PATH)
+# ------------------------------------
+AC_DEFUN([DYLD_INSTALL_PATH],[
+if test "x$1" != "x"; then
+  _lt_install_name='-install_name $1/$soname'
+  _lt_install_name_set='yes'
+else
+  _lt_install_name=''
+  _lt_install_name_set=''
+fi
+])
+
+# DYLD_BUNDLE_LOADER(EXECUTABLE-PATH)
+# -----------------------------------
+AC_DEFUN([DYLD_BUNDLE_LOADER],
+[if test "x$1" != "x"; then _lt_bundle_loader='-bundle_loader $1'; else 
+_lt_bundle_loader=''; fi])
diff -Naur libtool/libltdl/Makefile.am libtool.mod/libltdl/Makefile.am
--- libtool/libltdl/Makefile.am Tue Sep 11 02:26:44 2001
+++ libtool.mod/libltdl/Makefile.am     Sun Oct 13 18:09:02 2002
@@ -18,7 +18,7 @@
 CLEANFILES = libltdl.la libltdlc.la
 
 libltdl_la_SOURCES = ltdl.c
-libltdl_la_LDFLAGS = -no-undefined -version-info 4:0:1
+libltdl_la_LDFLAGS = -no-undefined -version-info 4:0:1 -Xlinker -seg1addr -Xlinker 
+3ffe0000
 libltdl_la_LIBADD = $(LIBADD_DL)
 
 libltdlc_la_SOURCES = ltdl.c
diff -Naur libtool/libltdl/configure.ac libtool.mod/libltdl/configure.ac
--- libtool/libltdl/configure.ac        Sat Oct  6 16:35:17 2001
+++ libtool.mod/libltdl/configure.ac    Sun Oct 13 18:09:02 2002
@@ -70,6 +70,8 @@
 ## ----------------------- ##
 ## Libtool initialisation. ##
 ## ----------------------- ##
+DYLD_INSTALL_PATH(@executable_path/../Frameworks)
+
 AC_LIBTOOL_WIN32_DLL
 AC_PROG_LIBTOOL
 AC_SUBST([LIBTOOL_DEPS])
diff -Naur libtool/libtool.m4 libtool.mod/libtool.m4
--- libtool/libtool.m4  Tue Sep 10 14:50:06 2002
+++ libtool.mod/libtool.m4      Sun Oct 13 18:10:16 2002
@@ -1012,7 +1012,18 @@
 dynamic_linker="$host_os ld.so"
 sys_lib_dlsearch_path_spec="/lib /usr/lib"
 if test "$GCC" = yes; then
-  sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e 
"s/^libraries://" -e "s,=/,/,g"`
+  sys_lib_search_path_append=no
+  sys_lib_search_path_cc="$CC"
+  if test "x$sys_lib_search_path_cc" = "x"; then sys_lib_search_path_cc="gcc"; fi
+  for i in `$sys_lib_search_path_cc -print-search-dirs`; do
+    case $i in
+      libraries*) sys_lib_search_path_append=yes ;;
+      *) ;;
+    esac
+    if test $sys_lib_search_path_append = yes; then
+      sys_lib_search_path_spec="$sys_lib_search_path_spec `echo $i | sed -e 
+'s/^libraries://' -e 's,=/,/,g'`"
+    fi
+  done
   if echo "$sys_lib_search_path_spec" | egrep ';' >/dev/null ; then
     # if the path contains ";" then we assume it to be the separator
     # otherwise default to the standard path separator (i.e. ":") - it is
@@ -2628,6 +2639,11 @@
          _LT_AC_TAGVAR(ld_shlibs, $1)=no
         ;;
 
+  darwin* | rhapsody*)
+    _LT_AC_TAGVAR(archive_cmds, $1)='$CC $(test .$module = .yes && echo -bundle 
+'$_lt_bundle_loader' || echo -dynamiclib $(test .'$_lt_install_name_set' = . && echo 
+-install_name $rpath/$soname)'$_lt_install_name' -prebind -multiply_defined suppress 
+$verstring) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags'
+    _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+    ;;
+
   dgux*)
     case $cc_basename in
       ec++)
@@ -4947,7 +4963,7 @@
       #        cross-compilation, but unfortunately the echo tests do not
       #        yet detect zsh echo's removal of \ escapes.  Also zsh mangles
       #               `"' quotes if we put them in here... so don't!
-      _LT_AC_TAGVAR(archive_cmds, $1)='$CC $(test .$module = .yes && echo -bundle || 
echo -dynamiclib) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags 
-install_name $rpath/$soname $verstring'
+      _LT_AC_TAGVAR(archive_cmds, $1)='$CC $(test .$module = .yes && echo -bundle 
+'$_lt_bundle_loader' || echo -dynamiclib $(test .'$_lt_install_name_set' = . && echo 
+-install_name $rpath/$soname)'$_lt_install_name' -prebind -multiply_defined suppress 
+$verstring) $allow_undefined_flag -o $lib $libobjs $deplibs$linker_flags'
       # We need to add '_' to the symbols in $export_symbols first
       #_LT_AC_TAGVAR(archive_expsym_cmds, $1)="$_LT_AC_TAGVAR(archive_cmds, $1)"' && 
strip -s $export_symbols'
       _LT_AC_TAGVAR(hardcode_direct, $1)=yes
@@ -5286,7 +5302,7 @@
       libname=conftest
       lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
       _LT_AC_TAGVAR(allow_undefined_flag, $1)=
-      if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" 
\>/dev/null 2\>\&1)
+      if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| sed s/-lSystem/-lc/ \| 
+grep \" -lc \" \>/dev/null 2\>\&1)
       then
        _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
       else
diff -Naur libtool/ltmain.in libtool.mod/ltmain.in
--- libtool/ltmain.in   Wed Sep 25 05:26:20 2002
+++ libtool.mod/ltmain.in       Sun Oct 13 18:27:02 2002
@@ -2353,6 +2353,7 @@
          if test "$link_all_deplibs" != no; then
            # Add the search paths of all dependency libraries
            for deplib in $dependency_libs; do
+             prepend_deplib=
              case $deplib in
              -L*) path="$deplib" ;;
              *.la)
@@ -2382,12 +2383,17 @@
                  fi
                  path="-L$absdir"
                fi
+               # well, this seems to fix the problem, but how wise is it? (fjf)
+               tmp_laname=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+               tmp_name=`$echo "X$tmp_laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
+               newlib_search_path="$newlib_search_path $absdir/$objdir"
+               prepend_deplib="-l$tmp_name "
                ;;
              *) continue ;;
              esac
              case " $deplibs " in
              *" $path "*) ;;
-             *) deplibs="$deplibs $path" ;;
+             *) deplibs="$prepend_deplib$deplibs $path" ;;
              esac
            done
          fi # link_all_deplibs != no
@@ -2995,6 +3001,12 @@
                        a_deplib=""
                        break 2
                      fi
+                     # Darwin only has static versions of these, but doesn't mean we 
+can't build a shared lib (fjf)
+                     if test "$potent_lib" = "$i/libstdc++.a" || test "$potent_lib" = 
+"$i/libgcc.a"; then
+                       newdeplibs="$newdeplibs $a_deplib"
+                       a_deplib=""
+                       break 2
+                     fi
                    done
              done
              if test -n "$a_deplib" ; then
@@ -4383,8 +4395,11 @@
            fi
          done
          RANLIB=$save_RANLIB
-         oldobjs=$objlist
-         eval cmds=\"\$concat_cmds~$old_archive_cmds\"
+         # should this be here at all? (fjf)
+         if test -n "$oldlist"; then
+           oldobjs=$objlist
+           eval cmds=\"\$concat_cmds~$old_archive_cmds\"
+         fi
        fi
       fi
       save_ifs="$IFS"; IFS='~'

Reply via email to