[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
darwin patch (next attempt)
From: |
Peter O'Gorman |
Subject: |
darwin patch (next attempt) |
Date: |
Wed, 19 Feb 2003 01:11:33 +0900 |
Hi,
Here is an updated darwin patch, first the results of "make check":
====================
4 of 99 tests failed
====================
3 of these are fortran tests, I'll let someone who knows something
about it fix those, the other is the hardcode test, which is okay, as
the test is broken for darwin, please don't ask me to fix the test :-)
Now to the patch itself:
You will notice that I added two level namespace support (in a way).
The reason being that some things work fine on elf but don't work on
darwin due to symbol conflicts, this is mostly (only?) a problem with
libraries that are loaded as a result of runtime loading a module, the
libraries are always global namespace and sometimes cause conflicts.
The patch tests an environment variable (LD_TWOLEVEL_NAMESPACE) and if
it is set, does not set the allow_undefined_flag. I believe, because it
is an env var, this will discourage darwin based developers from
building libs with libtool which will not build anywhere else (nobody
ever seems to give out to elf based developers for doing this :) ),
but will allow users to set it if they are having trouble getting a
package to run properly. It also has the added advantage of allowing
the user to attempt to build libtool libraries and executables prebound
(using the LD_PREBIND environment variable as well).
Also, I "fixed" the incremental linking patch so that ranlib will get
called if it is in the old_archive_cmds.
There is a test for zsh in the archive_expsym_cmds, because I could not
figure out a way of using sed statements without a quote of any kind.
So archive_expsym_cmds will only work on darwin if the shell is not zsh.
Corrected sys_lib_dlsearch_path_spec.
Only add -bind_at_load to the executable if the tag is CXX.
In ltmain.in if link_all_deplibs is not no, then actually link against
them on darwin (I was not sure *why* it doesn't, so I put the stuff
inside case statements), this makes the depdemo tests pass.
Otherwise the above is just the same as my last patch :-)
ltdl.m4 - libltdl_cv_sys_dlopen_deplibs=yes (dyld does this) and
libltdl_cv_shlibext=".so" (the code can't figure it out due to the
tests in the library_names_spec).
The patch is inline and attached.
Thanks,
Peter
Index: libtool.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/libtool.m4,v
retrieving revision 1.300
diff -u -d -b -w -r1.300 libtool.m4
--- libtool.m4 18 Feb 2003 05:15:03 -0000 1.300
+++ libtool.m4 18 Feb 2003 16:04:41 -0000
@@ -1226,7 +1226,8 @@
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"`
+ sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
;;
dgux*)
@@ -2241,7 +2242,7 @@
[AC_REQUIRE([AC_CANONICAL_HOST])dnl
LIBM=
case $host in
-*-*-beos* | *-*-cygwin* | *-*-pw32*)
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
# These system don't have libm
;;
*-ncr-sysv4.3*)
@@ -2472,6 +2473,33 @@
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
+ test -z ${LD_TWOLEVEL_NAMESPACE} &&
_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
+ if test -z ${ZSH_VERSION} ; then
+ _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}'
+ else
+ #just in case a default was set somewhere
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
+ fi
+ _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])
@@ -2761,17 +2789,22 @@
_LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
;;
*) # Darwin 1.3 on
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace
-undefined suppress'
+ test -z ${LD_TWOLEVEL_NAMESPACE} &&
_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
+ if test -z ${ZSH_VERSION} ; then
+ _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}'
+ else
+ #just in case a default was set somewhere
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
+ fi
_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'
@@ -5154,17 +5187,22 @@
_LT_AC_TAGVAR(allow_undefined_flag, $1)='-undefined suppress'
;;
*) # Darwin 1.3 on
- _LT_AC_TAGVAR(allow_undefined_flag, $1)='-flat_namespace -undefined
suppress'
+ test -z ${LD_TWOLEVEL_NAMESPACE} &&
_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
+ if test -z ${ZSH_VERSION} ; then
+ _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}'
+ else
+ #just in case a default was set somewhere
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)=''
+ fi
_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: ltdl.m4
===================================================================
RCS file: /cvsroot/libtool/libtool/ltdl.m4,v
retrieving revision 1.45
diff -u -d -b -w -r1.45 ltdl.m4
--- ltdl.m4 19 Nov 2002 09:42:39 -0000 1.45
+++ ltdl.m4 18 Feb 2003 16:04:41 -0000
@@ -137,6 +137,11 @@
aix[[45]]*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
+ darwin*)
+ # Assuming the user has installed a libdl from somewhere, this is
true
+ # If you are looking for one
http://www.opendarwin.org/projects/dlcompat
+ libltdl_cv_sys_dlopen_deplibs=yes
+ ;;
gnu*)
libltdl_cv_sys_dlopen_deplibs=yes
;;
@@ -210,6 +215,12 @@
libltdl_cv_shlibext=`cat conftest`
rm -f conftest
])
+ # The above does not work on darwin, due to the test's in the
library_names_spec
+ # The test description should probably say "which extension is used
for loadable
+ # modules"
+ case "$host_os" in
+ darwin*) libltdl_cv_shlibext=".so" ;;
+ esac
if test -n "$libltdl_cv_shlibext"; then
AC_DEFINE_UNQUOTED(LTDL_SHLIB_EXT, "$libltdl_cv_shlibext",
[Define to the extension used for shared libraries, say, ".so".])
Index: ltmain.in
===================================================================
RCS file: /cvsroot/libtool/libtool/ltmain.in,v
retrieving revision 1.323
diff -u -d -b -w -r1.323 ltmain.in
--- ltmain.in 17 Feb 2003 18:55:45 -0000 1.323
+++ ltmain.in 18 Feb 2003 16:04:42 -0000
@@ -2490,6 +2490,7 @@
if test "$link_all_deplibs" != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
+ depdepl=
case $deplib in
-L*) path="$deplib" ;;
*.la)
@@ -2507,7 +2508,7 @@
;;
esac
if grep "^installed=no" $deplib > /dev/null; then
- path="-L$absdir/$objdir"
+ path="$absdir/$objdir"
else
eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
if test -z "$libdir"; then
@@ -2517,12 +2518,33 @@
if test "$absdir" != "$libdir"; then
$echo "$modename: warning: \`$deplib' seems to be moved"
1>&2
fi
- path="-L$absdir"
+ path="$absdir"
fi
+ depdepl=
+ case $host in
+ *-*-darwin*)
+ depdepl=`$echo "X$deplib" | ${SED} -e 's,.*/,,' -e 's,^lib,,' -e
's,\.la$,,'`
+ depdepl="-l$depdepl"
+ newlib_search_path="$newlib_search_path $path"
+ ;;
+ esac
+ path="-L$path"
+ ;;
+ -l*)
+ case $host in
+ *-*-darwin*)
+ depdepl=$deplib
+ ;;
+ *) continue ;;
+ esac
;;
*) continue ;;
esac
case " $deplibs " in
+ *" $depdepl "*) ;;
+ *) deplibs="$deplibs $depdepl" ;;
+ esac
+ case " $deplibs " in
*" $path "*) ;;
*) deplibs="$deplibs $path" ;;
esac
@@ -3903,8 +3925,10 @@
case $host in
*darwin*)
# Don't allow lazy linking, it breaks C++ global constructors
+ if test "$tagname" = CXX ; then
compile_command="$compile_command ${wl}-bind_at_load"
finalize_command="$finalize_command ${wl}-bind_at_load"
+ fi
;;
esac
@@ -4857,6 +4881,11 @@
$echo "$modename: warning: to ensure that POSIX-compatible ar
will work" 1>&2
AR_FLAGS=cq
fi
+ # Is there a better way of finding the last object in the list?
+ for obj in $save_oldobjs
+ do
+ last_oldobj=$obj
+ done
for obj in $save_oldobjs
do
oldobjs="$objlist $obj"
@@ -4868,6 +4897,9 @@
else
# the above command should be used before it gets too long
oldobjs=$objlist
+ if test "$obj" = "$last_oldobj" ; then
+ RANLIB=$save_RANLIB
+ fi
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
objlist=
darwin.diff.gz
Description: GNU Zip compressed data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- darwin patch (next attempt),
Peter O'Gorman <=