diff --git a/ChangeLog b/ChangeLog index 4ccf89fa..f39b2f0a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,54 @@ +1999-03-18 Thomas Tanner + + * merged my inter-library dependencies code from the ILD branch: + * NEWS: inter-library dependencies are now supported + * configure.in: add the depdemo subdirectory + * depdemo/*: new demo to demonstrate inter-library dependencies + * tests/depdemo*: new tests for depdemo + * ltconfig.in: added hardcode_into_libs (whether library paths + should be hardcoded into the libraries), + it currently defaults to 'no' + * ltmain.in: new internal 'relink' mode to relink libraries + on platforms with hardcode_into_libs=yes, save command line + arguments in libtool_args, accept relative -L directories, + ignore -lm on BeOS and Cygwin, always ignore -lc, + handle -l, -L and .la arguments later, always make the library + installation directory (-rpath) absolute, in relink mode don't + delete the not-relinked library and exit immediately after relinking, + try to find already-installed libtool libraries that were specified + using -l, support hardcoding of library paths into libraries too, + export shlibpath before linking libraries, and a lot of other + big changes that I don't want to describe here... please read + the source. + + * merged Gary's Win32 code from the ILD branch: + * NEWS: Win32 DLLs are now supported + * TODO: removed .a library namespace clash for win32. It is + now resolved. + * ltconfig.in (cygwin, library_names_spec): removed $libname.a. + Creating a dll with libtool no longer creates an import library. + * ltconfig.in (extract_expsyms_cmds): Create $objdir if it does + not exist -- i.e. we need to generate import an import library + in a directory which has no libs of its own. + * doc/libtool.texi (old_archive_from_expsyms_cmds, + extract_expsyms_cmds): documented these new variables. + * ltconfig.in (extract_expsyms_cmds): New variable. Commands to + extract the exported symbol list from a dll. + (old_archive_from_expsyms_cmds): New variable. Commands to build + an old archive from the extracted expsyms list. + * ltmain.in: run the cmds in extract_expsyms_cmds and + old_archive_from_expsyms_cmds as necessary. + * ltconfig.in (cygwin, old_archive_from_new_cmds): no longer + required. + * ltconfig.in (cygwin, shlibpath_overrides_runpath): I'm not even + sure whether win32 honours the runpath at all when searching for + a dll to load! Anyway, when set to yes this prevents a gratuitous + warning. + * ltmain.in (deplib): The cygwin environment doesn't actually have + -lm, and although the linker fakes having one, specifiying it to + libtool will break ILD, so we ignore it when generating + dependencies. + 1999-03-17 Gary V. Vaughan * doc/PLATFORMS: Thanks to Alexandres changes below, both my diff --git a/NEWS b/NEWS index 65ee35c7..51c0e8d4 100644 --- a/NEWS +++ b/NEWS @@ -1,11 +1,16 @@ NEWS - list of user-visible changes between releases of GNU Libtool New in 1.3a: CVS version, Libtool team: -* Nothing so far - +* Complete inter-library dependencies support. It's now possible + to link libtool libraries against other libtool libraries. +* Already-installed libtool libraries will be found. +* Support for linking DLLs on Win32 +* New demos and tests +* Various bugfixes + New in 1.2g: CVS version, Libtool team: * Nothing so far - + New in 1.2e: CVS version; 1.2f: 1999-03-15, Libtool team: * libtool will correctly link uninstalled libraries into programs and prefer uninstalled libraries to installed ones diff --git a/TODO b/TODO index fe10068d..26e82545 100644 --- a/TODO +++ b/TODO @@ -45,7 +45,7 @@ In the future: used by other systems. * Fix */demo on win32. -This may require resolving some of the items below. +This may simply require resolving the item below. * Figure out how to use data items in dlls with win32. The difficult part is compiling each object which will be linked with an @@ -53,12 +53,6 @@ import lib differently than if it will be linked with a static lib. This will almost definitely require that automake pass some hints about linkage in to each object compilation line. -* Resolve the name clash between import libs and static libs on win32. -Probably the best way to do this is to create lib$name-dll.a for the import -library, and continue to use lib$name.a for the static lib. libtool ---mode=link can then favour -dll.a over .a if there is a choice. No point in -doing this until we can export data items (above). - * If not cross-compiling, have the static flag test run the resulting binary to make sure everything works. diff --git a/configure.in b/configure.in index 9445cef9..26f1b95a 100644 --- a/configure.in +++ b/configure.in @@ -56,7 +56,7 @@ AC_CONFIG_SUBDIRS(libltdl) dnl all subdirectories that are configured on demand, but that must be dnl included in the distribution -CONF_SUBDIRS="cdemo demo mdemo" +CONF_SUBDIRS="cdemo demo depdemo mdemo" AC_SUBST(CONF_SUBDIRS) ACINCLUDE_M4_LIST="${srcdir}/acinclude.m4 ${srcdir}/libltdl/acinclude.m4 " diff --git a/doc/libtool.texi b/doc/libtool.texi index c205fa83..38f09d82 100644 --- a/doc/libtool.texi +++ b/doc/libtool.texi @@ -3606,6 +3606,17 @@ static library. If this variable is not empty, @samp{old_archive_cmds} is not used. @end defvar +@defvar old_archive_from_expsyms_cmds +If a static library must be created from the export symbol list in order to +correctly link with a shared library, @samp{old_archive_from_expsyms_cmds} +contains the commands needed to create that static library. When these +commands are executed, the variable @var{soname} contains the name of the +shared library in question, and the @var{$objdir/$newlib} contains the +path of the static library these commands should build. After executing +these commands, libtool will proceed to link against @var{$objdir/$newlib} +instead of @var{soname}. +@end defvar + @defvar build_libtool_libs Whether libtool should build shared libraries on this system. Set to @samp{yes} or @samp{no}. @@ -3662,6 +3673,13 @@ Commands to extract exported symbols from @var{libobjs} to the file @var{export_symbols}. @end defvar +@defvar extract_expsyms_cmds +Commands to extract the exported symbols list from a shared library. +These commands are executed if there is no file @var{$objdir/$soname-def}, +and should write the names of the exported symbols to that file, for +the use of @samp{old_archive_from_expsyms_cmds}. +@end defvar + @defvar fast_install Determines whether libtool will privilege the installer or the developer. The assumption is that installers will seldom run programs diff --git a/ltconfig.in b/ltconfig.in index 1a91d7a3..d69dc10d 100755 --- a/ltconfig.in +++ b/ltconfig.in @@ -997,9 +997,11 @@ need_version=unknown archive_cmds= archive_expsym_cmds= old_archive_from_new_cmds= +old_archive_from_expsyms_cmds= export_dynamic_flag_spec= whole_archive_flag_spec= thread_safe_flag_spec= +hardcode_into_libs=no hardcode_libdir_flag_spec= hardcode_libdir_separator= hardcode_direct=no @@ -1016,6 +1018,7 @@ include_expsyms= # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', # as well as any symbol that contains `d'. exclude_expsyms= +extract_expsyms_cmds= case "$host_os" in cygwin* | mingw*) @@ -1083,6 +1086,13 @@ EOF allow_undefined_flag=unsupported always_export_symbols=yes + extract_expsyms_cmds='test -f $objdir/impgen.c || \ + sed -e "/^# \/\* impgen\.c starts here \*\//,/^# \/\* impgen.c ends here \*\// { s/^# //; p; }" -e d < $0 > $objdir/impgen.c~ + test -f $objdir/impgen.exe || (cd $objdir && $CC -o impgen impgen.c)~ + $objdir/impgen $dir/$soname > $objdir/$soname-def' + + old_archive_from_expsyms_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$newlib' + # Extract the symbol export list from an `--export-all' def file, # then regenerate the def file from the symbol export list, so that # the compiled dll only exports the symbol export list. @@ -1103,8 +1113,6 @@ EOF $CC -Wl,--base-file,$objdir/$soname-base $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts~ $DLLTOOL --as=$AS --dllname $soname --exclude-symbols DllMain@12,_cygwin_dll_entry@12,_cygwin_noncygwin_dll_entry@12 --def $objdir/$soname-def --base-file $objdir/$soname-base --output-exp $objdir/$soname-exp~ $CC $objdir/$soname-exp -Wl,--dll -nostartfiles -Wl,-e,__cygwin_dll_entry@12 -o $lib $objdir/$soname-ltdll.$objext $libobjs $deplibs $linkopts' - - old_archive_from_new_cmds='$DLLTOOL --as=$AS --dllname $soname --def $objdir/$soname-def --output-lib $objdir/$libname.a' ;; *) @@ -1651,7 +1659,7 @@ bsdi4*) cygwin* | mingw*) version_type=windows if test "$with_gcc" = yes; then - library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.a' + library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll' else library_names_spec='${libname}`echo ${release} | sed -e 's/[.]/-/g'`${versuffix}.dll $libname.lib' fi @@ -2425,7 +2433,8 @@ case "$ltmain" in thread_safe_flag_spec whole_archive_flag_spec libname_spec \ library_names_spec soname_spec \ RANLIB old_archive_cmds old_archive_from_new_cmds old_postinstall_cmds \ - old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds postuninstall_cmds \ + old_postuninstall_cmds archive_cmds archive_expsym_cmds postinstall_cmds \ + postuninstall_cmds extract_expsyms_cmds old_archive_from_expsyms_cmds \ file_magic_cmd export_symbols_cmds deplibs_check_method allow_undefined_flag no_undefined_flag \ finish_cmds finish_eval global_symbol_pipe global_symbol_to_cdecl \ hardcode_libdir_flag_spec hardcode_libdir_separator \ @@ -2436,6 +2445,7 @@ case "$ltmain" in reload_cmds | old_archive_cmds | old_archive_from_new_cmds | \ old_postinstall_cmds | old_postuninstall_cmds | \ export_symbols_cmds | archive_cmds | archive_expsym_cmds | \ + extract_expsyms_cmds | old_archive_from_expsyms_cmds | \ postinstall_cmds | postuninstall_cmds | \ finish_cmds | sys_lib_search_path_spec | sys_lib_dlsearch_path_spec) # Double-quote double-evaled strings. @@ -2650,6 +2660,9 @@ old_postuninstall_cmds=$old_postuninstall_cmds # Create an old-style archive from a shared archive. old_archive_from_new_cmds=$old_archive_from_new_cmds +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$old_archive_from_expsyms_cmds + # Commands used to build and install a shared archive. archive_cmds=$archive_cmds archive_expsym_cmds=$archive_expsym_cmds @@ -2692,6 +2705,9 @@ shlibpath_overrides_runpath=$shlibpath_overrides_runpath # How to hardcode a shared library path into an executable. hardcode_action=$hardcode_action +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + # Flag to hardcode \$libdir into a binary during linking. # This must work even if \$libdir does not exist. hardcode_libdir_flag_spec=$hardcode_libdir_flag_spec @@ -2726,6 +2742,9 @@ always_export_symbols=$always_export_symbols # The commands to list exported symbols. export_symbols_cmds=$export_symbols_cmds +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$extract_expsyms_cmds + # Symbols that should not be listed in the preloaded symbols. exclude_expsyms=$exclude_expsyms diff --git a/ltmain.in b/ltmain.in index 9411a908..c009b9ed 100644 --- a/ltmain.in +++ b/ltmain.in @@ -603,8 +603,11 @@ compiler." ;; # libtool link mode - link) + link | relink) modename="$modename: link" + relink=no + test "$mode" = "relink" && relink=yes + libtool_args="$nonopt" C_compiler="$CC" # save it, to compile generated C sources CC="$nonopt" case "$host" in @@ -791,17 +794,8 @@ compiler." old_convenience= deplibs= linkopts= + lib_search_path=`pwd` - if test -n "$shlibpath_var"; then - # get the directories listed in $shlibpath_var - eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` - else - lib_search_path= - fi - # now prepend the system-specific ones - eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\" - eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" - avoid_version=no dlfiles= dlprefiles= @@ -811,7 +805,6 @@ compiler." export_symbols_regex= generated= libobjs= - link_against_libtool_libs= ltlibs= module=no objs= @@ -848,6 +841,7 @@ compiler." while test $# -gt 0; do arg="$1" shift + libtool_args="$libtool_args $arg" # If the previous option needs an argument, assign it. if test -n "$prev"; then @@ -980,37 +974,42 @@ compiler." -L*) dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'` + # We need an absolute path. case "$dir" in - /* | [A-Za-z]:[/\\]*) - # Add the corresponding hardcode_libdir_flag, if it is not identical. - ;; + /* | [A-Za-z]:[/\\]*) ;; *) - $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2 - exit 1 + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + dir="$absdir" ;; esac - case " $deplibs " in - *" $arg "*) ;; - *) deplibs="$deplibs $arg";; - esac - case " $lib_search_path " in - *" $dir "*) ;; - *) lib_search_path="$lib_search_path $dir";; - esac - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - dllsearchdir=`cd "$dir" && pwd || echo "$dir"` - case ":$dllsearchpath:" in - ::) dllsearchpath="$dllsearchdir";; - *":$dllsearchdir:"*) ;; - *) dllsearchpath="$dllsearchpath:$dllsearchdir";; - esac + case "$deplibs " in + *" -L$dir "*) ;; + *) + deplibs="$deplibs -L$dir" + lib_search_path="$lib_search_path $dir" ;; esac + continue ;; -l*) + if test "$arg" = "-lm"; then + case "$host" in + *-*-cygwin* | *-*-beos*) + # Ignore -lm on Cygwin and BeOS + continue + ;; + esac + elif test "$arg" = "-lc"; then + # Always ignore -lc + continue + fi deplibs="$deplibs $arg" + continue ;; -module) @@ -1146,9 +1145,6 @@ compiler." exit 1 fi - # Find the relevant object directory and library name. - name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` - if test "X$installed" = Xyes; then dir="$libdir" else @@ -1160,36 +1156,6 @@ compiler." fi fi - if test -n "$dependency_libs"; then - # Extract -R from dependency_libs - temp_deplibs= - for deplib in $dependency_libs; do - case "$deplib" in - -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'` - case " $rpath $xrpath " in - *" $temp_xrpath "*) ;; - *) xrpath="$xrpath $temp_xrpath";; - esac;; - -L*) case "$compile_command $temp_deplibs " in - *" $deplib "*) ;; - *) temp_deplibs="$temp_deplibs $deplib";; - esac;; - *) temp_deplibs="$temp_deplibs $deplib";; - esac - done - dependency_libs="$temp_deplibs" - fi - - if test -z "$libdir"; then - # It is a libtool convenience library, so add in its objects. - convenience="$convenience $dir/$old_library" - old_convenience="$old_convenience $dir/$old_library" - deplibs="$deplibs$dependency_libs" - compile_command="$compile_command $dir/$old_library$dependency_libs" - finalize_command="$finalize_command $dir/$old_library$dependency_libs" - continue - fi - # This library was specified with -dlopen. if test "$prev" = dlfiles; then dlfiles="$dlfiles $arg" @@ -1198,10 +1164,7 @@ compiler." # we need to preload. prev=dlprefiles else - # We should not create a dependency on this library, but we - # may need any libraries it requires. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" + # We should not create a dependency on this library prev= continue fi @@ -1219,178 +1182,7 @@ compiler." prev= fi - if test "$build_libtool_libs" = yes && test -n "$library_names"; then - link_against_libtool_libs="$link_against_libtool_libs $arg" - if test -n "$shlibpath_var"; then - # Make sure the rpath contains only unique directories. - case "$temp_rpath " in - *" $dir "*) ;; - *) temp_rpath="$temp_rpath $dir" ;; - esac - fi - - # We need an absolute path. - case "$dir" in - /* | [A-Za-z]:[/\\]*) absdir="$dir" ;; - *) - absdir=`cd "$dir" && pwd` - if test -z "$absdir"; then - $echo "$modename: cannot determine absolute directory name of \`$libdir'" 1>&2 - exit 1 - fi - ;; - esac - - # This is the magic to use -rpath. - # Skip directories that are in the system default run-time - # search path, unless they have been requested with -R. - case " $sys_lib_dlsearch_path " in - *" $absdir "*) ;; - *) - case "$compile_rpath " in - *" $absdir "*) ;; - *) compile_rpath="$compile_rpath $absdir" - esac - ;; - esac - - case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; - *) - case "$finalize_rpath " in - *" $libdir "*) ;; - *) finalize_rpath="$finalize_rpath $libdir" - esac - ;; - esac - - lib_linked=yes - case "$hardcode_action" in - immediate | unsupported) - if test "$hardcode_direct" = no; then - compile_command="$compile_command $dir/$linklib" - deplibs="$deplibs $dir/$linklib" - case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) - dllsearchdir=`cd "$dir" && pwd || echo "$dir"` - if test -n "$dllsearchpath"; then - dllsearchpath="$dllsearchpath:$dllsearchdir" - else - dllsearchpath="$dllsearchdir" - fi - ;; - esac - elif test "$hardcode_minus_L" = no; then - case "$host" in - *-*-sunos*) - compile_shlibpath="$compile_shlibpath$dir:" - ;; - esac - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -L$dir -l$name" - elif test "$hardcode_shlibpath_var" = no; then - case ":$compile_shlibpath:" in - *":$dir:"*) ;; - *) compile_shlibpath="$compile_shlibpath$dir:";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -l$name" - else - lib_linked=no - fi - ;; - - relink) - if test "$hardcode_direct" = yes; then - compile_command="$compile_command $absdir/$linklib" - deplibs="$deplibs $absdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - case "$compile_command " in - *" -L$absdir "*) ;; - *) compile_command="$compile_command -L$absdir";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -L$absdir -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case ":$compile_shlibpath:" in - *":$absdir:"*) ;; - *) compile_shlibpath="$compile_shlibpath$absdir:";; - esac - compile_command="$compile_command -l$name" - deplibs="$deplibs -l$name" - else - lib_linked=no - fi - ;; - - *) - lib_linked=no - ;; - esac - - if test "$lib_linked" != yes; then - $echo "$modename: configuration error: unsupported hardcode properties" - exit 1 - fi - - # Finalize command for both is simple: just hardcode it. - if test "$hardcode_direct" = yes; then - finalize_command="$finalize_command $libdir/$linklib" - elif test "$hardcode_minus_L" = yes; then - case "$finalize_command " in - *" -L$libdir "*) ;; - *) finalize_command="$finalize_command -L$libdir";; - esac - finalize_command="$finalize_command -l$name" - elif test "$hardcode_shlibpath_var" = yes; then - case ":$finalize_shlibpath:" in - *":$libdir:"*) ;; - *) finalize_shlibpath="$finalize_shlibpath$libdir:";; - esac - finalize_command="$finalize_command -l$name" - else - # We cannot seem to hardcode it, guess we'll fake it. - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$libdir";; - esac - finalize_command="$finalize_command -l$name" - fi - else - # Transform directly to old archives if we don't build new libraries. - if test -n "$pic_flag" && test -z "$old_library"; then - $echo "$modename: cannot find static library for \`$arg'" 1>&2 - exit 1 - fi - - # Here we assume that one of hardcode_direct or hardcode_minus_L - # is not unsupported. This is valid on all known static and - # shared platforms. - if test "$hardcode_direct" != unsupported; then - test -n "$old_library" && linklib="$old_library" - compile_command="$compile_command $dir/$linklib" - finalize_command="$finalize_command $dir/$linklib" - else - case "$compile_command " in - *" -L$dir "*) ;; - *) compile_command="$compile_command -L$dir";; - esac - compile_command="$compile_command -l$name" - case "$finalize_command " in - *" -L$dir "*) ;; - *) finalize_command="$finalize_command -L$dir";; - esac - finalize_command="$finalize_command -l$name" - fi - fi - - # Add in any libraries that this one depends upon. - compile_command="$compile_command$dependency_libs" - finalize_command="$finalize_command$dependency_libs" + deplibs="$deplibs $arg" continue ;; @@ -1425,6 +1217,16 @@ compiler." outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` libobjs_save="$libobjs" + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + lib_search_path="$lib_search_path $sys_lib_search_path $shlib_search_path" + case "$output" in "") $echo "$modename: you must specify an output file" 1>&2 @@ -1433,11 +1235,6 @@ compiler." ;; *.a | *.lib) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into archives" 1>&2 - exit 1 - fi - if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi @@ -1511,12 +1308,6 @@ compiler." exit 1 fi - # How the heck are we supposed to write a wrapper for a shared library? - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2 - exit 1 - fi - if test -n "$dlfiles$dlprefiles"; then $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 fi @@ -1525,7 +1316,22 @@ compiler." if test $# -gt 2; then $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 fi - install_libdir="$2" + dir="$2" + if test -n "$dir"; then + # We need an absolute path. + case "$dir" in + /* | [A-Za-z]:[/\\]*) ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + else + dir="$absdir" + fi + ;; + esac + fi + install_libdir="$dir" oldlibs= if test -z "$rpath"; then @@ -1536,7 +1342,6 @@ compiler." build_libtool_libs=convenience build_old_libs=yes fi - dependency_libs="$deplibs" if test -n "$vinfo"; then $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2 @@ -1698,7 +1503,6 @@ compiler." allow_undefined_flag="$no_undefined_flag" fi - dependency_libs="$deplibs" case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! @@ -1710,16 +1514,18 @@ compiler." esac fi - # Create the output directory, or remove our outputs if we need to. - if test -d $output_objdir; then - $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" - $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* - else - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $output_objdir; then - exit $status + if test "$relink" = no; then + # Create the output directory, or remove our outputs if we need to. + if test -d $output_objdir; then + $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*" + $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.* + else + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi fi fi @@ -1731,6 +1537,343 @@ compiler." oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` fi + # Save some variables + dlname_save=$dlname + library_names_save=$library_names + old_library_save=$old_library + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + + # Find libtool libraries and add their dependencies and directories + newdeplibs= # libraries to link (used in archive_cmds) + newdependency_libs= # all dependency libraries + uninst_path= # paths that contain uninstalled libtool libraries + shlibpath= + new_lib_search_path= + for deplib in $deplibs; do + lib= + case "$deplib" in + -L*) + new_lib_search_path="$new_lib_search_path `expr $deplib : '-L\(.*\)'`" + newdeplibs="$newdeplibs $deplib" + newdependency_libs="$newdependency_libs $deplib" + continue + ;; + -l*) + name="`expr $deplib : '-l\(.*\)'`" + libname=`eval \\$echo \"$libname_spec\"` + found=no + for searchdir in $lib_search_path; do + # Search the libtool library + lib="$searchdir/$libname.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + newdeplibs="$newdeplibs $deplib" + newdependency_libs="$newdependency_libs $deplib" + continue + fi + ;; + *) + lib="$deplib" + if test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + ;; + esac + dlname= + libdir= + library_names= + old_library= + + ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` + test "X$ladir" = "X$lib" && ladir="." + # We need an absolute path. + case "$ladir" in + /* | [A-Za-z]:[/\\]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + $echo "$modename: cannot determine absolute directory name of \`$ladir'" 1>&2 + exit 1 + fi + ;; + esac + laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + . $lib + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + dir="$libdir" + absdir="$libdir" + else + dir="$ladir/$objdir" + case "$dir" in + /* | [A-Za-z]:[/\\]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + ;; + esac + # Remove this search path later + uninst_path="$uninst_path $abs_ladir" + fi + name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` + + if test "$build_libtool_libs" = yes && test -n "$library_names"; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$objdir + linklib=$newlib + fi + + if test "$relink" = no; then + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + newdeplibs="$newdeplibs $dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + shlibpath="$shlibpath$dir:" + ;; + esac + newdeplibs="$newdeplibs -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = no; then + shlibpath="$shlibpath$dir:" + newdeplibs="$newdeplibs -l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes; then + newdeplibs="$newdeplibs $dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + newdeplibs="$newdeplibs -L$dir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + shlibpath="$shlibpath$dir:" + newdeplibs="$newdeplibs -l$name" + else + lib_linked=no + fi + ;; + *) + lib_linked=no + ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + else + # Install command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + newdeplibs="$newdeplibs $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + newdeplibs="$newdeplibs -L$libdir -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + shlibpath="$shlibpath$libdir:" + newdeplibs="$newdeplibs -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + newdeplibs="$newdeplibs -L$libdir -l$name" + fi + fi + elif test "$build_libtool_libs" = yes && test "$deplibs_check_method" != pass_all; then + echo + echo "*** Warning: This library needs some functionality provided by $libname." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + continue + else + # Check for old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + $echo "$modename: cannot find static library for \`$lib'" 1>&2 + exit 1 + fi + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + newdeplibs="$newdeplibs $dir/$old_library" + fi + + new_lib_search_path="$new_lib_search_path $absdir" + + if test -n "$dependency_libs"; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case "$libdir" in + -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) xrpath="$xrpath $temp_xrpath";; + esac;; + *) temp_deplibs="$temp_deplibs $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + # Link against this library + newdependency_libs="$newdependency_libs $dependency_libs $abs_ladir/$laname" + done + + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $new_lib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + lib_search_path="$lib_search_path $sys_lib_search_path" + + # Make sure newdependency_libs contains only unique libraries and directories. + dependency_libs= + for deplib in $newdependency_libs; do + case "$dependency_libs " in + *" $deplib "*) ;; + *) dependency_libs="$dependency_libs $deplib" ;; + esac + done + + deplibs=$newdeplibs + # Eliminate all temporary directories. + for path in $uninst_path; do + lib_search_path=`echo "$lib_search_path " | sed -e 's% $path % %g'` + deplibs=`echo "$deplibs " | sed -e 's% -L$path % %g'` + dependency_libs=`echo "$dependency_libs " | sed -e 's% -L$path % %g'` + done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + temp_xrpath="$temp_xrpath -R$libdir" + case "$compile_rpath " in + *" $libdir "*) ;; + *) compile_rpath="$compile_rpath $libdir" ;; + esac + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" ;; + esac + done + dependency_libs="$temp_xrpath $dependency_libs" + fi + + # Restore the variables + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + old_library=$old_library_save + library_names=$library_names_save + dlname=$dlname_save + if test "$build_libtool_libs" = yes; then # Transform deplibs into only deplibs that can be linked in shared. name_save=$name @@ -1940,6 +2083,59 @@ EOF deplibs=$newdeplibs # Done checking deplibs! + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$relink" = no && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + dep_rpath="$dep_rpath $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) perm_rpath="$perm_rpath $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + rpath="$rpath$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names @@ -2027,6 +2223,11 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi + # Make a backup of the uninstalled library when relinking + if test "$relink" = yes && test "$hardcode_into_libs" = yes ; then + $run eval '(cd $output_objdir && $rm "$realname"U && $mv $realname "$realname"U)' || exit $? + fi + # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" @@ -2041,6 +2242,12 @@ EOF done IFS="$save_ifs" + # Restore the uninstalled library and exit + if test "$relink" = yes && test "$hardcode_into_libs" = yes; then + $run eval '(cd $output_objdir && $rm "$realname"T && $mv $realname "$realname"T && $mv "$realname"U $realname)' || exit $? + exit 0 + fi + # Create links to the real library. for linkname in $linknames; do if test "$realname" != "$linkname"; then @@ -2058,11 +2265,6 @@ EOF ;; *.lo | *.o | *.obj) - if test -n "$link_against_libtool_libs"; then - $echo "$modename: error: cannot link libtool libraries into objects" 1>&2 - exit 1 - fi - if test -n "$deplibs"; then $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi @@ -2173,7 +2375,426 @@ EOF $echo "$modename: error: \`-dlopen self' requires \`-export-dynamic'" 1>&2 exit 1 fi + + # Find libtool libraries and add their dependencies/rpaths + newdeplibs= + newdependency_libs= + new_lib_search_path= + for deplib in $deplibs; do + lib= + case "$deplib" in + -L*) + new_lib_search_path="$new_lib_search_path `expr $deplib : '-L\(.*\)'`" + newdeplibs="$newdeplibs $deplib" + continue + ;; + -l*) + name="`expr $deplib : '-l\(.*\)'`" + libname=`eval \\$echo \"$libname_spec\"` + found=no + for searchdir in $lib_search_path; do + # Search the libtool library + lib="$searchdir/$libname.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + newdeplibs="$newdeplibs $deplib" + continue + fi + ;; + *) + lib="$deplib" + if test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + ;; + esac + dlname= + libdir= + library_names= + old_library= + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + . $lib + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + new_lib_search_path="$new_lib_search_path `$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`" + newdeplibs="$newdeplibs $lib" + + for deplib in $dependency_libs; do + case "$deplib" in + -L*) new_lib_search_path="$new_lib_search_path `expr $deplib : '-L\(.*\)'`" ;; + *) ;; + esac + # Make sure dependency_libs contains only unique + # libraries and directories. + case "$newdependency_libs " in + *" $deplib "*) ;; + *) newdependency_libs="$newdependency_libs $deplib" ;; + esac + done + done + dependency_libs="$newdependency_libs" + + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $new_lib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) lib_search_path="$lib_search_path $dir" ;; + esac + done + lib_search_path="$lib_search_path $sys_lib_search_path" + + # Find libtool libraries and add their directories + alldeplibs=no + linkalldeplibs=no + if test "$fast_install" = yes || test "$build_libtool_libs" = no || \ + test "$deplibs_check_method" = none; then + linkalldeplibs=yes + fi + link_against_libtool_libs= + + for deplib in $deplibs @DEPLIBS@ $dependency_libs; do + lib= + case "$deplib" in + -L*) + compile_command="$compile_command $deplib" + case "$compile_command " in + *" $deplib "*) ;; + *) compile_command="$compile_command $deplib";; + esac + case "$finalize_command " in + *" $deplib "*) ;; + *) finalize_command="$finalize_command $deplib";; + esac + continue + ;; + -R*) + dir=`expr $deplib : '-R\(.*\)'` + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac + continue + ;; + @DEPLIBS@) + if test "$hardcode_into_libs" = yes; then + break + fi + alldeplibs=yes + continue + ;; + -l*) + name="`expr $deplib : '-l\(.*\)'`" + libname=`eval \\$echo \"$libname_spec\"` + found=no + for searchdir in $lib_search_path; do + # Search the libtool library + lib="$searchdir/$libname.la" + if test -f "$lib"; then + found=yes + break + fi + done + if test "$found" != yes; then + compile_command="$compile_command $deplib" + finalize_command="$finalize_command $deplib" + continue + fi + ;; + *) + lib="$deplib" + if test -f "$lib"; then : + else + $echo "$modename: cannot find the library \`$lib'" 1>&2 + exit 1 + fi + ;; + esac + dlname= + libdir= + library_names= + old_library= + + # Check to see that this really is a libtool archive. + if (sed -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : + else + $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 + exit 1 + fi + + # If the library was installed with an old release of libtool, + # it will not redefine variable installed. + installed=yes + + # Read the .la file + . $lib + + # Get the name of the library we link against. + linklib= + for l in $old_library $library_names; do + linklib="$l" + done + + if test -z "$linklib"; then + $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 + exit 1 + fi + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + dir="$libdir" + absdir="$libdir" + else + dir="`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`/" + test "$dir" = "$deplib/" && dir= + dir="$dir$objdir" + case "$dir" in + /* | [A-Za-z]:[/\\]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 + exit 1 + fi + ;; + esac + fi + + if test "$build_libtool_libs" = yes && test -n "$library_names"; then + if test -n "$shlibpath_var"; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath " in + *" $dir "*) ;; + *" $absdir "*) ;; + *) temp_rpath="$temp_rpath $dir" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) compile_rpath="$compile_rpath $absdir" + esac + ;; + esac + + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) finalize_rpath="$finalize_rpath $libdir" + esac + ;; + esac + fi + + if test "$alldeplibs" = yes && test "$linkalldeplibs" = no; then + continue + fi + + name=`$echo "X$lib" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'` + + if test -z "$libdir"; then + # It is a libtool convenience library, so add in its objects. + convenience="$convenience $dir/$old_library" + old_convenience="$old_convenience $dir/$old_library" + compile_command="$compile_command $dir/$old_library" + finalize_command="$finalize_command $dir/$old_library" + continue + fi + + if test "$build_libtool_libs" = yes && test -n "$library_names"; then + link_against_libtool_libs="$link_against_libtool_libs $lib" + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + realname="$2" + shift; shift + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + newlib="libimp-`echo $soname | sed 's/^lib//;s/\.dll$//'`.a" + + # If the library has no export list, then create one now + if test -f "$objdir/$soname-def"; then : + else + $show "extracting exported symbol list from \`$soname'" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + eval cmds=\"$extract_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + + # Create $newlib + if test -f "$objdir/$newlib"; then :; else + $show "generating import library for \`$soname'" + IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' + eval cmds=\"$old_archive_from_expsyms_cmds\" + for cmd in $cmds; do + IFS="$save_ifs" + $show "$cmd" + $run eval "$cmd" || exit $? + done + IFS="$save_ifs" + fi + # make sure the library variables are pointing to the new library + dir=$objdir + linklib=$newlib + fi + + lib_linked=yes + case "$hardcode_action" in + immediate | unsupported) + if test "$hardcode_direct" = no; then + compile_command="$compile_command $dir/$linklib" + elif test "$hardcode_minus_L" = no; then + case "$host" in + *-*-sunos*) + compile_shlibpath="$compile_shlibpath$dir:" + ;; + esac + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + elif test "$hardcode_shlibpath_var" = no; then + case ":$compile_shlibpath:" in + *":$dir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$dir:";; + esac + compile_command="$compile_command -l$name" + else + lib_linked=no + fi + ;; + + relink) + if test "$hardcode_direct" = yes; then + compile_command="$compile_command $absdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$compile_command " in + *" -L$absdir "*) ;; + *) compile_command="$compile_command -L$absdir";; + esac + compile_command="$compile_command -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$compile_shlibpath:" in + *":$absdir:"*) ;; + *) compile_shlibpath="$compile_shlibpath$absdir:";; + esac + compile_command="$compile_command -l$name" + else + lib_linked=no + fi + ;; + + *) + lib_linked=no + ;; + esac + + if test "$lib_linked" != yes; then + $echo "$modename: configuration error: unsupported hardcode properties" + exit 1 + fi + + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes; then + finalize_command="$finalize_command $libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + case "$finalize_command " in + *" -L$libdir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case ":$finalize_shlibpath:" in + *":$libdir:"*) ;; + *) finalize_shlibpath="$finalize_shlibpath$libdir:";; + esac + finalize_command="$finalize_command -l$name" + else + # We cannot seem to hardcode it, guess we'll fake it. + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$libdir";; + esac + finalize_command="$finalize_command -l$name" + fi + else + # Transform directly to old archives if we don't build new libraries. + if test -n "$pic_flag" && test -z "$old_library"; then + $echo "$modename: cannot find static library for \`$lib'" 1>&2 + exit 1 + fi + + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_command="$compile_command $dir/$linklib" + finalize_command="$finalize_command $dir/$linklib" + else + case "$compile_command " in + *" -L$dir "*) ;; + *) compile_command="$compile_command -L$dir";; + esac + compile_command="$compile_command -l$name" + case "$finalize_command " in + *" -L$dir "*) ;; + *) finalize_command="$finalize_command -L$dir";; + esac + finalize_command="$finalize_command -l$name" + fi + fi + done + if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do @@ -2721,14 +3342,6 @@ else " fi - # fixup the dll searchpath if we need to. - if test -n "$dllsearchpath"; then - $echo >> $output "\ - # Add the dll search path components to the executable PATH - PATH=$dllsearchpath:\$PATH -" - fi - $echo >> $output "\ if test \"\$libtool_execute_magic\" != \"$magic\"; then # Run the actual program with our arguments. @@ -2835,14 +3448,10 @@ fi\ test "$build_old_libs" = yes && old_library="$libname.$libext" $show "creating $output" - if test -n "$xrpath"; then - temp_xrpath= - for libdir in $xrpath; do - temp_xrpath="$temp_xrpath -R$libdir" - done - dependency_libs="$temp_xrpath $dependency_libs" - fi - + # Quote the link command for shipping. + relink_command="cd `pwd`; $SHELL $0 --mode=relink $libtool_args" + relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"` + # Only create the output if not a dry run. if test -z "$run"; then $echo > $output "\ @@ -2870,11 +3479,32 @@ revision=$revision installed=no # Directory that this library needs to be installed in: -libdir='$install_libdir'\ -" +libdir='$install_libdir' +relink_command=\"$relink_command\"" + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case "$deplib" in + -L* | -R* | -l*) + newdependency_libs="$newdependency_libs $deplib" + ;; + *) + name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` + eval libdir=`sed -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + if test -z "$libdir"; then + $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 + exit 1 + fi + newdependency_libs="$newdependency_libs $libdir/$name" + ;; + esac + done + $rm "$output_objdir/$outputname"i - sed 's/^installed=no$/installed=yes/' \ + sed -e 's/^installed=no$/installed=yes/' \ + -e "s%^dependency_libs=\(.*\)%dependency_libs='$newdependency_libs'%" \ + -e 's/^relink_command=\(.*\)//' \ < "$output" > "$output_objdir/$outputname"i || exit 1 fi @@ -3052,8 +3682,43 @@ libdir='$install_libdir'\ exit 1 fi + relink_command= + dependency_libs= + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + + # Check the variables that should have been set. + if test -z "$dependency_libs" || test -z "$relink_command"; then + $echo "$modename: invalid libtool pseudo library \`$file'" 1>&2 + exit 1 + fi + + finalize=yes + deplibs=$dependency_libs + for lib in $deplibs; do + case "$lib" in + *.la) + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + . $lib + fi + libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`" + if test -n "$libdir" && test ! -f "$libfile"; then + $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 + finalize=no + fi + ;; + esac + done + + relink_command= library_names= old_library= + dependency_libs= # If there is no directory component, then add one. case "$file" in */* | *\\*) . $file ;; @@ -3078,6 +3743,21 @@ libdir='$install_libdir'\ test "X$dir" = "X$file/" && dir= dir="$dir$objdir" + if test "$hardcode_into_libs" = yes; then + if test "$finalize" = yes; then + $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2 + $show "$relink_command" + if $run eval "$relink_command"; then : + else + $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 + continue + fi + else + $echo "$modename: error: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 + continue + fi + fi + # See the names of the shared library. set dummy $library_names if test -n "$2"; then @@ -3085,9 +3765,12 @@ libdir='$install_libdir'\ shift shift + srcname="$realname" + test "$hardcode_into_libs" = yes && srcname="$realname"T + # Install the shared library and build the symlinks. - $show "$install_prog $dir/$realname $destdir/$realname" - $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? + $show "$install_prog $dir/$srcname $destdir/$realname" + $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? test "X$dlname" = "X$realname" && dlname= if test $# -gt 0; then @@ -3123,12 +3806,6 @@ libdir='$install_libdir'\ # Install the pseudo-library for information purposes. name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` instname="$dir/$name"i - if test ! -f "$instname"; then - # Just in case it was removed... - $show "Creating $instname" - $rm "$instname" - sed 's/^installed=no$/installed=yes/' "$file" > "$instname" - fi $show "$install_prog $instname $destdir/$name" $run eval "$install_prog $instname $destdir/$name" || exit $? @@ -3224,6 +3901,13 @@ libdir='$install_libdir'\ fi done + relink_command= + # If there is no directory component, then add one. + case "$file" in + */* | *\\*) . $file ;; + *) . ./$file ;; + esac + outputname= if test "$fast_install" = no && test -n "$relink_command"; then if test "$finalize" = yes; then diff --git a/tests/Makefile.am b/tests/Makefile.am index 25be7a3e..2da711b4 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -5,24 +5,32 @@ AUTOMAKE_OPTIONS = gnits TESTS = cdemo-static.test cdemo-make.test cdemo-exec.test \ demo-static.test demo-make.test demo-exec.test \ demo-inst.test demo-unst.test \ + depdemo-static.test depdemo-make.test depdemo-exec.test \ + depdemo-inst.test depdemo-unst.test \ mdemo-static.test mdemo-make.test mdemo-exec.test \ mdemo-inst.test mdemo-unst.test \ cdemo-conf.test cdemo-make.test cdemo-exec.test \ demo-conf.test demo-make.test demo-exec.test \ demo-inst.test demo-unst.test \ + depdemo-conf.test depdemo-make.test depdemo-exec.test \ + depdemo-inst.test depdemo-unst.test \ mdemo-conf.test mdemo-make.test mdemo-exec.test \ mdemo-inst.test mdemo-unst.test \ demo-nofast.test demo-make.test demo-exec.test \ demo-inst.test demo-unst.test \ + depdemo-nofast.test depdemo-make.test depdemo-exec.test \ + depdemo-inst.test depdemo-unst.test \ cdemo-shared.test cdemo-make.test cdemo-exec.test \ demo-shared.test demo-make.test demo-exec.test demo-inst.test \ hardcode.test build-relink.test demo-unst.test \ + depdemo-shared.test depdemo-make.test depdemo-exec.test \ + depdemo-inst.test depdemo-unst.test \ mdemo-shared.test mdemo-make.test mdemo-exec.test \ mdemo-inst.test mdemo-unst.test \ assign.test link.test link-2.test nomode.test \ quote.test sh.test suffix.test -cdemo-static.test: $(top_builddir)/libtool +demo-conf.test: $(top_builddir)/libtool $(top_builddir)/libtool: cd $(top_builddir) && $(MAKE) all @@ -37,5 +45,6 @@ EXTRA_DIST = defs $(TESTS) clean-local: -test -f ../cdemo/Makefile && cd ../cdemo && $(MAKE) distclean -test -f ../demo/Makefile && cd ../demo && $(MAKE) distclean + -test -f ../depdemo/Makefile && cd ../depdemo && $(MAKE) distclean -test -f ../mdemo/Makefile && cd ../mdemo && $(MAKE) distclean rm -rf _inst diff --git a/tests/depdemo-conf.test b/tests/depdemo-conf.test new file mode 100755 index 00000000..7a3e5bf0 --- /dev/null +++ b/tests/depdemo-conf.test @@ -0,0 +1,30 @@ +#! /bin/sh +# depdemo-conf.test - try configuring the ./depdemo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +test -d ../depdemo || mkdir ../depdemo + +# Change to our build directory. +cd ../depdemo || exit 1 + +# Possibly clean up the distribution. +if test -f Makefile; then + echo "= Running $make distclean in ../depdemo" + $make distclean +fi +rm -f config.cache + +# Configure the demonstration. +echo "= Configuring in ../depdemo (prefix=$prefix)" +CONFIG_SITE=/dev/null ${CONFIG_SHELL-/bin/sh} $srcdir/../depdemo/configure --srcdir=$srcdir/../depdemo --prefix=$prefix || exit 1 + +exit 0 diff --git a/tests/depdemo-exec.test b/tests/depdemo-exec.test new file mode 100755 index 00000000..5e6868f2 --- /dev/null +++ b/tests/depdemo-exec.test @@ -0,0 +1,35 @@ +#! /bin/sh +# depdemo-exec.test - check that programs in the ../depdemo subdirectory are viable + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +if test -f ../depdemo/depdemo; then : +else + echo "You must run depdemo-make.test before running $0" 1>&2 + exit 1 +fi + +# Check to see if the programs really run. +echo "Executing uninstalled programs in ../depdemo" + +status=0 +if ../depdemo/depdemo.static; then : +else + echo "$0: cannot execute ../depdemo/depdemo.static" 1>&2 + status=1 +fi + +if ../depdemo/depdemo; then : +else + echo "$0: cannot execute ../depdemo/depdemo" 1>&2 + status=1 +fi + +exit $status diff --git a/tests/depdemo-inst.test b/tests/depdemo-inst.test new file mode 100755 index 00000000..66c544ff --- /dev/null +++ b/tests/depdemo-inst.test @@ -0,0 +1,47 @@ +#! /bin/sh +# depdemo-inst.test - try installing from the ../depdemo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Check that things are built. +if test -f ../depdemo/depdemo; then : +else + echo "You must run depdemo-make.test before $0" 1>&2 + exit 1 +fi + +# Change to our build directory. +cd ../depdemo || exit 1 + +echo "= Running $make install in ../depdemo" +$make install || exit 1 + +echo "= Executing installed programs" + +status=0 +if $prefix/bin/depdemo.static; then : +else + echo "$0: cannot execute $prefix/bin/depdemo.static" 1>&2 + status=1 +fi + +if $prefix/bin/depdemo; then : +else + echo "$0: cannot execute $prefix/bin/depdemo" 1>&2 + + # Simple check to see if they are superuser. + if test -w /; then : + else + echo "You may need to run $0 as the superuser." + fi + status=1 +fi + +exit $status diff --git a/tests/depdemo-make.test b/tests/depdemo-make.test new file mode 100755 index 00000000..c61e7cb9 --- /dev/null +++ b/tests/depdemo-make.test @@ -0,0 +1,25 @@ +#! /bin/sh +# depdemo-make.test - try building in the ../depdemo subdirectory + +# Test script header. +need_prefix=no +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +if test -f ../depdemo/Makefile; then : +else + echo "You must run depdemo-conf.test before running $0" 1>&2 + exit 1 +fi + +# Change to our build directory. +cd ../depdemo || exit 1 + +# Do the actual build. +echo "Making in ../depdemo" +$make || exit 1 +exit 0 diff --git a/tests/depdemo-nofast.test b/tests/depdemo-nofast.test new file mode 100755 index 00000000..d0ac1a31 --- /dev/null +++ b/tests/depdemo-nofast.test @@ -0,0 +1,30 @@ +#! /bin/sh +# depdemo-conf.test - try configuring the ./depdemo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +test -d ../depdemo || mkdir ../depdemo + +# Change to our build directory. +cd ../depdemo || exit 1 + +# Possibly clean up the distribution. +if test -f Makefile; then + echo "= Running $make distclean in ../depdemo" + $make distclean +fi +rm -f config.cache + +# Configure the demonstration. +echo "= Configuring in ../depdemo (prefix=$prefix)" +CONFIG_SITE=/dev/null ${CONFIG_SHELL-/bin/sh} $srcdir/../depdemo/configure --srcdir=$srcdir/../depdemo --prefix=$prefix --enable-fast-install=no || exit 1 + +exit 0 diff --git a/tests/depdemo-shared.test b/tests/depdemo-shared.test new file mode 100755 index 00000000..ebe9c60e --- /dev/null +++ b/tests/depdemo-shared.test @@ -0,0 +1,30 @@ +#! /bin/sh +# depdemo-conf.test - try configuring the ../depdemo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +test -d ../depdemo || mkdir ../depdemo + +# Change to our build directory. +cd ../depdemo || exit 1 + +# Possibly clean up the distribution. +if test -f Makefile; then + echo "= Running $make distclean in ../depdemo" + $make distclean +fi +rm -f config.cache + +# Configure the demonstration. +echo "= Configuring in ../depdemo (prefix=$prefix) with --disable-static" +CONFIG_SITE=/dev/null ${CONFIG_SHELL-/bin/sh} $srcdir/../depdemo/configure --srcdir=$srcdir/../depdemo --prefix=$prefix --disable-static || exit 1 + +exit 0 diff --git a/tests/depdemo-static.test b/tests/depdemo-static.test new file mode 100755 index 00000000..cce2e875 --- /dev/null +++ b/tests/depdemo-static.test @@ -0,0 +1,30 @@ +#! /bin/sh +# depdemo-conf.test - try configuring the ../depdemo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +test -d ../depdemo || mkdir ../depdemo + +# Change to our build directory. +cd ../depdemo || exit 1 + +# Possibly clean up the distribution. +if test -f Makefile; then + echo "= Running $make distclean in ../depdemo" + $make distclean +fi +rm -f config.cache + +# Configure the demonstration. +echo "= Configuring in ../depdemo (prefix=$prefix) with --disable-shared" +CONFIG_SITE=/dev/null ${CONFIG_SHELL-/bin/sh} $srcdir/../depdemo/configure --srcdir=$srcdir/../depdemo --prefix=$prefix --disable-shared || exit 1 + +exit 0 diff --git a/tests/depdemo-unst.test b/tests/depdemo-unst.test new file mode 100755 index 00000000..52635c80 --- /dev/null +++ b/tests/depdemo-unst.test @@ -0,0 +1,35 @@ +#! /bin/sh +# depdemo.test - try uninstalling in the ../depdemo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=`echo "$0" | sed 's%/[^/]*$%%'` + test "$srcdir" = "$0" && srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +if test "$prefix/bin/hell"; then : +else + echo "You must run depdemo-inst.test before $0." 1>&2 + exit 1 +fi + +# Change to our build directory. +cd ../depdemo || exit 1 + +echo "= Running $make uninstall in ../depdemo" +$make uninstall || exit 1 + +# See that there were no files leftover in $prefix. +# Ignore dotfiles, so that .nfsXXX files don't screw up the test. +leftovers=`find $prefix ! -type d ! -name '.*' -print` +if test -n "$leftovers"; then + echo "= Leftover after make uninstall:" + ls -l $leftovers + exit 1 +fi + +exit 0 diff --git a/tests/depdemo.test b/tests/depdemo.test new file mode 100644 index 00000000..a7103839 --- /dev/null +++ b/tests/depdemo.test @@ -0,0 +1,80 @@ +#! /bin/sh +# depdemo.test - try building in the ../depdemo subdirectory + +# Test script header. +need_prefix=yes +if test -z "$srcdir"; then + srcdir=. + test "${VERBOSE+set}" != "set" && VERBOSE=yes +fi +. $srcdir/defs || exit 1 + +# Maybe we have a VPATH build, in which case, create a new subdir. +test -d ../depdemo || mkdir ../depdemo + +# Change to our build directory. +cd ../depdemo || exit 1 + +# Possibly clean up the distribution. +if test -f config.cache; then + echo "= Running make distclean in ../depdemo" + make distclean || rm -f config.cache +fi + +# Configure the demonstration. +echo "= Configuring in ../depdemo (prefix=$prefix)" +$srcdir/../depdemo/configure --srcdir=$srcdir/../depdemo --prefix=$prefix || exit 1 + +# Do the actual build. +echo "= Running make in ../depdemo" +make || exit 1 + +# Try running the program. +echo "= Executing uninstalled programs" +if ./depdemo.static; then : +else + echo "$0: cannot execute ./depdemo.static" 1>&2 + exit 1 +fi + +if ./depdemo; then : +else + echo "$0: cannot execute ./depdemo" 1>&2 + exit 1 +fi + +echo "= Running make install in ../depdemo" +make install || exit 1 + +echo "= Executing installed programs" +if $prefix/bin/depdemo.static; then : +else + echo "$0: cannot execute $prefix/bin/depdemo.static" 1>&2 + exit 1 +fi + +if $prefix/bin/depdemo; then : +else + echo "$0: cannot execute $prefix/bin/depdemo" 1>&2 + exit 1 +fi + +echo "= Running make uninstall in ../depdemo" +make uninstall || exit 1 + +# See that there were no files leftover in $prefix. +leftovers=`find $prefix ! -type d -print` +if test -n "$leftovers"; then + echo "= Leftover after make uninstall:" + ls -l $leftovers + exit 1 +fi + +# Delete the directory tree we created. +rm -rf $prefix + + +# Clean up the distribution. +make distclean + +exit 0