… | |
… | |
52 | modename="$progname" |
52 | modename="$progname" |
53 | |
53 | |
54 | # Constants. |
54 | # Constants. |
55 | PROGRAM=ltmain.sh |
55 | PROGRAM=ltmain.sh |
56 | PACKAGE=libtool |
56 | PACKAGE=libtool |
57 | VERSION=1.3.3 |
57 | VERSION=1.3.5 |
58 | TIMESTAMP=" (1.385.2.181 1999/07/02 15:49:11)" |
58 | TIMESTAMP=" (1.385.2.206 2000/05/27 11:12:27)" |
59 | |
59 | |
60 | default_mode= |
60 | default_mode= |
61 | help="Try \`$progname --help' for more information." |
61 | help="Try \`$progname --help' for more information." |
62 | magic="%%%MAGIC variable%%%" |
62 | magic="%%%MAGIC variable%%%" |
63 | mkdir="mkdir" |
63 | mkdir="mkdir" |
… | |
… | |
433 | if test "$build_libtool_libs" = yes; then |
433 | if test "$build_libtool_libs" = yes; then |
434 | # Without this assignment, base_compile gets emptied. |
434 | # Without this assignment, base_compile gets emptied. |
435 | fbsd_hideous_sh_bug=$base_compile |
435 | fbsd_hideous_sh_bug=$base_compile |
436 | |
436 | |
437 | # All platforms use -DPIC, to notify preprocessed assembler code. |
437 | # All platforms use -DPIC, to notify preprocessed assembler code. |
438 | command="$base_compile $pic_flag -DPIC $srcfile" |
438 | command="$base_compile $srcfile $pic_flag -DPIC" |
439 | if test "$build_old_libs" = yes; then |
439 | if test "$build_old_libs" = yes; then |
440 | lo_libobj="$libobj" |
440 | lo_libobj="$libobj" |
441 | dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` |
441 | dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` |
442 | if test "X$dir" = "X$libobj"; then |
442 | if test "X$dir" = "X$libobj"; then |
443 | dir="$objdir" |
443 | dir="$objdir" |
… | |
… | |
519 | error=$? |
519 | error=$? |
520 | $run $rm $removelist |
520 | $run $rm $removelist |
521 | exit $error |
521 | exit $error |
522 | fi |
522 | fi |
523 | |
523 | |
|
|
524 | xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` |
|
|
525 | if test "X$xdir" = "X$obj"; then |
|
|
526 | xdir="." |
|
|
527 | else |
|
|
528 | xdir="$xdir" |
|
|
529 | fi |
|
|
530 | baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"` |
|
|
531 | libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` |
524 | # Now arrange that obj and lo_libobj become the same file |
532 | # Now arrange that obj and lo_libobj become the same file |
525 | $show "$LN_S $obj $lo_libobj" |
533 | $show "(cd $xdir && $LN_S $baseobj $libobj)" |
526 | if $run $LN_S $obj $lo_libobj; then |
534 | if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then |
527 | exit 0 |
535 | exit 0 |
528 | else |
536 | else |
529 | error=$? |
537 | error=$? |
530 | $run $rm $removelist |
538 | $run $rm $removelist |
531 | exit $error |
539 | exit $error |
… | |
… | |
611 | ;; |
619 | ;; |
612 | |
620 | |
613 | # libtool link mode |
621 | # libtool link mode |
614 | link) |
622 | link) |
615 | modename="$modename: link" |
623 | modename="$modename: link" |
616 | C_compiler="$CC" # save it, to compile generated C sources |
|
|
617 | CC="$nonopt" |
|
|
618 | case "$host" in |
624 | case "$host" in |
619 | *-*-cygwin* | *-*-mingw* | *-*-os2*) |
625 | *-*-cygwin* | *-*-mingw* | *-*-os2*) |
620 | # It is impossible to link a dll without this setting, and |
626 | # It is impossible to link a dll without this setting, and |
621 | # we shouldn't force the makefile maintainer to figure out |
627 | # we shouldn't force the makefile maintainer to figure out |
622 | # which system we are compiling for in order to pass an extra |
628 | # which system we are compiling for in order to pass an extra |
… | |
… | |
800 | ;; |
806 | ;; |
801 | *) |
807 | *) |
802 | allow_undefined=yes |
808 | allow_undefined=yes |
803 | ;; |
809 | ;; |
804 | esac |
810 | esac |
805 | compile_command="$CC" |
811 | compile_command="$nonopt" |
806 | finalize_command="$CC" |
812 | finalize_command="$nonopt" |
807 | |
813 | |
808 | compile_rpath= |
814 | compile_rpath= |
809 | finalize_rpath= |
815 | finalize_rpath= |
810 | compile_shlibpath= |
816 | compile_shlibpath= |
811 | finalize_shlibpath= |
817 | finalize_shlibpath= |
… | |
… | |
1787 | dependency_libs="$deplibs" |
1793 | dependency_libs="$deplibs" |
1788 | case "$host" in |
1794 | case "$host" in |
1789 | *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) |
1795 | *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*) |
1790 | # these systems don't actually have a c library (as such)! |
1796 | # these systems don't actually have a c library (as such)! |
1791 | ;; |
1797 | ;; |
|
|
1798 | *-*-rhapsody*) |
|
|
1799 | # rhapsody is a little odd... |
|
|
1800 | deplibs="$deplibs -framework System" |
|
|
1801 | ;; |
1792 | *) |
1802 | *) |
1793 | # Add libc to deplibs on all other systems. |
1803 | # Add libc to deplibs on all other systems. |
1794 | deplibs="$deplibs -lc" |
1804 | deplibs="$deplibs -lc" |
1795 | ;; |
1805 | ;; |
1796 | esac |
1806 | esac |
… | |
… | |
1849 | $rm conftest.c |
1859 | $rm conftest.c |
1850 | cat > conftest.c <<EOF |
1860 | cat > conftest.c <<EOF |
1851 | int main() { return 0; } |
1861 | int main() { return 0; } |
1852 | EOF |
1862 | EOF |
1853 | $rm conftest |
1863 | $rm conftest |
1854 | $C_compiler -o conftest conftest.c $deplibs |
1864 | $CC -o conftest conftest.c $deplibs |
1855 | if test $? -eq 0 ; then |
1865 | if test $? -eq 0 ; then |
1856 | ldd_output=`ldd conftest` |
1866 | ldd_output=`ldd conftest` |
1857 | for i in $deplibs; do |
1867 | for i in $deplibs; do |
1858 | name="`expr $i : '-l\(.*\)'`" |
1868 | name="`expr $i : '-l\(.*\)'`" |
1859 | # If $name is empty we are operating on a -L argument. |
1869 | # If $name is empty we are operating on a -L argument. |
… | |
… | |
1882 | for i in $deplibs; do |
1892 | for i in $deplibs; do |
1883 | name="`expr $i : '-l\(.*\)'`" |
1893 | name="`expr $i : '-l\(.*\)'`" |
1884 | # If $name is empty we are operating on a -L argument. |
1894 | # If $name is empty we are operating on a -L argument. |
1885 | if test "$name" != "" ; then |
1895 | if test "$name" != "" ; then |
1886 | $rm conftest |
1896 | $rm conftest |
1887 | $C_compiler -o conftest conftest.c $i |
1897 | $CC -o conftest conftest.c $i |
1888 | # Did it work? |
1898 | # Did it work? |
1889 | if test $? -eq 0 ; then |
1899 | if test $? -eq 0 ; then |
1890 | ldd_output=`ldd conftest` |
1900 | ldd_output=`ldd conftest` |
1891 | libname=`eval \\$echo \"$libname_spec\"` |
1901 | libname=`eval \\$echo \"$libname_spec\"` |
1892 | deplib_matches=`eval \\$echo \"$library_names_spec\"` |
1902 | deplib_matches=`eval \\$echo \"$library_names_spec\"` |
… | |
… | |
2045 | do |
2055 | do |
2046 | linknames="$linknames $link" |
2056 | linknames="$linknames $link" |
2047 | done |
2057 | done |
2048 | |
2058 | |
2049 | # Ensure that we have .o objects for linkers which dislike .lo |
2059 | # Ensure that we have .o objects for linkers which dislike .lo |
2050 | # (e.g. aix) incase we are running --disable-static |
2060 | # (e.g. aix) in case we are running --disable-static |
2051 | for obj in $libobjs; do |
2061 | for obj in $libobjs; do |
|
|
2062 | xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` |
|
|
2063 | if test "X$xdir" = "X$obj"; then |
|
|
2064 | xdir="." |
|
|
2065 | else |
|
|
2066 | xdir="$xdir" |
|
|
2067 | fi |
|
|
2068 | baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` |
2052 | oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"` |
2069 | oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` |
2053 | if test ! -f $oldobj; then |
2070 | if test ! -f $xdir/$oldobj; then |
2054 | $show "${LN_S} $obj $oldobj" |
2071 | $show "(cd $xdir && ${LN_S} $baseobj $oldobj)" |
2055 | $run ${LN_S} $obj $oldobj || exit $? |
2072 | $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $? |
2056 | fi |
2073 | fi |
2057 | done |
2074 | done |
2058 | |
2075 | |
2059 | # Use standard objects if they are pic |
2076 | # Use standard objects if they are pic |
2060 | test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
2077 | test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` |
… | |
… | |
2309 | IFS="$save_ifs" |
2326 | IFS="$save_ifs" |
2310 | else |
2327 | else |
2311 | # Just create a symlink. |
2328 | # Just create a symlink. |
2312 | $show $rm $libobj |
2329 | $show $rm $libobj |
2313 | $run $rm $libobj |
2330 | $run $rm $libobj |
2314 | $show "$LN_S $obj $libobj" |
2331 | xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'` |
2315 | $run $LN_S $obj $libobj || exit $? |
2332 | if test "X$xdir" = "X$libobj"; then |
|
|
2333 | xdir="." |
|
|
2334 | else |
|
|
2335 | xdir="$xdir" |
|
|
2336 | fi |
|
|
2337 | baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'` |
|
|
2338 | oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"` |
|
|
2339 | $show "(cd $xdir && $LN_S $oldobj $baseobj)" |
|
|
2340 | $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $? |
2316 | fi |
2341 | fi |
2317 | |
2342 | |
2318 | if test -n "$gentop"; then |
2343 | if test -n "$gentop"; then |
2319 | $show "${rm}r $gentop" |
2344 | $show "${rm}r $gentop" |
2320 | $run ${rm}r $gentop |
2345 | $run ${rm}r $gentop |
… | |
… | |
2596 | # compiling the symbol table file with pic_flag works around |
2621 | # compiling the symbol table file with pic_flag works around |
2597 | # a FreeBSD bug that causes programs to crash when -lm is |
2622 | # a FreeBSD bug that causes programs to crash when -lm is |
2598 | # linked before any other PIC object. But we must not use |
2623 | # linked before any other PIC object. But we must not use |
2599 | # pic_flag when linking with -static. The problem exists in |
2624 | # pic_flag when linking with -static. The problem exists in |
2600 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
2625 | # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. |
2601 | *-*-freebsd2*|*-*-freebsd3.0*) |
2626 | *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
|
2602 | case "$compile_command " in |
2627 | case "$compile_command " in |
2603 | *" -static "*) ;; |
2628 | *" -static "*) ;; |
2604 | *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; |
2629 | *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";; |
|
|
2630 | esac;; |
|
|
2631 | *-*-hpux*) |
|
|
2632 | case "$compile_command " in |
|
|
2633 | *" -static "*) ;; |
|
|
2634 | *) pic_flag_for_symtable=" $pic_flag -DPIC";; |
2605 | esac |
2635 | esac |
2606 | esac |
2636 | esac |
2607 | |
2637 | |
2608 | # Now compile the dynamic symbol file. |
2638 | # Now compile the dynamic symbol file. |
2609 | $show "(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" |
2639 | $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" |
2610 | $run eval '(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? |
2640 | $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? |
2611 | |
2641 | |
2612 | # Clean up the generated files. |
2642 | # Clean up the generated files. |
2613 | $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" |
2643 | $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" |
2614 | $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" |
2644 | $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" |
2615 | |
2645 | |
… | |
… | |
2774 | Xsed='sed -e 1s/^X//' |
2804 | Xsed='sed -e 1s/^X//' |
2775 | sed_quote_subst='$sed_quote_subst' |
2805 | sed_quote_subst='$sed_quote_subst' |
2776 | |
2806 | |
2777 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
2807 | # The HP-UX ksh and POSIX shell print the target directory to stdout |
2778 | # if CDPATH is set. |
2808 | # if CDPATH is set. |
2779 | if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi |
2809 | if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi |
2780 | |
2810 | |
2781 | relink_command=\"$relink_command\" |
2811 | relink_command=\"$relink_command\" |
2782 | |
2812 | |
2783 | # This environment variable determines our operation mode. |
2813 | # This environment variable determines our operation mode. |
2784 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
2814 | if test \"\$libtool_install_magic\" = \"$magic\"; then |
… | |
… | |
2863 | $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
2893 | $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } |
2864 | $rm \"\$progdir/\$file\" |
2894 | $rm \"\$progdir/\$file\" |
2865 | fi" |
2895 | fi" |
2866 | else |
2896 | else |
2867 | echo >> $output "\ |
2897 | echo >> $output "\ |
2868 | program='$outputname$exeext' |
2898 | program='$outputname' |
2869 | progdir=\"\$thisdir/$objdir\" |
2899 | progdir=\"\$thisdir/$objdir\" |
2870 | " |
2900 | " |
2871 | fi |
2901 | fi |
2872 | |
2902 | |
2873 | echo >> $output "\ |
2903 | echo >> $output "\ |
… | |
… | |
2899 | $echo >> $output "\ |
2929 | $echo >> $output "\ |
2900 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
2930 | if test \"\$libtool_execute_magic\" != \"$magic\"; then |
2901 | # Run the actual program with our arguments. |
2931 | # Run the actual program with our arguments. |
2902 | " |
2932 | " |
2903 | case $host in |
2933 | case $host in |
2904 | *-*-cygwin* | *-*-mingw | *-*-os2*) |
|
|
2905 | # win32 systems need to use the prog path for dll |
2934 | # win32 systems need to use the prog path for dll |
2906 | # lookup to work |
2935 | # lookup to work |
|
|
2936 | *-*-cygwin*) |
|
|
2937 | $echo >> $output "\ |
|
|
2938 | exec \$progdir/\$program \${1+\"\$@\"} |
|
|
2939 | " |
|
|
2940 | ;; |
|
|
2941 | |
|
|
2942 | # Backslashes separate directories on plain windows |
|
|
2943 | *-*-mingw | *-*-os2*) |
2907 | $echo >> $output "\ |
2944 | $echo >> $output "\ |
2908 | exec \$progdir\\\\\$program \${1+\"\$@\"} |
2945 | exec \$progdir\\\\\$program \${1+\"\$@\"} |
2909 | " |
2946 | " |
2910 | ;; |
2947 | ;; |
|
|
2948 | |
2911 | *) |
2949 | *) |
2912 | $echo >> $output "\ |
2950 | $echo >> $output "\ |
2913 | # Export the path to the program. |
2951 | # Export the path to the program. |
2914 | PATH=\"\$progdir:\$PATH\" |
2952 | PATH=\"\$progdir:\$PATH\" |
2915 | export PATH |
2953 | export PATH |
… | |
… | |
2993 | |
3031 | |
2994 | # Do each command in the archive commands. |
3032 | # Do each command in the archive commands. |
2995 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then |
3033 | if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then |
2996 | eval cmds=\"$old_archive_from_new_cmds\" |
3034 | eval cmds=\"$old_archive_from_new_cmds\" |
2997 | else |
3035 | else |
2998 | # Ensure that we have .o objects in place incase we decided |
3036 | # Ensure that we have .o objects in place in case we decided |
2999 | # not to build a shared library, and have fallen back to building |
3037 | # not to build a shared library, and have fallen back to building |
3000 | # static libs even though --disable-static was passed! |
3038 | # static libs even though --disable-static was passed! |
3001 | for oldobj in $oldobjs; do |
3039 | for oldobj in $oldobjs; do |
3002 | if test ! -f $oldobj; then |
3040 | if test ! -f $oldobj; then |
|
|
3041 | xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'` |
|
|
3042 | if test "X$xdir" = "X$oldobj"; then |
|
|
3043 | xdir="." |
|
|
3044 | else |
|
|
3045 | xdir="$xdir" |
|
|
3046 | fi |
|
|
3047 | baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'` |
3003 | obj=`$echo "X$oldobj" | $Xsed -e "$o2lo"` |
3048 | obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"` |
3004 | $show "${LN_S} $obj $oldobj" |
3049 | $show "(cd $xdir && ${LN_S} $obj $baseobj)" |
3005 | $run ${LN_S} $obj $oldobj || exit $? |
3050 | $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $? |
3006 | fi |
3051 | fi |
3007 | done |
3052 | done |
3008 | |
3053 | |
3009 | eval cmds=\"$old_archive_cmds\" |
3054 | eval cmds=\"$old_archive_cmds\" |
3010 | fi |
3055 | fi |
… | |
… | |
3670 | file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` |
3715 | file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` |
3671 | args="$args \"$file\"" |
3716 | args="$args \"$file\"" |
3672 | done |
3717 | done |
3673 | |
3718 | |
3674 | if test -z "$run"; then |
3719 | if test -z "$run"; then |
|
|
3720 | if test -n "$shlibpath_var"; then |
3675 | # Export the shlibpath_var. |
3721 | # Export the shlibpath_var. |
3676 | eval "export $shlibpath_var" |
3722 | eval "export $shlibpath_var" |
|
|
3723 | fi |
3677 | |
3724 | |
3678 | # Restore saved enviroment variables |
3725 | # Restore saved enviroment variables |
3679 | if test "${save_LC_ALL+set}" = set; then |
3726 | if test "${save_LC_ALL+set}" = set; then |
3680 | LC_ALL="$save_LC_ALL"; export LC_ALL |
3727 | LC_ALL="$save_LC_ALL"; export LC_ALL |
3681 | fi |
3728 | fi |
… | |
… | |
3688 | |
3735 | |
3689 | $echo "$modename: cannot exec \$cmd$args" |
3736 | $echo "$modename: cannot exec \$cmd$args" |
3690 | exit 1 |
3737 | exit 1 |
3691 | else |
3738 | else |
3692 | # Display what would be done. |
3739 | # Display what would be done. |
|
|
3740 | if test -n "$shlibpath_var"; then |
3693 | eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" |
3741 | eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" |
3694 | $echo "export $shlibpath_var" |
3742 | $echo "export $shlibpath_var" |
|
|
3743 | fi |
3695 | $echo "$cmd$args" |
3744 | $echo "$cmd$args" |
3696 | exit 0 |
3745 | exit 0 |
3697 | fi |
3746 | fi |
3698 | ;; |
3747 | ;; |
3699 | |
3748 | |