[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
darwin patch
From: |
Peter O'Gorman |
Subject: |
darwin patch |
Date: |
Mon, 10 Feb 2003 00:53:49 +0900 |
Hi, here is my proposed patch for, I hope, improved darwin support.
1) always append /lib /usr/lib and /usr/local/lib to the search path,
done this way so that even if apple changes the output of
-print-search-dirs yet again, libtool will look in the same places as
ld.
2) add C specific archive commands so not everything is single module
bind_at_load
3) add support for archive_expsym_commands
4) enable_shared_with_static_runtimes=yes to stop complaints about
static only libgcc and libstdc++
5) (and you might not want to apply this) make the incremental linking
run ranlib
There are other things I'd like to do:
1) add support for -dylib_file so that relinking in unnecessary on
darwin. I have no idea how to do this cleanly, libtool seems to expect
the dir to be coded into the binary, but on darwin the whole path
including the libname is encoded. To link against and uninstalled
shared library, I'd like to add -dylib_file
libfoo.1.dylib:/path/to/build/dir/libfoo.1.dylib somewhere in the link
commands. No idea how to do this cleanly.
2) add twolevel_namespace support
3) remove -bind_at_load from ltmain.in for darwin. First I need to
figure out how to add it only when new libs/executables are linked
against c++ shared libraries, perhaps by writing something to the
dependency_libs of the c++ library when it is built?
Then, here is the patch, inline and attached, if you add it please use
address@hidden as the ChangeLog committer.
Thanks,
Peter
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.298
diff -u -d -b -w -r1.298 libtool.m4
--- libtool.m4 6 Feb 2003 04:51:20 -0000 1.298
+++ libtool.m4 9 Feb 2003 15:31:18 -0000
@@ -1226,7 +1226,7 @@
shlibpath_var=DYLD_LIBRARY_PATH
shrext='$(test .$module = .yes && echo so || echo dylib)'
# Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the
same.
- sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n"
"$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" |
grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e
"s,$PATH_SEPARATOR, ,g"`
+ sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n"
"$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" |
grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e
"s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
;;
dgux*)
@@ -2472,6 +2472,28 @@
test "$enable_shared" = yes && enable_static=no
fi
;;
+ darwin* | rhapsody*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ case "$host_os" in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
+ ;;
+ *) # Darwin 1.3 on
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace
-undefined suppress'
+ ;;
+ esac
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ # FIXME: Relying on posixy $() will cause problems for
+ # 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 $(test .$module != .yes && echo
-install_name $rpath/$soname $verstring)'
+ # Don't fix this by using the ld -exported_symbols_list flag, it
doesn't exist in older darwin ld's
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[
]*,," -e "s,^\(..*\),_&," < $export_symbols >
$output_objdir/${libname}-symbols.expsym && $CC $(test .$module = .yes
&& echo -bundle || echo -dynamiclib) $allow_undefined_flag -o $lib
$libobjs $deplibs$linker_flags $(test .$module != .yes && echo
-install_name $rpath/$soname $verstring) && strip -s
$output_objdir/${libname}-symbols.expsym -u ${lib}'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
+ ;;
esac
AC_MSG_RESULT([$enable_shared])
@@ -2764,14 +2786,14 @@
_LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace
-undefined suppress'
;;
esac
-
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
# FIXME: Relying on posixy $() will cause problems for
# 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 -r ${wl}-bind_at_load
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC
$(test .$module = .yes && echo -bundle || echo -dynamiclib)
$allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags
$(test .$module != .yes && echo -install_name $rpath/$soname
$verstring)'
- # 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'
+ # Don't fix this by using the ld -exported_symbols_list flag, it
doesn't exist in older darwin ld's
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[
]*,," -e "s,^\(..*\),_&," < $export_symbols >
$output_objdir/${libname}-symbols.expsym && $CC -r ${wl}-bind_at_load
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC
$(test .$module = .yes && echo -bundle || echo -dynamiclib)
$allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags
$(test .$module != .yes && echo -install_name $rpath/$soname
$verstring) && strip -s $output_objdir/${libname}-symbols.expsym -u
${lib}'
_LT_AC_TAGVAR(hardcode_direct, $1)=yes
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load $convenience'
@@ -5157,14 +5179,14 @@
_LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined
suppress'
;;
esac
-
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
# FIXME: Relying on posixy $() will cause problems for
# 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 -r ${wl}-bind_at_load
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC
$(test .$module = .yes && echo -bundle || echo -dynamiclib)
$allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags
$(test .$module != .yes && echo -install_name $rpath/$soname
$verstring)'
- # 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'
+ # Don't fix this by using the ld -exported_symbols_list flag, it
doesn't exist in older darwin ld's
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e
"s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols >
$output_objdir/${libname}-symbols.expsym && $CC -r ${wl}-bind_at_load
-keep_private_externs -nostdlib -o ${lib}-master.o $libobjs && $CC
$(test .$module = .yes && echo -bundle || echo -dynamiclib)
$allow_undefined_flag -o $lib ${lib}-master.o $deplibs$linker_flags
$(test .$module != .yes && echo -install_name $rpath/$soname
$verstring) && strip -s $output_objdir/${libname}-symbols.expsym -u
${lib}'
_LT_AC_TAGVAR(hardcode_direct, $1)=yes
_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
_LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-all_load
$convenience'
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.322
diff -u -d -b -w -r1.322 ltmain.in
--- ltmain.in 29 Jan 2003 04:53:18 -0000 1.322
+++ ltmain.in 9 Feb 2003 15:31:19 -0000
@@ -4866,7 +4866,7 @@
RANLIB=$save_RANLIB
oldobjs=$objlist
if test "X$oldobjs" = "X" ; then
- eval cmds=\"\$concat_cmds\"
+ eval cmds=\"\$concat_cmds~$RANLIB $oldlib\"
else
eval cmds=\"\$concat_cmds~$old_archive_cmds\"
fi
darwin.diff.gz
Description: GNU Zip compressed data