diff options
author | Ian Lance Taylor <ian@airs.com> | 2000-02-27 16:46:19 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@airs.com> | 2000-02-27 16:46:19 +0000 |
commit | 2031769e327285db7175c5f7bf27ce7103361f6d (patch) | |
tree | da9640ca79310301df8b9a93709cc699f9c2998f /ltmain.sh | |
parent | 2000-02-26 Mark Kettenis <kettenis@gnu.org> (diff) | |
download | binutils-gdb-2031769e327285db7175c5f7bf27ce7103361f6d.tar.gz binutils-gdb-2031769e327285db7175c5f7bf27ce7103361f6d.tar.bz2 binutils-gdb-2031769e327285db7175c5f7bf27ce7103361f6d.zip |
* ltconfig, ltmain.sh: Update to libtool 1.3.4.
Diffstat (limited to 'ltmain.sh')
-rw-r--r-- | ltmain.sh | 748 |
1 files changed, 499 insertions, 249 deletions
diff --git a/ltmain.sh b/ltmain.sh index 878787a3c1e..c32939ee833 100644 --- a/ltmain.sh +++ b/ltmain.sh @@ -1,8 +1,8 @@ # ltmain.sh - Provide generalized library-building support services. # NOTE: Changing this file will not affect anything until you rerun ltconfig. # -# Copyright (C) 1996-1999 Free Software Foundation, Inc. -# Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# Copyright (C) 1996-1999, 2000 Free Software Foundation, Inc. +# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -28,12 +28,8 @@ if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then - # used as fallback echo - shift - cat <<EOF -$* -EOF - exit 0 + # Avoid inline document here, it may be left over + : elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then # Yippee, $echo works! : @@ -42,6 +38,15 @@ else exec $SHELL "$0" --no-reexec ${1+"$@"} fi +if test "X$1" = X--fallback-echo; then + # used as fallback echo + shift + cat <<EOF +$* +EOF + exit 0 +fi + # The name of this program. progname=`$echo "$0" | sed 's%^.*/%%'` modename="$progname" @@ -49,8 +54,8 @@ modename="$progname" # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.2f -TIMESTAMP=" (1.33 1999/04/26 16:28:53)" +VERSION=1.3.4 +TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)" default_mode= help="Try \`$progname --help' for more information." @@ -64,7 +69,7 @@ rm="rm -f" Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' SP2NL='tr \040 \012' -NL2SP='tr \012 \040' +NL2SP='tr \015\012 \040\040' # NLS nuisances. # Only set LANG and LC_ALL to C if already set. @@ -100,6 +105,7 @@ show="$echo" show_help= execute_dlfiles= lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" # Parse our command line options once, thoroughly. while test $# -gt 0 @@ -429,7 +435,13 @@ compiler." fbsd_hideous_sh_bug=$base_compile # All platforms use -DPIC, to notify preprocessed assembler code. - command="$base_compile $pic_flag -DPIC $srcfile" + # However, make sure we only set it for non-Java code. + case "$srcfile" in + *.java|*.class) + command="$base_compile $pic_flag $srcfile";; + *) + command="$base_compile $srcfile $pic_flag -DPIC";; + esac if test "$build_old_libs" = yes; then lo_libobj="$libobj" dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` @@ -460,6 +472,7 @@ compiler." command="$command -o $output_obj" fi + $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else @@ -514,9 +527,17 @@ compiler." exit $error fi + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` + libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` # Now arrange that obj and lo_libobj become the same file - $show "$LN_S $obj $lo_libobj" - if $run $LN_S $obj $lo_libobj; then + $show "(cd $xdir && $LN_S $baseobj $libobj)" + if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then exit 0 else error=$? @@ -539,6 +560,7 @@ compiler." # Suppress compiler output if we already did a PIC compilation. command="$command$suppress_output" + $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else @@ -606,9 +628,18 @@ compiler." link) modename="$modename: link" C_compiler="$CC" # save it, to compile generated C sources - # CYGNUS LOCAL: tromey/java # Always respect the CC configured in by ltconfig. - # CC="$nonopt" + CC="$nonopt" + # CYGNUS LOCAL: tromey/java + # Add -B options to link line. + for arg + do + case "$arg" in + -B*) + CC="$CC $arg" + ;; + esac + done # END CYGNUS LOCAL case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) @@ -633,10 +664,24 @@ compiler." # #undef WIN32_LEAN_AND_MEAN # #include <stdio.h> # +# #ifndef __CYGWIN__ +# # ifdef __CYGWIN32__ +# # define __CYGWIN__ __CYGWIN32__ +# # endif +# #endif +# +# #ifdef __cplusplus +# extern "C" { +# #endif # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved); +# #ifdef __cplusplus +# } +# #endif # +# #ifdef __CYGWIN__ # #include <cygwin/cygwin_dll.h> # DECLARE_CYGWIN_DLL( DllMain ); +# #endif # HINSTANCE __hDllInstance_base; # # BOOL APIENTRY @@ -783,8 +828,8 @@ compiler." allow_undefined=yes ;; esac - compile_command="$CC" - finalize_command="$CC" + compile_command="$nonopt" + finalize_command="$nonopt" compile_rpath= finalize_rpath= @@ -818,6 +863,7 @@ compiler." ltlibs= module=no objs= + prefer_static_libs=no preload=no prev= prevarg= @@ -834,11 +880,21 @@ compiler." do case "$arg" in -all-static | -static) - if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + if test "X$arg" = "X-all-static"; then + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + else + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi fi build_libtool_libs=no build_old_libs=yes + prefer_static_libs=yes break ;; esac @@ -871,18 +927,32 @@ compiler." fi case "$arg" in *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; self) if test "$prev" = dlprefiles; then dlself=yes elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then dlself=yes + else + dlself=needless + export_dynamic=yes fi prev= continue ;; *) - dlprefiles="$dlprefiles $arg" - test "$prev" = dlfiles && dlfiles="$dlfiles $arg" + if test "$prev" = dlfiles; then + dlfiles="$dlfiles $arg" + else + dlprefiles="$dlprefiles $arg" + fi prev= ;; esac @@ -906,13 +976,26 @@ compiler." prev= continue ;; - rpath) - rpath="$rpath $arg" - prev= - continue - ;; - xrpath) - xrpath="$xrpath $arg" + rpath | xrpath) + # We need an absolute path. + case "$arg" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) rpath="$rpath $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) xrpath="$xrpath $arg" ;; + esac + fi prev= continue ;; @@ -931,7 +1014,6 @@ compiler." if test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" - dlopen_self=$dlopen_self_static fi continue ;; @@ -958,22 +1040,16 @@ compiler." ;; -export-dynamic) - if test "$export_dynamic" != yes; then - export_dynamic=yes - if test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - else - arg= - fi - fi + export_dynamic=yes + continue ;; -export-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: cannot have more than one -exported-symbols" + $echo "$modename: not more than one -exported-symbols argument allowed" exit 1 fi - if test "$arg" = "-export-symbols"; then + if test "X$arg" = "X-export-symbols"; then prev=expsyms else prev=expsyms_regex @@ -982,14 +1058,18 @@ compiler." ;; -L*) - dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'` + dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` + # 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: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" + fi + dir="$absdir" ;; esac case " $deplibs " in @@ -1013,20 +1093,29 @@ compiler." ;; -l*) + if test "$arg" = "-lc"; then + case "$host" in + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + # These systems don't actually have c library (as such) + continue + ;; + esac + elif test "$arg" = "-lm"; then + case "$host" in + *-*-cygwin* | *-*-beos*) + # These systems don't actually have math library (as such) + continue + ;; + esac + fi deplibs="$deplibs $arg" ;; -module) - if test "$module" != yes; then - module=yes - if test -n "$export_dynamic_flag_spec"; then - eval arg=\"$export_dynamic_flag_spec\" - else - arg= - fi - fi + module=yes + continue ;; - + -no-undefined) allow_undefined=no continue @@ -1050,7 +1139,19 @@ compiler." ;; -R*) - xrpath="$xrpath "`$echo "X$arg" | $Xsed -e 's/^-R//'` + dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` + # We need an absolute path. + case "$dir" in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + $echo "$modename: only absolute run-paths are allowed" 1>&2 + exit 1 + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) xrpath="$xrpath $dir" ;; + esac continue ;; @@ -1059,7 +1160,6 @@ compiler." if test -z "$pic_flag" && test -n "$link_static_flag"; then compile_command="$compile_command $link_static_flag" finalize_command="$finalize_command $link_static_flag" - dlopen_self=$dlopen_self_static fi continue ;; @@ -1131,6 +1231,7 @@ compiler." # it will not redefine variable installed. installed=yes + # Read the .la file # If there is no directory component, then add one. case "$arg" in */* | *\\*) . $arg ;; @@ -1163,7 +1264,7 @@ compiler." fi if test -n "$dependency_libs"; then - # Extract -R from dependency_libs + # Extract -R and -L from dependency_libs temp_deplibs= for deplib in $dependency_libs; do case "$deplib" in @@ -1175,7 +1276,13 @@ compiler." -L*) case "$compile_command $temp_deplibs " in *" $deplib "*) ;; *) temp_deplibs="$temp_deplibs $deplib";; - esac;; + esac + temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'` + case " $lib_search_path " in + *" $temp_dir "*) ;; + *) lib_search_path="$lib_search_path $temp_dir";; + esac + ;; *) temp_deplibs="$temp_deplibs $deplib";; esac done @@ -1221,7 +1328,8 @@ compiler." prev= fi - if test "$build_libtool_libs" = yes && test -n "$library_names"; then + if test -n "$library_names" && + { test "$prefer_static_libs" = no || test -z "$old_library"; }; then link_against_libtool_libs="$link_against_libtool_libs $arg" if test -n "$shlibpath_var"; then # Make sure the rpath contains only unique directories. @@ -1233,12 +1341,13 @@ compiler." # We need an absolute path. case "$dir" in - /* | [A-Za-z]:[/\\]*) absdir="$dir" ;; + [\\/] | [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 + $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 + $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 + absdir="$dir" fi ;; esac @@ -1247,24 +1356,24 @@ compiler." # 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 "*) ;; + *" $absdir "*) ;; *) case "$compile_rpath " in *" $absdir "*) ;; *) compile_rpath="$compile_rpath $absdir" esac ;; - esac + esac case " $sys_lib_dlsearch_path " in - *" $libdir "*) ;; + *" $libdir "*) ;; *) case "$finalize_rpath " in *" $libdir "*) ;; *) finalize_rpath="$finalize_rpath $libdir" esac ;; - esac + esac lib_linked=yes case "$hardcode_action" in @@ -1422,6 +1531,12 @@ compiler." exit 1 fi + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + compile_command="$compile_command $arg" + finalize_command="$finalize_command $arg" + fi + oldlibs= # calculate the name of the file, without its directory outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` @@ -1444,7 +1559,7 @@ compiler." $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi - if test -n "$dlfiles$dlprefiles"; then + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -1464,7 +1579,7 @@ compiler." $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi - if test -n "$export_symbols"; then + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi @@ -1503,11 +1618,6 @@ compiler." output_objdir="$output_objdir/$objdir" fi - # All the library-specific variables (install_libdir is set above). - library_names= - old_library= - dlname= - if test -n "$objs"; then $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1 exit 1 @@ -1519,7 +1629,7 @@ compiler." exit 1 fi - if test -n "$dlfiles$dlprefiles"; then + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 fi @@ -1702,7 +1812,7 @@ compiler." dependency_libs="$deplibs" case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2*) + *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) # these systems don't actually have a c library (as such)! ;; *) @@ -1750,12 +1860,13 @@ compiler." droppeddeps=no case "$deplibs_check_method" in pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behaviour. newdeplibs=$deplibs - ;; # Don't check for shared/static. Everything works. - # This might be a little naive. We might want to check - # whether the library exists or not. But this is on - # osf3 & osf4 and I'm not really sure... Just - # implementing what was already the behaviour. + ;; test_compile) # This code stresses the "libraries are programs" paradigm to its # limits. Maybe even breaks it. We compile a program, linking it @@ -1766,7 +1877,7 @@ compiler." int main() { return 0; } EOF $rm conftest - $C_compiler -o conftest conftest.c $deplibs + $CC -o conftest conftest.c $deplibs if test $? -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do @@ -1799,24 +1910,24 @@ EOF # If $name is empty we are operating on a -L argument. if test "$name" != "" ; then $rm conftest - $C_compiler -o conftest conftest.c $i + $CC -o conftest conftest.c $i # Did it work? if test $? -eq 0 ; then ldd_output=`ldd conftest` - libname=`eval \\$echo \"$libname_spec\"` - deplib_matches=`eval \\$echo \"$library_names_spec\"` - set dummy $deplib_matches - deplib_match=$2 - if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then - newdeplibs="$newdeplibs $i" - else - droppeddeps=yes - echo - echo "*** Warning: This library needs some functionality provided by $i." - 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." - fi + libname=`eval \\$echo \"$libname_spec\"` + deplib_matches=`eval \\$echo \"$library_names_spec\"` + set dummy $deplib_matches + deplib_match=$2 + if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then + newdeplibs="$newdeplibs $i" + else + droppeddeps=yes + echo + echo "*** Warning: This library needs some functionality provided by $i." + 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." + fi else droppeddeps=yes echo @@ -1830,7 +1941,6 @@ EOF fi done fi - deplibs=$newdeplibs ;; file_magic*) set dummy $deplibs_check_method @@ -1844,7 +1954,7 @@ EOF potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do # Follow soft links. - if ls -lLd "$potlib" 2>/dev/null \ + if ls -lLd "$potent_lib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi @@ -1857,11 +1967,11 @@ EOF while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | sed 's/.* -> //'` case "$potliblink" in - /*) potlib="$potliblink";; + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done - if eval $file_magic_cmd \"\$potlib\" \ + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | sed 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" @@ -1884,7 +1994,8 @@ EOF fi done # Gone through all deplibs. ;; - none | unknown | *) newdeplibs="" + none | unknown | *) + newdeplibs="" if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ -e 's/ -[LR][^ ]*//g' -e 's/[ ]//g' | grep . >/dev/null; then @@ -1926,21 +2037,23 @@ EOF else build_libtool_libs=no fi - dlname= - library_names= else echo "*** The inter-library dependencies that have been dropped here will be" echo "*** automatically added whenever a program is linked with this library" echo "*** or is declared to -dlopen it." fi fi + # Done checking deplibs! + deplibs=$newdeplibs fi - # test again, we may have decided not to build it any more + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more if test "$build_libtool_libs" = yes; then - deplibs=$newdeplibs - # Done checking deplibs! - # Get the real and link names of the library. eval library_names=\"$library_names_spec\" set dummy $library_names @@ -1960,52 +2073,30 @@ EOF done # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) incase we are running --disable-static + # (e.g. aix) in case we are running --disable-static for obj in $libobjs; do - oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"` - test -f $oldobj || ${LN_S} $obj $oldobj + xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$obj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + if test ! -f $xdir/$oldobj; then + $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" + $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? + fi done # Use standard objects if they are pic test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` - if test -n "$whole_archive_flag_spec"; then - if test -n "$convenience"; then - eval libobjs=\"\$libobjs $whole_archive_flag_spec\" - fi - else - for xlib in $convenience; do - # Extract the objects. - xdir="$xlib"x - generated="$generated $xdir" - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" - status=$? - if test $status -ne 0 && test ! -d "$xdir"; then - exit $status - fi - $show "(cd $xdir && $AR x ../$xlib)" - $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $? - - libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done - fi - - if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then - eval flag=\"$thread_safe_flag_spec\" - - linkopts="$linkopts $flag" - fi - # Prepare the list of exported symbols if test -z "$export_symbols"; then if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then $show "generating symbol list for \`$libname.la'" - export_symbols="$objdir/$libname.exp" + export_symbols="$output_objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' @@ -2028,6 +2119,51 @@ EOF $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' fi + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + linkopts="$linkopts $flag" + fi + # Do each of the archive commands. if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then eval cmds=\"$archive_expsym_cmds\" @@ -2068,7 +2204,7 @@ EOF $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi - if test -n "$dlfiles$dlprefiles"; then + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi @@ -2106,8 +2242,58 @@ EOF # Delete the old objects. $run $rm $obj $libobj + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\" + else + gentop="$output_objdir/${obj}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" + status=$? + if test $status -ne 0 && test ! -d "$gentop"; then + exit $status + fi + generated="$generated $gentop" + + for xlib in $convenience; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" + + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done + fi + fi + # Create the old-style object. - reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` + reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" output="$obj" eval cmds=\"$reload_cmds\" @@ -2120,9 +2306,21 @@ EOF IFS="$save_ifs" # Exit if we aren't doing a library object file. - test -z "$libobj" && exit 0 + if test -z "$libobj"; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + + exit 0 + fi if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop + fi + # Create an invalid libtool object if no PIC, so that we don't # accidentally link it into a program. $show "echo timestamp > $libobj" @@ -2132,7 +2330,7 @@ EOF if test -n "$pic_flag"; then # Only do commands if we really have different PIC objects. - reload_objs="$libobjs" + reload_objs="$libobjs $reload_conv_objs" output="$libobj" eval cmds=\"$reload_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' @@ -2146,8 +2344,21 @@ EOF # Just create a symlink. $show $rm $libobj $run $rm $libobj - $show "$LN_S $obj $libobj" - $run $LN_S $obj $libobj || exit $? + xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$libobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` + oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` + $show "(cd $xdir && $LN_S $oldobj $baseobj)" + $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? + fi + + if test -n "$gentop"; then + $show "${rm}r $gentop" + $run ${rm}r $gentop fi exit 0 @@ -2170,11 +2381,6 @@ EOF fi fi - if test "$dlself" = yes && test "$export_dynamic" = no; then - $echo "$modename: error: \`-dlopen self' requires \`-export-dynamic'" 1>&2 - exit 1 - fi - if test -n "$rpath$xrpath"; then # If the user specified any rpath flags, then add them. for libdir in $rpath $xrpath; do @@ -2210,7 +2416,6 @@ EOF fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" fi elif test -n "$runpath_var"; then @@ -2247,7 +2452,6 @@ EOF fi else eval flag=\"$hardcode_libdir_flag_spec\" - rpath="$rpath $flag" fi elif test -n "$runpath_var"; then @@ -2272,6 +2476,16 @@ EOF output_objdir="$output_objdir/$objdir" fi + # Create the binary in the object directory, then wrap it. + if test ! -d $output_objdir; then + $show "$mkdir $output_objdir" + $run $mkdir $output_objdir + status=$? + if test $status -ne 0 && test ! -d $output_objdir; then + exit $status + fi + fi + if test -n "$libobjs" && test "$build_old_libs" = yes; then # Transform all the library objects into standard objects. compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -2279,7 +2493,7 @@ EOF fi dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else @@ -2292,24 +2506,15 @@ EOF "") ;; *.c) # Discover the nlist of each of the dlfiles. - nlist="$objdir/${output}.nm" + nlist="$output_objdir/${outputname}.nm" - if test -d $objdir; then - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" - else - $show "$mkdir $objdir" - $run $mkdir $objdir - status=$? - if test $status -ne 0 && test ! -d $objdir; then - exit $status - fi - fi + $show "$rm $nlist ${nlist}S ${nlist}T" + $run $rm "$nlist" "${nlist}S" "${nlist}T" # Parse the name list into a source file. - $show "creating $objdir/$dlsyms" + $show "creating $output_objdir/$dlsyms" - $echo > "$objdir/$dlsyms" "\ + test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ @@ -2326,7 +2531,7 @@ extern \"C\" { if test "$dlself" = yes; then $show "generating symbol list for \`$output'" - echo ': @PROGRAM@ ' > "$nlist" + test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -2347,13 +2552,12 @@ extern \"C\" { # Prepare the list of exported symbols if test -z "$export_symbols"; then - export_symbols="$objdir/$output.exp" + export_symbols="$output_objdir/$output.exp" $run $rm $export_symbols $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else - $run $rm $export_symbols - $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$objdir/$output.exp"' - $run eval 'grep -f "$objdir/$output.exp" < "$nlist" > "$nlist"T' + $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"' + $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T' $run eval 'mv "$nlist"T "$nlist"' fi fi @@ -2429,26 +2633,35 @@ static const void *lt_preloaded_setup() { fi pic_flag_for_symtable= - case "$host" in + case "$host" in # compiling the symbol table file with pic_flag works around # a FreeBSD bug that causes programs to crash when -lm is # linked before any other PIC object. But we must not use # pic_flag when linking with -static. The problem exists in # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. - *-*-freebsd2*|*-*-freebsd3.0*) + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
case "$compile_command " in *" -static "*) ;; *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; + esac;; + *-*-hpux*) + case "$compile_command " in + *" -static "*) ;; + *) pic_flag_for_symtable=" $pic_flag -DPIC";; esac esac # Now compile the dynamic symbol file. - $show "(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" - $run eval '(cd $objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" + $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? + + # Clean up the generated files. + $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" + $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" # Transform the symbol file into the correct name. - compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"` - finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.${objext}%"` + compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` + finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 @@ -2473,7 +2686,15 @@ static const void *lt_preloaded_setup() { # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" - exit $? + status=$? + + # Delete the generated files. + if test -n "$dlsyms"; then + $show "$rm $output_objdir/${outputname}S.${objext}" + $run $rm "$output_objdir/${outputname}S.${objext}" + fi + + exit $status fi if test -n "$shlibpath_var"; then @@ -2481,7 +2702,7 @@ static const void *lt_preloaded_setup() { rpath= for dir in $temp_rpath; do case "$dir" in - /* | [A-Za-z]:[/\\]*) + [\\/]* | [A-Za-z]:[\\/]*) # Absolute path. rpath="$rpath$dir:" ;; @@ -2527,7 +2748,6 @@ static const void *lt_preloaded_setup() { link_command="$compile_var$compile_command$compile_rpath" relink_command="$finalize_var$finalize_command$finalize_rpath" - # AGH! Flame the AIX and HP-UX people for me, will ya? $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 $echo "$modename: \`$output' will be relinked during installation" 1>&2 else @@ -2548,17 +2768,7 @@ static const void *lt_preloaded_setup() { # Replace the output file specification. link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` - # Create the binary in the object directory, then wrap it. - if test ! -d $output_objdir; then - $show "$mkdir $output_objdir" - $run $mkdir $output_objdir - status=$? - if test $status -ne 0 && test ! -d $objdir; then - exit $status - fi - fi - - # Delete the old output file. + # Delete the old output files. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" @@ -2575,7 +2785,7 @@ static const void *lt_preloaded_setup() { # Quote $echo for shipping. if test "X$echo" = "X$SHELL $0 --fallback-echo"; then case "$0" in - /* | [A-Za-z]:[/\\]*) qecho="$SHELL $0 --fallback-echo";; + [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";; *) qecho="$SHELL `pwd`/$0 --fallback-echo";; esac qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` @@ -2612,7 +2822,7 @@ sed_quote_subst='$sed_quote_subst' # The HP-UX ksh and POSIX shell print the target directory to stdout # if CDPATH is set. -if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi +if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi relink_command=\"$relink_command\" @@ -2652,7 +2862,7 @@ else # If there was a directory component, then change thisdir. if test \"x\$destdir\" != \"x\$file\"; then case \"\$destdir\" in - /* | [A-Za-z]:[/\\]*) thisdir=\"\$destdir\" ;; + [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;; *) thisdir=\"\$thisdir/\$destdir\" ;; esac fi @@ -2790,31 +3000,65 @@ fi\ addlibs="$old_convenience" fi - # Add in members from convenience archives. - for xlib in $addlibs; do - # Extract the objects. - xdir="$xlib"x - generated="$generated $xdir" - xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` - - $show "${rm}r $xdir" - $run ${rm}r "$xdir" - $show "mkdir $xdir" - $run mkdir "$xdir" + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + $show "${rm}r $gentop" + $run ${rm}r "$gentop" + $show "mkdir $gentop" + $run mkdir "$gentop" status=$? - if test $status -ne 0 && test ! -d "$xdir"; then + if test $status -ne 0 && test ! -d "$gentop"; then exit $status fi - $show "(cd $xdir && $AR x ../$xlib)" - $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $? + generated="$generated $gentop" + + # Add in members from convenience archives. + for xlib in $addlibs; do + # Extract the objects. + case "$xlib" in + [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;; + *) xabs=`pwd`"/$xlib" ;; + esac + xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'` + xdir="$gentop/$xlib" - oldobjs="$oldobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` - done + $show "${rm}r $xdir" + $run ${rm}r "$xdir" + $show "mkdir $xdir" + $run mkdir "$xdir" + status=$? + if test $status -ne 0 && test ! -d "$xdir"; then + exit $status + fi + $show "(cd $xdir && $AR x $xabs)" + $run eval "(cd \$xdir && $AR x \$xabs)" || exit $? + + oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` + done + fi # Do each command in the archive commands. if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then eval cmds=\"$old_archive_from_new_cmds\" else + # Ensure that we have .o objects in place in case we decided + # not to build a shared library, and have fallen back to building + # static libs even though --disable-static was passed! + for oldobj in $oldobjs; do + if test ! -f $oldobj; then + xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` + if test "X$xdir" = "X$oldobj"; then + xdir="." + else + xdir="$xdir" + fi + baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` + obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` + $show "(cd $xdir && ${LN_S} $obj $baseobj)" + $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? + fi + done + eval cmds=\"$old_archive_cmds\" fi IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' @@ -2848,9 +3092,20 @@ fi\ # Only create the output if not a dry run. if test -z "$run"; then - $echo > $output "\ -# $output - a libtool library file + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + fi + $rm $output + $echo > $output "\ +# $outputname - a libtool library file # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP +# +# Please DO NOT delete this file! +# It is necessary for linking the library. # The name that we can dlopen(3). dlname='$dlname' @@ -2870,15 +3125,12 @@ age=$age revision=$revision # Is this an already installed library? -installed=no +installed=$installed # Directory that this library needs to be installed in: libdir='$install_libdir'\ " - - $rm "$output_objdir/$outputname"i - sed 's/^installed=no$/installed=yes/' \ - < "$output" > "$output_objdir/$outputname"i || exit 1 + done fi # Do a symbolic link so that the libtool archive can be found in @@ -3015,7 +3267,7 @@ libdir='$install_libdir'\ fi fi case "$destdir" in - /* | [A-Za-z]:[/\\]*) ;; + [\\/]* | [A-Za-z]:[\\/]*) ;; *) for file in $files; do case "$file" in @@ -3091,13 +3343,11 @@ libdir='$install_libdir'\ # Install the shared library and build the symlinks. $show "$install_prog $dir/$realname $destdir/$realname" $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $? - test "X$dlname" = "X$realname" && dlname= if test $# -gt 0; then # Delete the old symlinks, and create new ones. for linkname do - test "X$dlname" = "X$linkname" && dlname= if test "$linkname" != "$realname"; then $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)" @@ -3105,12 +3355,6 @@ libdir='$install_libdir'\ done fi - if test -n "$dlname"; then - # Install the dynamically-loadable library. - $show "$install_prog $dir/$dlname $destdir/$dlname" - $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $? - fi - # Do each command in the postinstall commands. lib="$destdir/$realname" eval cmds=\"$postinstall_cmds\" @@ -3126,12 +3370,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 $? @@ -3229,21 +3467,29 @@ libdir='$install_libdir'\ outputname= if test "$fast_install" = no && test -n "$relink_command"; then - if test "$finalize" = yes; then - outputname="/tmp/$$-$file" + if test "$finalize" = yes && test -z "$run"; then + tmpdir="/tmp" + test -n "$TMPDIR" && tmpdir="$TMPDIR" + tmpdir="$tmpdir/libtool-$$" + if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then : + else + $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2 + continue + fi + outputname="$tmpdir/$file" # Replace the output file specification. relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'` - $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 + ${rm}r "$tmpdir" continue fi file="$outputname" else - $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 + $echo "$modename: warning: cannot relink \`$file'" 1>&2 fi else # Install the binary that we compiled earlier. @@ -3253,7 +3499,7 @@ libdir='$install_libdir'\ $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && $rm $outputname + test -n "$outputname" && ${rm}r "$tmpdir" ;; esac done @@ -3479,8 +3725,10 @@ libdir='$install_libdir'\ done if test -z "$run"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then @@ -3497,8 +3745,10 @@ libdir='$install_libdir'\ exit 1 else # Display what would be done. - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" + if test -n "$shlibpath_var"; then + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" + fi $echo "$cmd$args" exit 0 fi @@ -3540,9 +3790,7 @@ libdir='$install_libdir'\ # Delete the libtool libraries and symlinks. for n in $library_names; do rmfiles="$rmfiles $dir/$n" - test "X$n" = "X$dlname" && dlname= done - test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname" test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library" $show "$rm $rmfiles" @@ -3721,6 +3969,8 @@ The following components of LINK-COMMAND are treated specially: -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) -export-symbols SYMFILE try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX -LLIBDIR search LIBDIR for required installed libraries -lNAME OUTPUT-FILE requires the installed library libNAME -module build a library that can dlopened @@ -3751,7 +4001,7 @@ is created, otherwise an executable program is created." ;; uninstall) - $echo + $echo \ "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... Remove libraries from an installation directory. |