From: Peter O'Gorman Date: Sun, 23 Feb 2003 23:49:34 +0000 (+0000) Subject: * libtool.m4 (darwin): Revamp darwin platform support. X-Git-Tag: release-1-5~25 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cd9876b41869b8025f1c142421f312b82d33e590;p=thirdparty%2Flibtool.git * libtool.m4 (darwin): Revamp darwin platform support. * ltdl.m4 (darwin): Support dlcompat if found. * ltmain.in: Make sure ranlib is run if needed when piecewise linking. --- diff --git a/ChangeLog b/ChangeLog index dc83a1eb4..b33d685df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2003-02-23 Peter O'Gorman + + * libtool.m4 (darwin): Revamp darwin platform support. + * ltdl.m4 (darwin): Support dlcompat if found. + * ltmain.in: Make sure ranlib is run if needed when piecewise + linking. + 2003-02-23 Alexandre Duret-Lutz * ltmain.in (--help): Show mailing-address for bug reports. diff --git a/libtool.m4 b/libtool.m4 index b9b0fec7f..38ee823f4 100644 --- a/libtool.m4 +++ b/libtool.m4 @@ -1240,7 +1240,8 @@ darwin* | rhapsody*) 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*) @@ -2263,7 +2264,7 @@ AC_DEFUN([AC_CHECK_LIBM], [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*) @@ -2494,6 +2495,33 @@ aix4*) 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$compiler_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$compiler_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]) @@ -2783,17 +2811,22 @@ case $host_os in _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$compiler_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$compiler_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' @@ -5176,17 +5209,22 @@ EOF _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$compiler_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$compiler_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' diff --git a/ltdl.m4 b/ltdl.m4 index 26fb06680..25f982ef6 100644 --- a/ltdl.m4 +++ b/ltdl.m4 @@ -137,6 +137,11 @@ AC_CACHE_CHECK([whether deplibs are loaded by dlopen], 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 @@ AC_CACHE_CHECK([which extension is used for shared libraries], 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".]) diff --git a/ltmain.in b/ltmain.in index 9d7dc2d50..ebf0ec7fd 100644 --- a/ltmain.in +++ b/ltmain.in @@ -2489,6 +2489,7 @@ EOF 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) @@ -2506,7 +2507,7 @@ EOF ;; 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 @@ -2516,12 +2517,33 @@ EOF 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 @@ -3902,8 +3924,10 @@ EOF 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 @@ -4856,6 +4880,11 @@ fi\ $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" @@ -4867,6 +4896,9 @@ fi\ 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=