diff options
Diffstat (limited to 'ltmain.sh')
-rw-r--r-- | ltmain.sh | 748 |
1 files changed, 249 insertions, 499 deletions
@@ -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, 2000 Free Software Foundation, Inc. -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# 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,23 +28,18 @@ if test "X$1" = X--no-reexec; then # Discard the --no-reexec flag, and continue. shift elif test "X$1" = X--fallback-echo; then - # Avoid inline document here, it may be left over - : -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then - # Yippee, $echo works! - : -else - # Restart under the correct shell, and then maybe $echo will work. - 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 +elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then + # Yippee, $echo works! + : +else + # Restart under the correct shell, and then maybe $echo will work. + exec $SHELL "$0" --no-reexec ${1+"$@"} fi # The name of this program. @@ -54,8 +49,8 @@ modename="$progname" # Constants. PROGRAM=ltmain.sh PACKAGE=libtool -VERSION=1.3.4 -TIMESTAMP=" (1.385.2.196 1999/12/07 21:47:57)" +VERSION=1.2f +TIMESTAMP=" (1.33 1999/04/26 16:28:53)" default_mode= help="Try \`$progname --help' for more information." @@ -69,7 +64,7 @@ rm="rm -f" Xsed='sed -e 1s/^X//' sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' SP2NL='tr \040 \012' -NL2SP='tr \015\012 \040\040' +NL2SP='tr \012 \040' # NLS nuisances. # Only set LANG and LC_ALL to C if already set. @@ -105,7 +100,6 @@ 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 @@ -435,13 +429,7 @@ compiler." fbsd_hideous_sh_bug=$base_compile # All platforms use -DPIC, to notify preprocessed assembler code. - # 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 + command="$base_compile $pic_flag -DPIC $srcfile" if test "$build_old_libs" = yes; then lo_libobj="$libobj" dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` @@ -472,7 +460,6 @@ compiler." command="$command -o $output_obj" fi - $run $rm "$output_obj" $show "$command" if $run eval "$command"; then : else @@ -527,17 +514,9 @@ 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 "(cd $xdir && $LN_S $baseobj $libobj)" - if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then + $show "$LN_S $obj $lo_libobj" + if $run $LN_S $obj $lo_libobj; then exit 0 else error=$? @@ -560,7 +539,6 @@ 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 @@ -628,18 +606,9 @@ compiler." link) modename="$modename: link" C_compiler="$CC" # save it, to compile generated C sources - # Always respect the CC configured in by ltconfig. - CC="$nonopt" # CYGNUS LOCAL: tromey/java - # Add -B options to link line. - for arg - do - case "$arg" in - -B*) - CC="$CC $arg" - ;; - esac - done + # Always respect the CC configured in by ltconfig. + # CC="$nonopt" # END CYGNUS LOCAL case "$host" in *-*-cygwin* | *-*-mingw* | *-*-os2*) @@ -664,24 +633,10 @@ 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 @@ -828,8 +783,8 @@ compiler." allow_undefined=yes ;; esac - compile_command="$nonopt" - finalize_command="$nonopt" + compile_command="$CC" + finalize_command="$CC" compile_rpath= finalize_rpath= @@ -863,7 +818,6 @@ compiler." ltlibs= module=no objs= - prefer_static_libs=no preload=no prev= prevarg= @@ -880,21 +834,11 @@ compiler." do case "$arg" in -all-static | -static) - if test "X$arg" = "X-all-static"; then - if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + if test "X$arg" = "X-all-static" && 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 @@ -927,32 +871,18 @@ 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 ;; *) - if test "$prev" = dlfiles; then - dlfiles="$dlfiles $arg" - else - dlprefiles="$dlprefiles $arg" - fi + dlprefiles="$dlprefiles $arg" + test "$prev" = dlfiles && dlfiles="$dlfiles $arg" prev= ;; esac @@ -976,26 +906,13 @@ compiler." prev= continue ;; - 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 + rpath) + rpath="$rpath $arg" + prev= + continue + ;; + xrpath) + xrpath="$xrpath $arg" prev= continue ;; @@ -1014,6 +931,7 @@ 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 ;; @@ -1040,16 +958,22 @@ compiler." ;; -export-dynamic) - export_dynamic=yes - continue + 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-symbols | -export-symbols-regex) if test -n "$export_symbols" || test -n "$export_symbols_regex"; then - $echo "$modename: not more than one -exported-symbols argument allowed" + $echo "$modename: cannot have more than one -exported-symbols" exit 1 fi - if test "X$arg" = "X-export-symbols"; then + if test "$arg" = "-export-symbols"; then prev=expsyms else prev=expsyms_regex @@ -1058,18 +982,14 @@ compiler." ;; -L*) - dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` - # We need an absolute path. + dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'` case "$dir" in - [\\/]* | [A-Za-z]:[\\/]*) ;; + /* | [A-Za-z]:[/\\]*) + # Add the corresponding hardcode_libdir_flag, if it is not identical. + ;; *) - 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" + $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2 + exit 1 ;; esac case " $deplibs " in @@ -1093,29 +1013,20 @@ 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) - module=yes - continue + 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 ;; - + -no-undefined) allow_undefined=no continue @@ -1139,19 +1050,7 @@ compiler." ;; -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 + xrpath="$xrpath "`$echo "X$arg" | $Xsed -e 's/^-R//'` continue ;; @@ -1160,6 +1059,7 @@ 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 ;; @@ -1231,7 +1131,6 @@ 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 ;; @@ -1264,7 +1163,7 @@ compiler." fi if test -n "$dependency_libs"; then - # Extract -R and -L from dependency_libs + # Extract -R from dependency_libs temp_deplibs= for deplib in $dependency_libs; do case "$deplib" in @@ -1276,13 +1175,7 @@ compiler." -L*) case "$compile_command $temp_deplibs " in *" $deplib "*) ;; *) temp_deplibs="$temp_deplibs $deplib";; - 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 - ;; + esac;; *) temp_deplibs="$temp_deplibs $deplib";; esac done @@ -1328,8 +1221,7 @@ compiler." prev= fi - if test -n "$library_names" && - { test "$prefer_static_libs" = no || test -z "$old_library"; }; then + 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. @@ -1341,13 +1233,12 @@ 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: 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" + $echo "$modename: cannot determine absolute directory name of \`$libdir'" 1>&2 + exit 1 fi ;; esac @@ -1356,24 +1247,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 @@ -1531,12 +1422,6 @@ 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%^.*/%%'` @@ -1559,7 +1444,7 @@ compiler." $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$dlfiles$dlprefiles"; then $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 fi @@ -1579,7 +1464,7 @@ compiler." $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 fi - if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + if test -n "$export_symbols"; then $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 fi @@ -1618,6 +1503,11 @@ 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 @@ -1629,7 +1519,7 @@ compiler." exit 1 fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$dlfiles$dlprefiles"; then $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2 fi @@ -1812,7 +1702,7 @@ compiler." dependency_libs="$deplibs" case "$host" in - *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) + *-*-cygwin* | *-*-mingw* | *-*-os2*) # these systems don't actually have a c library (as such)! ;; *) @@ -1860,13 +1750,12 @@ 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 @@ -1877,7 +1766,7 @@ compiler." int main() { return 0; } EOF $rm conftest - $CC -o conftest conftest.c $deplibs + $C_compiler -o conftest conftest.c $deplibs if test $? -eq 0 ; then ldd_output=`ldd conftest` for i in $deplibs; do @@ -1910,24 +1799,24 @@ EOF # If $name is empty we are operating on a -L argument. if test "$name" != "" ; then $rm conftest - $CC -o conftest conftest.c $i + $C_compiler -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 @@ -1941,6 +1830,7 @@ EOF fi done fi + deplibs=$newdeplibs ;; file_magic*) set dummy $deplibs_check_method @@ -1954,7 +1844,7 @@ EOF potential_libs=`ls $i/$libname[.-]* 2>/dev/null` for potent_lib in $potential_libs; do # Follow soft links. - if ls -lLd "$potent_lib" 2>/dev/null \ + if ls -lLd "$potlib" 2>/dev/null \ | grep " -> " >/dev/null; then continue fi @@ -1967,11 +1857,11 @@ EOF while test -h "$potlib" 2>/dev/null; do potliblink=`ls -ld $potlib | sed 's/.* -> //'` case "$potliblink" in - [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + /*) potlib="$potliblink";; *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; esac done - if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ + if eval $file_magic_cmd \"\$potlib\" \ | sed 10q \ | egrep "$file_magic_regex" > /dev/null; then newdeplibs="$newdeplibs $a_deplib" @@ -1994,8 +1884,7 @@ 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 @@ -2037,23 +1926,21 @@ 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 - # 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 + # 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 @@ -2073,30 +1960,52 @@ EOF done # Ensure that we have .o objects for linkers which dislike .lo - # (e.g. aix) in case we are running --disable-static + # (e.g. aix) incase we are running --disable-static for obj in $libobjs; do - 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 + oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"` + test -f $oldobj || ${LN_S} $obj $oldobj 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="$output_objdir/$libname.exp" + export_symbols="$objdir/$libname.exp" $run $rm $export_symbols eval cmds=\"$export_symbols_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' @@ -2119,51 +2028,6 @@ 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\" @@ -2204,7 +2068,7 @@ EOF $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 fi - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$dlfiles$dlprefiles"; then $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 fi @@ -2242,58 +2106,8 @@ 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_conv_objs" + reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP` output="$obj" eval cmds=\"$reload_cmds\" @@ -2306,21 +2120,9 @@ EOF IFS="$save_ifs" # Exit if we aren't doing a library object file. - if test -z "$libobj"; then - if test -n "$gentop"; then - $show "${rm}r $gentop" - $run ${rm}r $gentop - fi - - exit 0 - fi + test -z "$libobj" && exit 0 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" @@ -2330,7 +2132,7 @@ EOF if test -n "$pic_flag"; then # Only do commands if we really have different PIC objects. - reload_objs="$libobjs $reload_conv_objs" + reload_objs="$libobjs" output="$libobj" eval cmds=\"$reload_cmds\" IFS="${IFS= }"; save_ifs="$IFS"; IFS='~' @@ -2344,21 +2146,8 @@ EOF # Just create a symlink. $show $rm $libobj $run $rm $libobj - 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 + $show "$LN_S $obj $libobj" + $run $LN_S $obj $libobj || exit $? fi exit 0 @@ -2381,6 +2170,11 @@ 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 @@ -2416,6 +2210,7 @@ EOF fi else eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" fi elif test -n "$runpath_var"; then @@ -2452,6 +2247,7 @@ EOF fi else eval flag=\"$hardcode_libdir_flag_spec\" + rpath="$rpath $flag" fi elif test -n "$runpath_var"; then @@ -2476,16 +2272,6 @@ 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` @@ -2493,7 +2279,7 @@ EOF fi dlsyms= - if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$dlfiles$dlprefiles" || test "$dlself" = yes; then if test -n "$NM" && test -n "$global_symbol_pipe"; then dlsyms="${outputname}S.c" else @@ -2506,15 +2292,24 @@ EOF "") ;; *.c) # Discover the nlist of each of the dlfiles. - nlist="$output_objdir/${outputname}.nm" + nlist="$objdir/${output}.nm" - $show "$rm $nlist ${nlist}S ${nlist}T" - $run $rm "$nlist" "${nlist}S" "${nlist}T" + 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 # Parse the name list into a source file. - $show "creating $output_objdir/$dlsyms" + $show "creating $objdir/$dlsyms" - test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ + $echo > "$objdir/$dlsyms" "\ /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ @@ -2531,7 +2326,7 @@ extern \"C\" { if test "$dlself" = yes; then $show "generating symbol list for \`$output'" - test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" + echo ': @PROGRAM@ ' > "$nlist" # Add our own program objects to the symbol list. progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` @@ -2552,12 +2347,13 @@ extern \"C\" { # Prepare the list of exported symbols if test -z "$export_symbols"; then - export_symbols="$output_objdir/$output.exp" + export_symbols="$objdir/$output.exp" $run $rm $export_symbols $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' else - $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 $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 'mv "$nlist"T "$nlist"' fi fi @@ -2633,35 +2429,26 @@ 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*|*-*-freebsdelf3.0*)
+ *-*-freebsd2*|*-*-freebsd3.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 $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" + $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 $? # Transform the symbol file into the correct name. - 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}%"` + 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}%"` ;; *) $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 @@ -2686,15 +2473,7 @@ static const void *lt_preloaded_setup() { # We have no uninstalled library dependencies, so finalize right now. $show "$link_command" $run eval "$link_command" - 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 + exit $? fi if test -n "$shlibpath_var"; then @@ -2702,7 +2481,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:" ;; @@ -2748,6 +2527,7 @@ 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 @@ -2768,7 +2548,17 @@ 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'` - # Delete the old output files. + # 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. $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname $show "$link_command" @@ -2785,7 +2575,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"` @@ -2822,7 +2612,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\" @@ -2862,7 +2652,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 @@ -3000,65 +2790,31 @@ fi\ addlibs="$old_convenience" fi - if test -n "$addlibs"; then - gentop="$output_objdir/${outputname}x" - $show "${rm}r $gentop" - $run ${rm}r "$gentop" - $show "mkdir $gentop" - $run mkdir "$gentop" + # 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" status=$? - if test $status -ne 0 && test ! -d "$gentop"; then + if test $status -ne 0 && test ! -d "$xdir"; then exit $status fi - 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" - - $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 $? + $show "(cd $xdir && $AR x ../$xlib)" + $run eval "(cd \$xdir && $AR x ../\$xlib)" || exit $? - oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP` - done - fi + oldobjs="$oldobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP` + done # 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='~' @@ -3092,20 +2848,9 @@ fi\ # Only create the output if not a dry run. if test -z "$run"; then - 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 + $echo > $output "\ +# $output - 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' @@ -3125,12 +2870,15 @@ age=$age revision=$revision # Is this an already installed library? -installed=$installed +installed=no # Directory that this library needs to be installed in: libdir='$install_libdir'\ " - done + + $rm "$output_objdir/$outputname"i + sed 's/^installed=no$/installed=yes/' \ + < "$output" > "$output_objdir/$outputname"i || exit 1 fi # Do a symbolic link so that the libtool archive can be found in @@ -3267,7 +3015,7 @@ libdir='$install_libdir'\ fi fi case "$destdir" in - [\\/]* | [A-Za-z]:[\\/]*) ;; + /* | [A-Za-z]:[/\\]*) ;; *) for file in $files; do case "$file" in @@ -3343,11 +3091,13 @@ 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)" @@ -3355,6 +3105,12 @@ 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\" @@ -3370,6 +3126,12 @@ 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 $? @@ -3467,29 +3229,21 @@ libdir='$install_libdir'\ outputname= if test "$fast_install" = no && test -n "$relink_command"; then - 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" + if test "$finalize" = yes; then + outputname="/tmp/$$-$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'" 1>&2 + $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2 fi else # Install the binary that we compiled earlier. @@ -3499,7 +3253,7 @@ libdir='$install_libdir'\ $show "$install_prog$stripme $file $destfile" $run eval "$install_prog\$stripme \$file \$destfile" || exit $? - test -n "$outputname" && ${rm}r "$tmpdir" + test -n "$outputname" && $rm $outputname ;; esac done @@ -3725,10 +3479,8 @@ libdir='$install_libdir'\ done if test -z "$run"; then - if test -n "$shlibpath_var"; then - # Export the shlibpath_var. - eval "export $shlibpath_var" - fi + # Export the shlibpath_var. + eval "export $shlibpath_var" # Restore saved enviroment variables if test "${save_LC_ALL+set}" = set; then @@ -3745,10 +3497,8 @@ libdir='$install_libdir'\ exit 1 else # Display what would be done. - if test -n "$shlibpath_var"; then - eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" - $echo "export $shlibpath_var" - fi + eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" + $echo "export $shlibpath_var" $echo "$cmd$args" exit 0 fi @@ -3790,7 +3540,9 @@ 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" @@ -3969,8 +3721,6 @@ 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 @@ -4001,7 +3751,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. |