home *** CD-ROM | disk | FTP | other *** search
/ Dream 52 / Amiga_Dream_52.iso / Linux / Divers / ImageMagick-4.0.6.tar.gz / ImageMagick-4.0.6.tar / ImageMagick-4.0.6 / ltmain.sh < prev    next >
Text File  |  1998-04-19  |  72KB  |  2,473 lines

  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun ltconfig.
  3. #
  4. # Copyright (C) 1996-1998 Free Software Foundation, Inc.
  5. # Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  6. #
  7. # This program is free software; you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation; either version 2 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful, but
  13. # WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  15. # General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program; if not, write to the Free Software
  19. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. #
  21. # As a special exception to the GNU General Public License, if you
  22. # distribute this file as part of a program that contains a
  23. # configuration script generated by Autoconf, you may include it under
  24. # the same distribution terms that you use for the rest of that program.
  25.  
  26. # The name of this program.
  27. progname=`$echo "$0" | sed 's%^.*/%%'`
  28. modename="$progname"
  29.  
  30. # Constants.
  31. PROGRAM=ltmain.sh
  32. PACKAGE=libtool
  33. VERSION=1.2a
  34.  
  35. default_mode=
  36. help="Try \`$progname --help' for more information."
  37. magic="%%%MAGIC variable%%%"
  38. mkdir="mkdir"
  39. mv="mv -f"
  40. rm="rm -f"
  41.  
  42. # Sed substitution that helps us do robust quoting.  It backslashifies
  43. # metacharacters that are still active within double-quoted strings.
  44. Xsed='sed -e s/^X//'
  45. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  46.  
  47. # NLS nuisances.
  48. # Only set LANG and LC_ALL to C if already set.
  49. # These must not be set unconditionally because not all systems understand
  50. # e.g. LANG=C (notably SCO).
  51. if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
  52. if test "${LANG+set}"   = set; then LANG=C;   export LANG;   fi
  53.  
  54. if test "$LTCONFIG_VERSION" != "$VERSION"; then
  55.   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
  56.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  57.   exit 1
  58. fi
  59.  
  60. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  61.   echo "$modename: not configured to build any kind of library" 1>&2
  62.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  63.   exit 1
  64. fi
  65.  
  66. # Global variables.
  67. mode=$default_mode
  68. nonopt=
  69. prev=
  70. prevopt=
  71. run=
  72. show="$echo"
  73. show_help=
  74. execute_dlfiles=
  75.  
  76. # Parse our command line options once, thoroughly.
  77. while test $# -gt 0
  78. do
  79.   arg="$1"
  80.   shift
  81.  
  82.   case "$arg" in
  83.   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  84.   *) optarg= ;;
  85.   esac
  86.  
  87.   # If the previous option needs an argument, assign it.
  88.   if test -n "$prev"; then
  89.     case "$prev" in
  90.     execute_dlfiles)
  91.       eval "$prev=\"\$$prev \$arg\""
  92.       ;;
  93.     *)
  94.       eval "$prev=\$arg"
  95.       ;;
  96.     esac
  97.  
  98.     prev=
  99.     prevopt=
  100.     continue
  101.   fi
  102.  
  103.   # Have we seen a non-optional argument yet?
  104.   case "$arg" in
  105.   --help)
  106.     show_help=yes
  107.     ;;
  108.  
  109.   --version)
  110.     echo "$PROGRAM (GNU $PACKAGE) $VERSION"
  111.     exit 0
  112.     ;;
  113.  
  114.   --config)
  115.     sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
  116.     exit 0
  117.     ;;
  118.  
  119.   --debug)
  120.     echo "$progname: enabling shell trace mode"
  121.     set -x
  122.     ;;
  123.  
  124.   --dry-run | -n)
  125.     run=:
  126.     ;;
  127.  
  128.   --features)
  129.     echo "host: $host"
  130.     if test "$build_libtool_libs" = yes; then
  131.       echo "enable shared libraries"
  132.     else
  133.       echo "disable shared libraries"
  134.     fi
  135.     if test "$build_old_libs" = yes; then
  136.       echo "enable static libraries"
  137.     else
  138.       echo "disable static libraries"
  139.     fi
  140.     exit 0
  141.     ;;
  142.  
  143.   --finish) mode="finish" ;;
  144.  
  145.   --mode) prevopt="--mode" prev=mode ;;
  146.   --mode=*) mode="$optarg" ;;
  147.  
  148.   --quiet | --silent)
  149.     show=:
  150.     ;;
  151.  
  152.   -dlopen)
  153.     prevopt="-dlopen"
  154.     prev=execute_dlfiles
  155.     ;;
  156.  
  157.   -*)
  158.     $echo "$modename: unrecognized option \`$arg'" 1>&2
  159.     $echo "$help" 1>&2
  160.     exit 1
  161.     ;;
  162.  
  163.   *)
  164.     nonopt="$arg"
  165.     break
  166.     ;;
  167.   esac
  168. done
  169.  
  170. if test -n "$prevopt"; then
  171.   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  172.   $echo "$help" 1>&2
  173.   exit 1
  174. fi
  175.  
  176. if test -z "$show_help"; then
  177.  
  178.   # Infer the operation mode.
  179.   if test -z "$mode"; then
  180.     case "$nonopt" in
  181.     *cc | *++ | gcc* | *-gcc*)
  182.       mode=link
  183.       for arg
  184.       do
  185.         case "$arg" in
  186.         -c)
  187.            mode=compile
  188.            break
  189.            ;;
  190.         esac
  191.       done
  192.       ;;
  193.     *db | *dbx)
  194.       mode=execute
  195.       ;;
  196.     *install*|cp|mv)
  197.       mode=install
  198.       ;;
  199.     *rm)
  200.       mode=uninstall
  201.       ;;
  202.     *)
  203.       # If we have no mode, but dlfiles were specified, then do execute mode.
  204.       test -n "$execute_dlfiles" && mode=execute
  205.  
  206.       # Just use the default operation mode.
  207.       if test -z "$mode"; then
  208.         if test -n "$nonopt"; then
  209.           $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  210.         else
  211.           $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  212.         fi
  213.       fi
  214.       ;;
  215.     esac
  216.   fi
  217.  
  218.   # Only execute mode is allowed to have -dlopen flags.
  219.   if test -n "$execute_dlfiles" && test "$mode" != execute; then
  220.     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  221.     $echo "$help" 1>&2
  222.     exit 1
  223.   fi
  224.  
  225.   # Change the help message to a mode-specific one.
  226.   generic_help="$help"
  227.   help="Try \`$modename --help --mode=$mode' for more information."
  228.  
  229.   # These modes are in order of execution frequency so that they run quickly.
  230.   case "$mode" in
  231.   # libtool compile mode
  232.   compile)
  233.     modename="$modename: compile"
  234.     # Get the compilation command and the source file.
  235.     base_compile=
  236.     lastarg=
  237.     srcfile="$nonopt"
  238.     suppress_output=
  239.  
  240.     for arg
  241.     do
  242.       # Accept any command-line options.
  243.       case "$arg" in
  244.       -o)
  245.     $echo "$modename: you cannot specify the output filename with \`-o'" 1>&2
  246.     $echo "$help" 1>&2
  247.     exit 1
  248.     ;;
  249.  
  250.       -static)
  251.     build_libtool_libs=no
  252.     build_old_libs=yes
  253.     continue
  254.     ;;
  255.       esac
  256.  
  257.       # Accept the current argument as the source file.
  258.       lastarg="$srcfile"
  259.       srcfile="$arg"
  260.  
  261.       # Aesthetically quote the previous argument.
  262.  
  263.       # Backslashify any backslashes, double quotes, and dollar signs.
  264.       # These are the only characters that are still specially
  265.       # interpreted inside of double-quoted scrings.
  266.       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  267.  
  268.       # Double-quote args containing other shell metacharacters.
  269.       # Many Bourne shells cannot handle close brackets correctly in scan
  270.       # sets, so we specify it separately.
  271.       case "$lastarg" in
  272.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  273.     lastarg="\"$lastarg\""
  274.     ;;
  275.       esac
  276.  
  277.       # Add the previous argument to base_compile.
  278.       if test -z "$base_compile"; then
  279.     base_compile="$lastarg"
  280.       else
  281.     base_compile="$base_compile $lastarg"
  282.       fi
  283.     done
  284.  
  285.     # Get the name of the library object.
  286.     libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  287.  
  288.     # Recognize several different file suffixes.
  289.     xform='[cCFSfms]'
  290.     case "$libobj" in
  291.     *.ada) xform=ada ;;
  292.     *.adb) xform=adb ;;
  293.     *.ads) xform=ads ;;
  294.     *.asm) xform=asm ;;
  295.     *.c++) xform=c++ ;;
  296.     *.cc) xform=cc ;;
  297.     *.cpp) xform=cpp ;;
  298.     *.cxx) xform=cxx ;;
  299.     *.f90) xform=f90 ;;
  300.     *.for) xform=for ;;
  301.     esac
  302.  
  303.     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  304.  
  305.     case "$libobj" in
  306.     *.lo) obj=`$echo "X$libobj" | $Xsed -e 's/\.lo$/.o/'` ;;
  307.     *)
  308.       $echo "$modename: cannot determine name of library object from \`$srcfile'" 1>&2
  309.       exit 1
  310.       ;;
  311.     esac
  312.  
  313.     if test -z "$base_compile"; then
  314.       $echo "$modename: you must specify a compilation command" 1>&2
  315.       $echo "$help" 1>&2
  316.       exit 1
  317.     fi
  318.  
  319.     # Delete any leftover library objects.
  320.     if test "$build_old_libs" = yes; then
  321.       $run $rm $obj $libobj
  322.       trap "$run $rm $obj $libobj; exit 1" 1 2 15
  323.     else
  324.       $run $rm $libobj
  325.       trap "$run $rm $libobj; exit 1" 1 2 15
  326.     fi
  327.  
  328.     # Only build a PIC object if we are building libtool libraries.
  329.     if test "$build_libtool_libs" = yes; then
  330.       # Without this assignment, base_compile gets emptied.
  331.       fbsd_hideous_sh_bug=$base_compile
  332.  
  333.       # All platforms use -DPIC, to notify preprocessed assembler code.
  334.       $show "$base_compile$pic_flag -DPIC $srcfile"
  335.       if $run eval "$base_compile\$pic_flag -DPIC \$srcfile"; then :
  336.       else
  337.         test -n "$obj" && $run $rm $obj
  338.         exit 1
  339.       fi
  340.  
  341.       # If we have no pic_flag, then copy the object into place and finish.
  342.       if test -z "$pic_flag"; then
  343.         $show "$LN_S $obj $libobj"
  344.         $run $LN_S $obj $libobj
  345.         exit $?
  346.       fi
  347.  
  348.       # Just move the object, then go on to compile the next one
  349.       $show "$mv $obj $libobj"
  350.       $run $mv $obj $libobj || exit 1
  351.  
  352.       # Allow error messages only from the first compilation.
  353.       suppress_output=' >/dev/null 2>&1'
  354.     fi
  355.  
  356.     # Only build a position-dependent object if we build old libraries.
  357.     if test "$build_old_libs" = yes; then
  358.       # Suppress compiler output if we already did a PIC compilation.
  359.       $show "$base_compile $srcfile$suppress_output"
  360.       if $run eval "$base_compile \$srcfile$suppress_output"; then :
  361.       else
  362.         $run $rm $obj $libobj
  363.         exit 1
  364.       fi
  365.     fi
  366.  
  367.     # Create an invalid libtool object if no PIC, so that we do not
  368.     # accidentally link it into a program.
  369.     if test "$build_libtool_libs" != yes; then
  370.       $show "echo timestamp > $libobj"
  371.       $run eval "echo timestamp > \$libobj" || exit $?
  372.     fi
  373.  
  374.     exit 0
  375.     ;;
  376.  
  377.   # libtool link mode
  378.   link)
  379.     modename="$modename: link"
  380.     CC="$nonopt"
  381.     allow_undefined=yes
  382.     compile_command="$CC"
  383.     finalize_command="$CC"
  384.  
  385.     compile_shlibpath=
  386.     finalize_shlibpath=
  387.     deplibs=
  388.     dlfiles=
  389.     dlprefiles=
  390.     export_dynamic=no
  391.     hardcode_libdirs=
  392.     libobjs=
  393.     link_against_libtool_libs=
  394.     ltlibs=
  395.     objs=
  396.     prev=
  397.     prevarg=
  398.     release=
  399.     rpath=
  400.     perm_rpath=
  401.     temp_rpath=
  402.     vinfo=
  403.  
  404.     # We need to know -static, to get the right output filenames.
  405.     for arg
  406.     do
  407.       case "$arg" in
  408.       -all-static | -static)
  409.         if test "X$arg" = "X-all-static" && test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  410.         $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  411.         fi
  412.         build_libtool_libs=no
  413.     build_old_libs=yes
  414.         break
  415.         ;;
  416.       esac
  417.     done
  418.  
  419.     # See if our shared archives depend on static archives.
  420.     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  421.  
  422.     # Go through the arguments, transforming them on the way.
  423.     for arg
  424.     do
  425.       # If the previous option needs an argument, assign it.
  426.       if test -n "$prev"; then
  427.         case "$prev" in
  428.         output)
  429.           compile_command="$compile_command @OUTPUT@"
  430.           finalize_command="$finalize_command @OUTPUT@"
  431.           ;;
  432.         esac
  433.  
  434.         case "$prev" in
  435.         dlfiles|dlprefiles)
  436.           case "$arg" in
  437.           *.la | *.lo) ;;  # We handle these cases below.
  438.           *)
  439.             dlprefiles="$dlprefiles $arg"
  440.             test "$prev" = dlfiles && dlfiles="$dlfiles $arg"
  441.             prev=
  442.             ;;
  443.           esac
  444.           ;;
  445.     release)
  446.       release="-$arg"
  447.       prev=
  448.       continue
  449.       ;;
  450.         rpath)
  451.           rpath="$rpath $arg"
  452.       prev=
  453.       continue
  454.       ;;
  455.         *)
  456.           eval "$prev=\"\$arg\""
  457.           prev=
  458.           continue
  459.           ;;
  460.         esac
  461.       fi
  462.  
  463.       prevarg="$arg"
  464.  
  465.       case "$arg" in
  466.       -all-static)
  467.     if test -n "$link_static_flag"; then
  468.           compile_command="$compile_command $link_static_flag"
  469.       finalize_command="$finalize_command $link_static_flag"
  470.         fi
  471.         continue
  472.     ;;
  473.  
  474.       -allow-undefined)
  475.     # FIXME: remove this flag sometime in the future.
  476.     $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  477.     continue
  478.     ;;
  479.  
  480.       -dlopen)
  481.         prev=dlfiles
  482.         continue
  483.         ;;
  484.  
  485.       -dlpreopen)
  486.         prev=dlprefiles
  487.         continue
  488.         ;;
  489.  
  490.       -export-dynamic)
  491.         if test "$export_dynamic" != yes; then
  492.           export_dynamic=yes
  493.       if test -n "$export_dynamic_flag_spec"; then
  494.         eval arg=\"$export_dynamic_flag_spec\"
  495.       else
  496.         arg=
  497.       fi
  498.  
  499.           # Add the symbol object into the linking commands.
  500.       compile_command="$compile_command @SYMFILE@"
  501.       finalize_command="$finalize_command @SYMFILE@"
  502.         fi
  503.         ;;
  504.  
  505.       -L*)
  506.         dir=`$echo "X$arg" | $Xsed -e 's%^-L\(.*\)$%\1%'`
  507.         case "$dir" in
  508.         /* | [A-Za-z]:\\*)
  509.       # Add the corresponding hardcode_libdir_flag, if it is not identical.
  510.           ;;
  511.         *)
  512.           $echo "$modename: \`-L$dir' cannot specify a relative directory" 1>&2
  513.           exit 1
  514.           ;;
  515.         esac
  516.         deplibs="$deplibs $arg"
  517.         ;;
  518.  
  519.       -l*) deplibs="$deplibs $arg" ;;
  520.  
  521.       -no-undefined)
  522.     allow_undefined=no
  523.     continue
  524.     ;;
  525.  
  526.       -o) prev=output ;;
  527.  
  528.       -release)
  529.     prev=release
  530.     continue
  531.     ;;
  532.  
  533.       -rpath)
  534.         prev=rpath
  535.         continue
  536.         ;;
  537.  
  538.       -static)
  539.     # If we have no pic_flag, then this is the same as -all-static.
  540.     if test -z "$pic_flag" && test -n "$link_static_flag"; then
  541.           compile_command="$compile_command $link_static_flag"
  542.       finalize_command="$finalize_command $link_static_flag"
  543.         fi
  544.     continue
  545.     ;;
  546.  
  547.       -version-info)
  548.         prev=vinfo
  549.         continue
  550.         ;;
  551.  
  552.       # Some other compiler flag.
  553.       -* | +*)
  554.     # Unknown arguments in both finalize_command and compile_command need
  555.     # to be aesthetically quoted because they are evaled later.
  556.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  557.     case "$arg" in
  558.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  559.       arg="\"$arg\""
  560.       ;;
  561.     esac
  562.         ;;
  563.  
  564.       *.o | *.a)
  565.         # A standard object.
  566.         objs="$objs $arg"
  567.         ;;
  568.  
  569.       *.lo)
  570.         # A library object.
  571.     if test "$prev" = dlfiles; then
  572.       dlfiles="$dlfiles $arg"
  573.       if test "$build_libtool_libs" = yes; then
  574.         prev=
  575.         continue
  576.       else
  577.         # If libtool objects are unsupported, then we need to preload.
  578.         prev=dlprefiles
  579.       fi
  580.     fi
  581.  
  582.     if test "$prev" = dlprefiles; then
  583.       # Preload the old-style object.
  584.       dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e 's/\.lo$/.o/'`
  585.       prev=
  586.     fi
  587.     libobjs="$libobjs $arg"
  588.         ;;
  589.  
  590.       *.la)
  591.         # A libtool-controlled library.
  592.  
  593.         dlname=
  594.         libdir=
  595.         library_names=
  596.         old_library=
  597.  
  598.         # Check to see that this really is a libtool archive.
  599.         if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  600.         else
  601.           $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  602.           exit 1
  603.         fi
  604.  
  605.         # If there is no directory component, then add one.
  606.         case "$arg" in
  607.         */* | *\\*) . $arg ;;
  608.         *) . ./$arg ;;
  609.         esac
  610.  
  611.         if test -z "$libdir"; then
  612.           $echo "$modename: \`$arg' contains no -rpath information" 1>&2
  613.           exit 1
  614.         fi
  615.  
  616.         # Get the name of the library we link against.
  617.         linklib=
  618.         for l in $old_library $library_names; do
  619.           linklib="$l"
  620.         done
  621.  
  622.         if test -z "$linklib"; then
  623.           $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  624.           exit 1
  625.         fi
  626.  
  627.         # Find the relevant object directory and library name.
  628.         name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  629.         dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  630.         if test "X$dir" = "X$arg"; then
  631.           dir="$objdir"
  632.         else
  633.           dir="$dir/$objdir"
  634.         fi
  635.  
  636.         # This library was specified with -dlopen.
  637.         if test "$prev" = dlfiles; then
  638.           dlfiles="$dlfiles $arg"
  639.           if test -z "$dlname"; then
  640.             # If there is no dlname, we need to preload.
  641.             prev=dlprefiles
  642.           else
  643.             # We should not create a dependency on this library, but we
  644.         # may need any libraries it requires.
  645.         compile_command="$compile_command$dependency_libs"
  646.         finalize_command="$finalize_command$dependency_libs"
  647.             prev=
  648.             continue
  649.           fi
  650.         fi
  651.  
  652.         # The library was specified with -dlpreopen.
  653.         if test "$prev" = dlprefiles; then
  654.           # Prefer using a static library (so that no silly _DYNAMIC symbols
  655.           # are required to link).
  656.           if test -n "$old_library"; then
  657.             dlprefiles="$dlprefiles $dir/$old_library"
  658.           else
  659.             dlprefiles="$dlprefiles $dir/$linklib"
  660.           fi
  661.           prev=
  662.         fi
  663.  
  664.         if test "$build_libtool_libs" = yes && test -n "$library_names"; then
  665.           link_against_libtool_libs="$link_against_libtool_libs $arg"
  666.           if test -n "$shlibpath_var"; then
  667.             # Make sure the rpath contains only unique directories.
  668.             case "$temp_rpath " in
  669.             *" $dir "*) ;;
  670.             *) temp_rpath="$temp_rpath $dir" ;;
  671.             esac
  672.           fi
  673.  
  674.       # This is the magic to use -rpath.
  675.           if test -n "$hardcode_libdir_flag_spec"; then
  676.             if test -n "$hardcode_libdir_separator"; then
  677.               if test -z "$hardcode_libdirs"; then
  678.                 # Put the magic libdir with the hardcode flag.
  679.                 hardcode_libdirs="$libdir"
  680.                 libdir="@HARDCODE_LIBDIRS@"
  681.               else
  682.                 # Just accumulate the unique libdirs.
  683.         case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  684.         *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  685.           ;;
  686.         *)
  687.           hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  688.           ;;
  689.         esac
  690.                 libdir=
  691.               fi
  692.             fi
  693.  
  694.             if test -n "$libdir"; then
  695.               eval flag=\"$hardcode_libdir_flag_spec\"
  696.  
  697.               compile_command="$compile_command $flag"
  698.               finalize_command="$finalize_command $flag"
  699.             fi
  700.           elif test -n "$runpath_var"; then
  701.             # Do the same for the permanent run path.
  702.             case "$perm_rpath " in
  703.             *" $libdir "*) ;;
  704.             *) perm_rpath="$perm_rpath $libdir" ;;
  705.             esac
  706.           fi
  707.  
  708.  
  709.           case "$hardcode_action" in
  710.           immediate)
  711.             if test "$hardcode_direct" = no; then
  712.               compile_command="$compile_command $dir/$linklib"
  713.             elif test "$hardcode_minus_L" = no; then
  714.               compile_command="$compile_command -L$dir -l$name"
  715.             elif test "$hardcode_shlibpath_var" = no; then
  716.               compile_shlibpath="$compile_shlibpath$dir:"
  717.               compile_command="$compile_command -l$name"
  718.             fi
  719.             ;;
  720.  
  721.           relink)
  722.             # We need an absolute path.
  723.             case "$dir" in
  724.             /* | [A-Za-z]:\\*) ;;
  725.             *)
  726.               absdir=`cd "$dir" && pwd`
  727.               if test -z "$absdir"; then
  728.                 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  729.                 exit 1
  730.               fi
  731.               dir="$absdir"
  732.               ;;
  733.             esac
  734.  
  735.             if test "$hardcode_direct" = yes; then
  736.               compile_command="$compile_command $dir/$linklib"
  737.             elif test "$hardcode_minus_L" = yes; then
  738.               compile_command="$compile_command -L$dir -l$name"
  739.             elif test "$hardcode_shlibpath_var" = yes; then
  740.               compile_shlibpath="$compile_shlibpath$dir:"
  741.               compile_command="$compile_command -l$name"
  742.             fi
  743.             ;;
  744.           esac
  745.  
  746.           # Finalize command for both is simple: just hardcode it.
  747.           if test "$hardcode_direct" = yes; then
  748.             finalize_command="$finalize_command $libdir/$linklib"
  749.           elif test "$hardcode_minus_L" = yes; then
  750.             finalize_command="$finalize_command -L$libdir -l$name"
  751.           elif test "$hardcode_shlibpath_var" = yes; then
  752.             finalize_shlibpath="$finalize_shlibpath$libdir:"
  753.             finalize_command="$finalize_command -l$name"
  754.           else
  755.             # We cannot seem to hardcode it, guess we'll fake it.
  756.             finalize_command="$finalize_command -L$libdir -l$name"
  757.           fi
  758.         else
  759.           # Transform directly to old archives if we don't build new libraries.
  760.           if test -n "$pic_flag" && test -z "$old_library"; then
  761.             $echo "$modename: cannot find static library for \`$arg'" 1>&2
  762.             exit 1
  763.           fi
  764.  
  765.       # Here we assume that one of hardcode_direct or hardcode_minus_L
  766.       # is not unsupported.  This is valid on all known static and
  767.       # shared platforms.
  768.       if test "$hardcode_direct" != unsupported; then
  769.         test -n "$old_library" && linklib="$old_library"
  770.         compile_command="$compile_command $dir/$linklib"
  771.         finalize_command="$finalize_command $dir/$linklib"
  772.       else
  773.         compile_command="$compile_command -L$dir -l$name"
  774.         finalize_command="$finalize_command -L$dir -l$name"
  775.       fi
  776.         fi
  777.  
  778.     # Add in any libraries that this one depends upon.
  779.     compile_command="$compile_command$dependency_libs"
  780.     finalize_command="$finalize_command$dependency_libs"
  781.     continue
  782.         ;;
  783.  
  784.       # Some other compiler argument.
  785.       *)
  786.     # Unknown arguments in both finalize_command and compile_command need
  787.     # to be aesthetically quoted because they are evaled later.
  788.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  789.     case "$arg" in
  790.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  791.       arg="\"$arg\""
  792.       ;;
  793.     esac
  794.         ;;
  795.       esac
  796.  
  797.       # Now actually substitute the argument into the commands.
  798.       if test -n "$arg"; then
  799.     compile_command="$compile_command $arg"
  800.     finalize_command="$finalize_command $arg"
  801.       fi
  802.     done
  803.  
  804.     if test -n "$prev"; then
  805.       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  806.       $echo "$help" 1>&2
  807.       exit 1
  808.     fi
  809.  
  810.     if test -n "$vinfo" && test -n "$release"; then
  811.       $echo "$modename: you cannot specify both \`-version-info' and \`-release'" 1>&2
  812.       $echo "$help" 1>&2
  813.       exit 1
  814.     fi
  815.  
  816.     oldlib=
  817.     oldobjs=
  818.     case "$output" in
  819.     "")
  820.       $echo "$modename: you must specify an output file" 1>&2
  821.       $echo "$help" 1>&2
  822.       exit 1
  823.       ;;
  824.  
  825.     */* | *\\*)
  826.       $echo "$modename: output file \`$output' must have no directory components" 1>&2
  827.       exit 1
  828.       ;;
  829.  
  830.     *.a)
  831.       # Now set the variables for building old libraries.
  832.       build_libtool_libs=no
  833.       build_old_libs=yes
  834.       oldlib="$output"
  835.       $show "$rm $oldlib"
  836.       $run $rm $oldlib
  837.       ;;
  838.  
  839.     *.la)
  840.       # Make sure we only generate libraries of the form `libNAME.la'.
  841.       case "$output" in
  842.       lib*) ;;
  843.       *)
  844.     $echo "$modename: libtool library \`$arg' must begin with \`lib'" 1>&2
  845.     $echo "$help" 1>&2
  846.     exit 1
  847.     ;;
  848.       esac
  849.  
  850.       name=`$echo "X$output" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  851.       eval libname=\"$libname_spec\"
  852.  
  853.       # All the library-specific variables (install_libdir is set above).
  854.       library_names=
  855.       old_library=
  856.       dlname=
  857.       current=0
  858.       revision=0
  859.       age=0
  860.  
  861.       if test -n "$objs"; then
  862.         $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  863.         exit 1
  864.       fi
  865.  
  866.       # How the heck are we supposed to write a wrapper for a shared library?
  867.       if test -n "$link_against_libtool_libs"; then
  868.         $echo "$modename: libtool library \`$output' may not depend on uninstalled libraries:$link_against_libtool_libs" 1>&2
  869.         exit 1
  870.       fi
  871.  
  872.       if test -n "$dlfiles$dlprefiles"; then
  873.         $echo "$modename: warning: \`-dlopen' is ignored while creating libtool libraries" 1>&2
  874.         # Nullify the symbol file.
  875.         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  876.         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  877.       fi
  878.  
  879.       if test -z "$rpath"; then
  880.         $echo "$modename: you must specify an installation directory with \`-rpath'" 1>&2
  881.     $echo "$help" 1>&2
  882.         exit 1
  883.       fi
  884.  
  885.       set dummy $rpath
  886.       if test $# -gt 2; then
  887.     $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  888.       fi
  889.       install_libdir="$2"
  890.  
  891.       # Parse the version information argument.
  892.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
  893.       set dummy $vinfo
  894.       IFS="$save_ifs"
  895.  
  896.       if test -n "$5"; then
  897.         $echo "$modename: too many parameters to \`-version-info'" 1>&2
  898.         $echo "$help" 1>&2
  899.         exit 1
  900.       fi
  901.  
  902.       test -n "$2" && current="$2"
  903.       test -n "$3" && revision="$3"
  904.       test -n "$4" && age="$4"
  905.  
  906.       # Check that each of the things are valid numbers.
  907.       case "$current" in
  908.       0 | [1-9] | [1-9][0-9]*) ;;
  909.       *)
  910.         $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  911.         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  912.         exit 1
  913.         ;;
  914.       esac
  915.  
  916.       case "$revision" in
  917.       0 | [1-9] | [1-9][0-9]*) ;;
  918.       *)
  919.         $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  920.         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  921.         exit 1
  922.         ;;
  923.       esac
  924.  
  925.       case "$age" in
  926.       0 | [1-9] | [1-9][0-9]*) ;;
  927.       *)
  928.         $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  929.         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  930.         exit 1
  931.         ;;
  932.       esac
  933.  
  934.       if test $age -gt $current; then
  935.         $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  936.         $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  937.         exit 1
  938.       fi
  939.  
  940.       # Calculate the version variables.
  941.       version_vars="version_type current age revision"
  942.       case "$version_type" in
  943.       none) ;;
  944.  
  945.       linux)
  946.         version_vars="$version_vars major versuffix"
  947.         major=`expr $current - $age`
  948.         versuffix="$major.$age.$revision"
  949.         ;;
  950.  
  951.       osf)
  952.         version_vars="$version_vars versuffix verstring"
  953.         major=`expr $current - $age`
  954.         versuffix="$current.$age.$revision"
  955.         verstring="$versuffix"
  956.  
  957.         # Add in all the interfaces that we are compatible with.
  958.         loop=$age
  959.         while test $loop != 0; do
  960.           iface=`expr $current - $loop`
  961.           loop=`expr $loop - 1`
  962.           verstring="$verstring:${iface}.0"
  963.         done
  964.  
  965.         # Make executables depend on our current version.
  966.         verstring="$verstring:${current}.0"
  967.         ;;
  968.  
  969.       sunos)
  970.         version_vars="$version_vars major versuffix"
  971.         major="$current"
  972.         versuffix="$current.$revision"
  973.         ;;
  974.  
  975.       *)
  976.         $echo "$modename: unknown library version type \`$version_type'" 1>&2
  977.         echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  978.         exit 1
  979.         ;;
  980.       esac
  981.  
  982.       # Create the output directory, or remove our outputs if we need to.
  983.       if test -d $objdir; then
  984.         $show "$rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*"
  985.         $run $rm $objdir/$output $objdir/$libname.* $objdir/${libname}${release}.*
  986.       else
  987.         $show "$mkdir $objdir"
  988.         $run $mkdir $objdir
  989.     status=$?
  990.     if test $status -eq 0 || test -d $objdir; then :
  991.     else
  992.       exit $status
  993.     fi
  994.       fi
  995.  
  996.       # Check to see if the archive will have undefined symbols.
  997.       if test "$allow_undefined" = yes; then
  998.         if test "$allow_undefined_flag" = unsupported; then
  999.           $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1000.           build_libtool_libs=no
  1001.       build_old_libs=yes
  1002.         fi
  1003.       else
  1004.         # Don't allow undefined symbols.
  1005.         allow_undefined_flag="$no_undefined_flag"
  1006.       fi
  1007.  
  1008.       # Add libc to deplibs on all systems.
  1009.       dependency_libs="$deplibs"
  1010.       deplibs="$deplibs -lc"
  1011.  
  1012.       if test "$build_libtool_libs" = yes; then
  1013.         # Get the real and link names of the library.
  1014.         eval library_names=\"$library_names_spec\"
  1015.         set dummy $library_names
  1016.         realname="$2"
  1017.         shift; shift
  1018.  
  1019.         if test -n "$soname_spec"; then
  1020.           eval soname=\"$soname_spec\"
  1021.         else
  1022.           soname="$realname"
  1023.         fi
  1024.  
  1025.         lib="$objdir/$realname"
  1026.     for link
  1027.     do
  1028.       linknames="$linknames $link"
  1029.     done
  1030.  
  1031.         # Use standard objects if they are PIC.
  1032.         test -z "$pic_flag" && libobjs=`$echo "X$libobjs " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//g'`
  1033.  
  1034.         # Do each of the archive commands.
  1035.         eval cmds=\"$archive_cmds\"
  1036.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1037.         for cmd in $cmds; do
  1038.           IFS="$save_ifs"
  1039.           $show "$cmd"
  1040.           $run eval "$cmd" || exit $?
  1041.         done
  1042.         IFS="$save_ifs"
  1043.  
  1044.         # Create links to the real library.
  1045.         for linkname in $linknames; do
  1046.           $show "(cd $objdir && $LN_S $realname $linkname)"
  1047.           $run eval '(cd $objdir && $LN_S $realname $linkname)' || exit $?
  1048.         done
  1049.  
  1050.         # If -export-dynamic was specified, set the dlname.
  1051.         if test "$export_dynamic" = yes; then
  1052.           # On all known operating systems, these are identical.
  1053.           dlname="$soname"
  1054.         fi
  1055.       fi
  1056.  
  1057.       # Now set the variables for building old libraries.
  1058.       oldlib="$objdir/$libname.a"
  1059.       ;;
  1060.  
  1061.     *.lo | *.o)
  1062.       if test -n "$link_against_libtool_libs"; then
  1063.         $echo "$modename: error: cannot link libtool libraries into reloadable objects" 1>&2
  1064.         exit 1
  1065.       fi
  1066.  
  1067.       if test -n "$deplibs"; then
  1068.         $echo "$modename: warning: \`-l' and \`-L' are ignored while creating objects" 1>&2
  1069.       fi
  1070.  
  1071.       if test -n "$dlfiles$dlprefiles"; then
  1072.         $echo "$modename: warning: \`-dlopen' is ignored while creating objects" 1>&2
  1073.         # Nullify the symbol file.
  1074.         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  1075.         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  1076.       fi
  1077.  
  1078.       if test -n "$rpath"; then
  1079.         $echo "$modename: warning: \`-rpath' is ignored while creating objects" 1>&2
  1080.       fi
  1081.  
  1082.       if test -n "$vinfo"; then
  1083.         $echo "$modename: warning: \`-version-info' is ignored while creating objects" 1>&2
  1084.       fi
  1085.  
  1086.       if test -n "$release"; then
  1087.         $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
  1088.       fi
  1089.  
  1090.       case "$output" in
  1091.       *.lo)
  1092.         if test -n "$objs"; then
  1093.           $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  1094.           exit 1
  1095.         fi
  1096.         libobj="$output"
  1097.         obj=`$echo "X$output" | $Xsed -e 's/\.lo$/.o/'`
  1098.         ;;
  1099.       *)
  1100.         libobj=
  1101.         obj="$output"
  1102.         ;;
  1103.       esac
  1104.  
  1105.       # Delete the old objects.
  1106.       $run $rm $obj $libobj
  1107.  
  1108.       # Create the old-style object.
  1109.       reload_objs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^       ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
  1110.  
  1111.       output="$obj"
  1112.       eval cmds=\"$reload_cmds\"
  1113.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1114.       for cmd in $cmds; do
  1115.         IFS="$save_ifs"
  1116.         $show "$cmd"
  1117.         $run eval "$cmd" || exit $?
  1118.       done
  1119.       IFS="$save_ifs"
  1120.  
  1121.       # Exit if we aren't doing a library object file.
  1122.       test -z "$libobj" && exit 0
  1123.  
  1124.       if test "$build_libtool_libs" != yes; then
  1125.         # Create an invalid libtool object if no PIC, so that we don't
  1126.         # accidentally link it into a program.
  1127.         $show "echo timestamp > $libobj"
  1128.         $run eval "echo timestamp > $libobj" || exit $?
  1129.         exit 0
  1130.       fi
  1131.  
  1132.       if test -n "$pic_flag"; then
  1133.         # Only do commands if we really have different PIC objects.
  1134.         reload_objs="$libobjs"
  1135.         output="$libobj"
  1136.         eval cmds=\"$reload_cmds\"
  1137.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1138.         for cmd in $cmds; do
  1139.           IFS="$save_ifs"
  1140.           $show "$cmd"
  1141.           $run eval "$cmd" || exit $?
  1142.         done
  1143.         IFS="$save_ifs"
  1144.       else
  1145.         # Just create a symlink.
  1146.         $show "$LN_S $obj $libobj"
  1147.         $run $LN_S $obj $libobj || exit 1
  1148.       fi
  1149.  
  1150.       exit 0
  1151.       ;;
  1152.  
  1153.     *)
  1154.       if test -n "$vinfo"; then
  1155.         $echo "$modename: warning: \`-version-info' is ignored while linking programs" 1>&2
  1156.       fi
  1157.  
  1158.       if test -n "$release"; then
  1159.         $echo "$modename: warning: \`-release' is ignored while creating objects" 1>&2
  1160.       fi
  1161.  
  1162.       if test -n "$rpath"; then
  1163.     # If the user specified any rpath flags, then add them.
  1164.     for libdir in $rpath; do
  1165.           if test -n "$hardcode_libdir_flag_spec"; then
  1166.             if test -n "$hardcode_libdir_separator"; then
  1167.               if test -z "$hardcode_libdirs"; then
  1168.                 # Put the magic libdir with the hardcode flag.
  1169.                 hardcode_libdirs="$libdir"
  1170.                 libdir="@HARDCODE_LIBDIRS@"
  1171.               else
  1172.                 # Just accumulate the unique libdirs.
  1173.         case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  1174.         *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  1175.           ;;
  1176.         *)
  1177.           hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  1178.           ;;
  1179.         esac
  1180.                 libdir=
  1181.               fi
  1182.             fi
  1183.  
  1184.             if test -n "$libdir"; then
  1185.               eval flag=\"$hardcode_libdir_flag_spec\"
  1186.  
  1187.               compile_command="$compile_command $flag"
  1188.               finalize_command="$finalize_command $flag"
  1189.             fi
  1190.           elif test -n "$runpath_var"; then
  1191.             case "$perm_rpath " in
  1192.             *" $libdir "*) ;;
  1193.             *) perm_rpath="$perm_rpath $libdir" ;;
  1194.             esac
  1195.           fi
  1196.     done
  1197.       fi
  1198.  
  1199.       # Substitute the hardcoded libdirs into the compile commands.
  1200.       if test -n "$hardcode_libdir_separator"; then
  1201.     compile_command=`$echo "X$compile_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
  1202.     finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@HARDCODE_LIBDIRS@%$hardcode_libdirs%g"`
  1203.       fi
  1204.  
  1205.       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  1206.         # Transform all the library objects into standard objects.
  1207.         compile_command=`$echo "X$compile_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1208.         finalize_command=`$echo "X$finalize_command " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1209.       fi
  1210.  
  1211.       if test "$export_dynamic" = yes && test -n "$NM" && test -n "$global_symbol_pipe"; then
  1212.         dlsyms="${output}S.c"
  1213.       else
  1214.         dlsyms=
  1215.       fi
  1216.  
  1217.       if test -n "$dlsyms"; then
  1218.         # Add our own program objects to the preloaded list.
  1219.         dlprefiles=`$echo "X$objs$dlprefiles " | $Xsed -e 's/\.lo /.o /g' -e 's/ $//'`
  1220.  
  1221.     # Discover the nlist of each of the dlfiles.
  1222.         nlist="$objdir/${output}.nm"
  1223.  
  1224.     if test -d $objdir; then
  1225.       $show "$rm $nlist ${nlist}T"
  1226.       $run $rm "$nlist" "${nlist}T"
  1227.     else
  1228.       $show "$mkdir $objdir"
  1229.       $run $mkdir $objdir
  1230.       status=$?
  1231.       if test $status -eq 0 || test -d $objdir; then :
  1232.       else
  1233.         exit $status
  1234.       fi
  1235.     fi
  1236.  
  1237.         for arg in $dlprefiles; do
  1238.       $show "extracting global C symbols from \`$arg'"
  1239.       $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  1240.         done
  1241.  
  1242.         # Parse the name list into a source file.
  1243.         $show "creating $objdir/$dlsyms"
  1244.         if test -z "$run"; then
  1245.       # Make sure we at least have an empty file.
  1246.       test -f "$nlist" || : > "$nlist"
  1247.  
  1248.       # Try sorting and uniquifying the output.
  1249.       if sort "$nlist" | uniq > "$nlist"T; then
  1250.         mv -f "$nlist"T "$nlist"
  1251.         wcout=`wc "$nlist" 2>/dev/null`
  1252.         count=`echo "X$wcout" | $Xsed -e 's/^[     ]*\([0-9][0-9]*\).*$/\1/'`
  1253.         (test "$count" -ge 0) 2>/dev/null || count=-1
  1254.       else
  1255.         $rm "$nlist"T
  1256.         count=-1
  1257.       fi
  1258.  
  1259.       case "$dlsyms" in
  1260.       "") ;;
  1261.       *.c)
  1262.         $echo > "$objdir/$dlsyms" "\
  1263. /* $dlsyms - symbol resolution table for \`$output' dlsym emulation. */
  1264. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION */
  1265.  
  1266. #ifdef __cplusplus
  1267. extern \"C\" {
  1268. #endif
  1269.  
  1270. /* Prevent the only kind of declaration conflicts we can make. */
  1271. #define dld_preloaded_symbol_count some_other_symbol
  1272. #define dld_preloaded_symbols some_other_symbol
  1273.  
  1274. /* External symbol declarations for the compiler. */\
  1275. "
  1276.  
  1277.         if test -f "$nlist"; then
  1278.           sed -e 's/^.* \(.*\)$/extern char \1;/' < "$nlist" >> "$objdir/$dlsyms"
  1279.         else
  1280.           echo '/* NONE */' >> "$objdir/$dlsyms"
  1281.         fi
  1282.  
  1283.         $echo >> "$objdir/$dlsyms" "\
  1284.  
  1285. #undef dld_preloaded_symbol_count
  1286. #undef dld_preloaded_symbols
  1287.  
  1288. #if defined (__STDC__) && __STDC__
  1289. # define __ptr_t void *
  1290. #else
  1291. # define __ptr_t char *
  1292. #endif
  1293.  
  1294. /* The number of symbols in dld_preloaded_symbols, -1 if unsorted. */
  1295. int dld_preloaded_symbol_count = $count;
  1296.  
  1297. /* The mapping between symbol names and symbols. */
  1298. struct {
  1299.   char *name;
  1300.   __ptr_t address;
  1301. }
  1302. dld_preloaded_symbols[] =
  1303. {\
  1304. "
  1305.  
  1306.         if test -f "$nlist"; then
  1307.           sed 's/^\(.*\) \(.*\)$/  {"\1", (__ptr_t) \&\2},/' < "$nlist" >> "$objdir/$dlsyms"
  1308.         fi
  1309.  
  1310.         $echo >> "$objdir/$dlsyms" "\
  1311.   {0, (__ptr_t) 0}
  1312. };
  1313.  
  1314. #ifdef __cplusplus
  1315. }
  1316. #endif\
  1317. "
  1318.         ;;
  1319.  
  1320.       *)
  1321.         $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  1322.         exit 1
  1323.         ;;
  1324.       esac
  1325.         fi
  1326.  
  1327.         # Now compile the dynamic symbol file.
  1328.         $show "(cd $objdir && $CC -c$no_builtin_flag \"$dlsyms\")"
  1329.         $run eval '(cd $objdir && $CC -c$no_builtin_flag "$dlsyms")' || exit $?
  1330.  
  1331.         # Transform the symbol file into the correct name.
  1332.         compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
  1333.         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$objdir/${output}S.o%"`
  1334.       elif test "$export_dynamic" != yes; then
  1335.         test -n "$dlfiles$dlprefiles" && $echo "$modename: warning: \`-dlopen' and \`-dlpreopen' are ignored without \`-export-dynamic'" 1>&2
  1336.       else
  1337.         # We keep going just in case the user didn't refer to
  1338.         # dld_preloaded_symbols.  The linker will fail if global_symbol_pipe
  1339.         # really was required.
  1340.         $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  1341.  
  1342.         # Nullify the symbol file.
  1343.         compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  1344.         finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  1345.       fi
  1346.  
  1347.       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  1348.         # Replace the output file specification.
  1349.         compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1350.         finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  1351.  
  1352.         # We have no uninstalled library dependencies, so finalize right now.
  1353.         $show "$compile_command"
  1354.         $run eval "$compile_command"
  1355.         exit $?
  1356.       fi
  1357.  
  1358.       # Replace the output file specification.
  1359.       compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'%g'`
  1360.       finalize_command=`$echo "X$finalize_command" | $Xsed -e 's%@OUTPUT@%'"$objdir/$output"'T%g'`
  1361.  
  1362.       # Create the binary in the object directory, then wrap it.
  1363.       if test -d $objdir; then :
  1364.       else
  1365.         $show "$mkdir $objdir"
  1366.     $run $mkdir $objdir
  1367.     status=$?
  1368.     if test $status -eq 0 || test -d $objdir; then :
  1369.     else
  1370.       exit $status
  1371.     fi
  1372.       fi
  1373.  
  1374.       if test -n "$shlibpath_var"; then
  1375.         # We should set the shlibpath_var
  1376.         rpath=
  1377.         for dir in $temp_rpath; do
  1378.           case "$dir" in
  1379.           /* | [A-Za-z]:\\*)
  1380.             # Absolute path.
  1381.             rpath="$rpath$dir:"
  1382.             ;;
  1383.           *)
  1384.             # Relative path: add a thisdir entry.
  1385.             rpath="$rpath\$thisdir/$dir:"
  1386.             ;;
  1387.           esac
  1388.         done
  1389.         temp_rpath="$rpath"
  1390.       fi
  1391.  
  1392.       # Delete the old output file.
  1393.       $run $rm $output
  1394.  
  1395.       if test -n "$compile_shlibpath"; then
  1396.         compile_command="$shlibpath_var=\"$compile_shlibpath\$$shlibpath_var\" $compile_command"
  1397.       fi
  1398.       if test -n "$finalize_shlibpath"; then
  1399.         finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  1400.       fi
  1401.  
  1402.       if test -n "$runpath_var" && test -n "$perm_rpath"; then
  1403.         # We should set the runpath_var.
  1404.         rpath=
  1405.         for dir in $perm_rpath; do
  1406.           rpath="$rpath$dir:"
  1407.         done
  1408.         compile_command="$runpath_var=\"$rpath\$$runpath_var\" $compile_command"
  1409.         finalize_command="$runpath_var=\"$rpath\$$runpath_var\" $finalize_command"
  1410.       fi
  1411.  
  1412.       if test "$hardcode_action" = relink; then
  1413.         # AGH! Flame the AIX and HP-UX people for me, will ya?
  1414.         $echo "$modename: warning: using a buggy system linker" 1>&2
  1415.         $echo "$modename: relinking will be required before \`$output' can be installed" 1>&2
  1416.       fi
  1417.  
  1418.       $show "$compile_command"
  1419.       $run eval "$compile_command" || exit $?
  1420.  
  1421.       # Now create the wrapper script.
  1422.       $show "creating $output"
  1423.  
  1424.       # Quote the finalize command for shipping.
  1425.       finalize_command=`$echo "X$finalize_command" | $Xsed -e "$sed_quote_subst"`
  1426.  
  1427.       # Quote $echo for shipping.
  1428.       qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  1429.  
  1430.       # Only actually do things if our run command is non-null.
  1431.       if test -z "$run"; then
  1432.         $rm $output
  1433.         trap "$rm $output; exit 1" 1 2 15
  1434.  
  1435.         $echo > $output "\
  1436. #! $SHELL
  1437.  
  1438. # $output - temporary wrapper script for $objdir/$output
  1439. # Generated by $PROGRAM - GNU $PACKAGE $VERSION
  1440. #
  1441. # The $output program cannot be directly executed until all the libtool
  1442. # libraries that it depends on are installed.
  1443. #
  1444. # This wrapper script should never be moved out of \``pwd`'.
  1445. # If it is, it will not operate correctly.
  1446.  
  1447. # Sed substitution that helps us do robust quoting.  It backslashifies
  1448. # metacharacters that are still active within double-quoted strings.
  1449. Xsed='sed -e s/^X//'
  1450. sed_quote_subst='$sed_quote_subst'
  1451.  
  1452. # The HP-UX ksh and POSIX shell print the target directory to stdout
  1453. # if CDPATH is set.
  1454. if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
  1455.  
  1456. # This environment variable determines our operation mode.
  1457. if test \"\$libtool_install_magic\" = \"$magic\"; then
  1458.   # install mode needs the following variables:
  1459.   link_against_libtool_libs='$link_against_libtool_libs'
  1460.   finalize_command=\"$finalize_command\"
  1461. else
  1462.   # When we are sourced in execute mode, \$file and \$echo are already set.
  1463.   if test \"\$libtool_execute_magic\" = \"$magic\"; then :
  1464.   else
  1465.     echo=\"$qecho\"
  1466.     file=\"\$0\"
  1467.   fi\
  1468. "
  1469.         $echo >> $output "\
  1470.  
  1471.   # Find the directory that this script lives in.
  1472.   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  1473.   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  1474.  
  1475.   # Follow symbolic links until we get to the real thisdir.
  1476.   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  1477.   while test -n \"\$file\"; do
  1478.     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  1479.  
  1480.     # If there was a directory component, then change thisdir.
  1481.     if test \"x\$destdir\" != \"x\$file\"; then
  1482.       case \"\$destdir\" in
  1483.       /* | [A-Za-z]:\\*) thisdir=\"\$destdir\" ;;
  1484.       *) thisdir=\"\$thisdir/\$destdir\" ;;
  1485.       esac
  1486.     fi
  1487.  
  1488.     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  1489.     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  1490.   done
  1491.  
  1492.   # Try to get the absolute directory name.
  1493.   absdir=\`cd \"\$thisdir\" && pwd\`
  1494.   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  1495.  
  1496.   progdir=\"\$thisdir/$objdir\"
  1497.   program='$output'
  1498.  
  1499.   if test -f \"\$progdir/\$program\"; then"
  1500.  
  1501.         # Export our shlibpath_var if we have one.
  1502.         if test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  1503.           $echo >> $output "\
  1504.     # Add our own library path to $shlibpath_var
  1505.     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  1506.  
  1507.     # Some systems cannot cope with colon-terminated $shlibpath_var
  1508.     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/:*\$//'\`
  1509.  
  1510.     export $shlibpath_var
  1511. "
  1512.         fi
  1513.  
  1514.         $echo >> $output "\
  1515.     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  1516.       # Run the actual program with our arguments.
  1517.  
  1518.       # Export the path to the program.
  1519.       PATH=\"\$progdir:\$PATH\"
  1520.       export PATH
  1521.  
  1522.       exec \$program \${1+\"\$@\"}
  1523.  
  1524.       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  1525.       exit 1
  1526.     fi
  1527.   else
  1528.     # The program doesn't exist.
  1529.     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  1530.     \$echo \"This script is just a wrapper for \$program.\" 1>&2
  1531.     echo \"See the $PACKAGE documentation for more information.\" 1>&2
  1532.     exit 1
  1533.   fi
  1534. fi\
  1535. "
  1536.         chmod +x $output
  1537.       fi
  1538.       exit 0
  1539.       ;;
  1540.     esac
  1541.  
  1542.     # See if we need to build an old-fashioned archive.
  1543.     if test "$build_old_libs" = "yes"; then
  1544.       # Transform .lo files to .o files.
  1545.       oldobjs="$objs"`$echo "X$libobjs " | $Xsed -e 's/[^   ]*\.a //g' -e 's/\.lo /.o /g' -e 's/ $//g'`
  1546.  
  1547.       # Do each command in the archive commands.
  1548.       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  1549.     eval cmds=\"$old_archive_from_new_cmds\"
  1550.       else
  1551.     eval cmds=\"$old_archive_cmds\"
  1552.       fi
  1553.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1554.       for cmd in $cmds; do
  1555.         IFS="$save_ifs"
  1556.         $show "$cmd"
  1557.         $run eval "$cmd" || exit $?
  1558.       done
  1559.       IFS="$save_ifs"
  1560.     fi
  1561.  
  1562.     # Now create the libtool archive.
  1563.     case "$output" in
  1564.     *.la)
  1565.       old_library=
  1566.       test "$build_old_libs" = yes && old_library="$libname.a"
  1567.  
  1568.       $show "creating $output"
  1569.  
  1570.       # Only create the output if not a dry run.
  1571.       if test -z "$run"; then
  1572.         $echo > $output "\
  1573. # $output - a libtool library file
  1574. # Generated by $PROGRAM - GNU $PACKAGE $VERSION
  1575.  
  1576. # The name that we can dlopen(3).
  1577. dlname='$dlname'
  1578.  
  1579. # Names of this library.
  1580. library_names='$library_names'
  1581.  
  1582. # The name of the static archive.
  1583. old_library='$old_library'
  1584.  
  1585. # Libraries that this one depends upon.
  1586. dependency_libs='$dependency_libs'
  1587.  
  1588. # Version information for $libname.
  1589. current=$current
  1590. age=$age
  1591. revision=$revision
  1592.  
  1593. # Directory that this library needs to be installed in:
  1594. libdir='$install_libdir'\
  1595. "
  1596.       fi
  1597.  
  1598.       # Do a symbolic link so that the libtool archive can be found in
  1599.       # LD_LIBRARY_PATH before the program is installed.
  1600.       $show "(cd $objdir && $LN_S ../$output $output)"
  1601.       $run eval "(cd $objdir && $LN_S ../$output $output)" || exit 1
  1602.       ;;
  1603.     esac
  1604.     exit 0
  1605.     ;;
  1606.  
  1607.   # libtool install mode
  1608.   install)
  1609.     modename="$modename: install"
  1610.  
  1611.     # There may be an optional sh(1) argument at the beginning of
  1612.     # install_prog (especially on Windows NT).
  1613.     if test "$nonopt" = "$SHELL"; then
  1614.       # Aesthetically quote it.
  1615.       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  1616.       case "$arg" in
  1617.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1618.     arg="\"$arg\""
  1619.     ;;
  1620.       esac
  1621.       install_prog="$arg "
  1622.       arg="$1"
  1623.       shift
  1624.     else
  1625.       install_prog=
  1626.       arg="$nonopt"
  1627.     fi
  1628.  
  1629.     # The real first argument should be the name of the installation program.
  1630.     # Aesthetically quote it.
  1631.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1632.     case "$arg" in
  1633.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1634.       arg="\"$arg\""
  1635.       ;;
  1636.     esac
  1637.     install_prog="$install_prog$arg"
  1638.  
  1639.     # We need to accept at least all the BSD install flags.
  1640.     dest=
  1641.     files=
  1642.     opts=
  1643.     prev=
  1644.     install_type=
  1645.     isdir=no
  1646.     stripme=
  1647.     for arg
  1648.     do
  1649.       if test -n "$dest"; then
  1650.         files="$files $dest"
  1651.         dest="$arg"
  1652.         continue
  1653.       fi
  1654.  
  1655.       case "$arg" in
  1656.       -d) isdir=yes ;;
  1657.       -f) prev="-f" ;;
  1658.       -g) prev="-g" ;;
  1659.       -m) prev="-m" ;;
  1660.       -o) prev="-o" ;;
  1661.       -s)
  1662.         stripme=" -s"
  1663.         continue
  1664.         ;;
  1665.       -*) ;;
  1666.  
  1667.       *)
  1668.         # If the previous option needed an argument, then skip it.
  1669.         if test -n "$prev"; then
  1670.           prev=
  1671.         else
  1672.           dest="$arg"
  1673.           continue
  1674.         fi
  1675.         ;;
  1676.       esac
  1677.  
  1678.       # Aesthetically quote the argument.
  1679.       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1680.       case "$arg" in
  1681.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1682.     arg="\"$arg\""
  1683.     ;;
  1684.       esac
  1685.       install_prog="$install_prog $arg"
  1686.     done
  1687.  
  1688.     if test -z "$install_prog"; then
  1689.       $echo "$modename: you must specify an install program" 1>&2
  1690.       $echo "$help" 1>&2
  1691.       exit 1
  1692.     fi
  1693.  
  1694.     if test -n "$prev"; then
  1695.       $echo "$modename: the \`$prev' option requires an argument" 1>&2
  1696.       $echo "$help" 1>&2
  1697.       exit 1
  1698.     fi
  1699.  
  1700.     if test -z "$files"; then
  1701.       if test -z "$dest"; then
  1702.         $echo "$modename: no file or destination specified" 1>&2
  1703.       else
  1704.         $echo "$modename: you must specify a destination" 1>&2
  1705.       fi
  1706.       $echo "$help" 1>&2
  1707.       exit 1
  1708.     fi
  1709.  
  1710.     # Strip any trailing slash from the destination.
  1711.     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  1712.  
  1713.     # Check to see that the destination is a directory.
  1714.     test -d "$dest" && isdir=yes
  1715.     if test "$isdir" = yes; then
  1716.       destdir="$dest"
  1717.       destname=
  1718.     else
  1719.       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  1720.       test "X$destdir" = "X$dest" && destdir=.
  1721.       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  1722.  
  1723.       # Not a directory, so check to see that there is only one file specified.
  1724.       set dummy $files
  1725.       if test $# -gt 2; then
  1726.         $echo "$modename: \`$dest' is not a directory" 1>&2
  1727.         $echo "$help" 1>&2
  1728.         exit 1
  1729.       fi
  1730.     fi
  1731.     case "$destdir" in
  1732.     /* | [A-Za-z]:\\*) ;;
  1733.     *)
  1734.       for file in $files; do
  1735.         case "$file" in
  1736.         *.lo) ;;
  1737.         *)
  1738.           $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  1739.           $echo "$help" 1>&2
  1740.           exit 1
  1741.           ;;
  1742.         esac
  1743.       done
  1744.       ;;
  1745.     esac
  1746.  
  1747.     # This variable tells wrapper scripts just to set variables rather
  1748.     # than running their programs.
  1749.     libtool_install_magic="$magic"
  1750.  
  1751.     staticlibs=
  1752.     future_libdirs=
  1753.     current_libdirs=
  1754.     for file in $files; do
  1755.  
  1756.       # Do each installation.
  1757.       case "$file" in
  1758.       *.a)
  1759.         # Do the static libraries later.
  1760.         staticlibs="$staticlibs $file"
  1761.         ;;
  1762.  
  1763.       *.la)
  1764.         # Check to see that this really is a libtool archive.
  1765.         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1766.         else
  1767.           $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  1768.           $echo "$help" 1>&2
  1769.           exit 1
  1770.         fi
  1771.  
  1772.         library_names=
  1773.         old_library=
  1774.         # If there is no directory component, then add one.
  1775.         case "$file" in
  1776.         */* | *\\*) . $file ;;
  1777.         *) . ./$file ;;
  1778.         esac
  1779.  
  1780.         # Add the libdir to current_libdirs if it is the destination.
  1781.         if test "X$destdir" = "X$libdir"; then
  1782.           case "$current_libdirs " in
  1783.           *" $libdir "*) ;;
  1784.           *) current_libdirs="$current_libdirs $libdir" ;;
  1785.           esac
  1786.         else
  1787.           # Note the libdir as a future libdir.
  1788.           case "$future_libdirs " in
  1789.           *" $libdir "*) ;;
  1790.           *) future_libdirs="$future_libdirs $libdir" ;;
  1791.           esac
  1792.         fi
  1793.  
  1794.         dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  1795.         test "X$dir" = "X$file/" && dir=
  1796.         dir="$dir$objdir"
  1797.  
  1798.         # See the names of the shared library.
  1799.         set dummy $library_names
  1800.         if test -n "$2"; then
  1801.           realname="$2"
  1802.           shift
  1803.           shift
  1804.  
  1805.           # Install the shared library and build the symlinks.
  1806.           $show "$install_prog $dir/$realname $destdir/$realname"
  1807.           $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  1808.           test "X$dlname" = "X$realname" && dlname=
  1809.  
  1810.           if test $# -gt 0; then
  1811.             # Delete the old symlinks.
  1812.             rmcmd="$rm"
  1813.             for linkname
  1814.             do
  1815.               rmcmd="$rmcmd $destdir/$linkname"
  1816.             done
  1817.             $show "$rmcmd"
  1818.             $run $rmcmd
  1819.  
  1820.             # ... and create new ones.
  1821.             for linkname
  1822.             do
  1823.               test "X$dlname" = "X$linkname" && dlname=
  1824.               $show "(cd $destdir && $LN_S $realname $linkname)"
  1825.               $run eval "(cd $destdir && $LN_S $realname $linkname)"
  1826.             done
  1827.           fi
  1828.  
  1829.           if test -n "$dlname"; then
  1830.             # Install the dynamically-loadable library.
  1831.             $show "$install_prog $dir/$dlname $destdir/$dlname"
  1832.             $run eval "$install_prog $dir/$dlname $destdir/$dlname" || exit $?
  1833.           fi
  1834.  
  1835.           # Do each command in the postinstall commands.
  1836.           lib="$destdir/$realname"
  1837.           eval cmds=\"$postinstall_cmds\"
  1838.           IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1839.           for cmd in $cmds; do
  1840.             IFS="$save_ifs"
  1841.             $show "$cmd"
  1842.             $run eval "$cmd" || exit $?
  1843.           done
  1844.           IFS="$save_ifs"
  1845.         fi
  1846.  
  1847.         # Install the pseudo-library for information purposes.
  1848.         name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1849.         $show "$install_prog $file $destdir/$name"
  1850.         $run eval "$install_prog $file $destdir/$name" || exit $?
  1851.  
  1852.         # Maybe install the static library, too.
  1853.         test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  1854.         ;;
  1855.  
  1856.       *.lo)
  1857.         # Install (i.e. copy) a libtool object.
  1858.  
  1859.         # Figure out destination file name, if it wasn't already specified.
  1860.         if test -n "$destname"; then
  1861.           destfile="$destdir/$destname"
  1862.         else
  1863.           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1864.           destfile="$destdir/$destfile"
  1865.         fi
  1866.  
  1867.         # Deduce the name of the destination old-style object file.
  1868.         case "$destfile" in
  1869.         *.lo)
  1870.           staticdest=`$echo "X$destfile" | $Xsed -e 's/\.lo$/.o/'`
  1871.           ;;
  1872.         *.o)
  1873.           staticdest="$destfile"
  1874.           destfile=
  1875.           ;;
  1876.         *)
  1877.           $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  1878.           $echo "$help" 1>&2
  1879.           exit 1
  1880.           ;;
  1881.         esac
  1882.  
  1883.         # Install the libtool object if requested.
  1884.         if test -n "$destfile"; then
  1885.           $show "$install_prog $file $destfile"
  1886.           $run eval "$install_prog $file $destfile" || exit $?
  1887.         fi
  1888.  
  1889.         # Install the old object if enabled.
  1890.         if test "$build_old_libs" = yes; then
  1891.           # Deduce the name of the old-style object file.
  1892.           staticobj=`$echo "X$file" | $Xsed -e 's/\.lo$/.o/'`
  1893.  
  1894.           $show "$install_prog $staticobj $staticdest"
  1895.           $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  1896.         fi
  1897.         exit 0
  1898.         ;;
  1899.  
  1900.       *)
  1901.         # Figure out destination file name, if it wasn't already specified.
  1902.         if test -n "$destname"; then
  1903.           destfile="$destdir/$destname"
  1904.         else
  1905.           destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1906.           destfile="$destdir/$destfile"
  1907.         fi
  1908.  
  1909.         # Do a test to see if this is really a libtool program.
  1910.         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1911.           link_against_libtool_libs=
  1912.           finalize_command=
  1913.  
  1914.           # If there is no directory component, then add one.
  1915.           case "$file" in
  1916.           */* | *\\*) . $file ;;
  1917.           *) . ./$file ;;
  1918.           esac
  1919.  
  1920.           # Check the variables that should have been set.
  1921.           if test -z "$link_against_libtool_libs" || test -z "$finalize_command"; then
  1922.             $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  1923.             exit 1
  1924.           fi
  1925.  
  1926.           finalize=yes
  1927.           for lib in $link_against_libtool_libs; do
  1928.             # Check to see that each library is installed.
  1929.             libdir=
  1930.             if test -f "$lib"; then
  1931.               # If there is no directory component, then add one.
  1932.               case "$lib" in
  1933.               */* | *\\*) . $lib ;;
  1934.               *) . ./$lib ;;
  1935.               esac
  1936.             fi
  1937.             libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  1938.             if test -z "$libdir"; then
  1939.               $echo "$modename: warning: \`$lib' contains no -rpath information" 1>&2
  1940.             elif test -f "$libfile"; then :
  1941.             else
  1942.               $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  1943.               finalize=no
  1944.             fi
  1945.           done
  1946.  
  1947.           if test "$hardcode_action" = relink; then
  1948.             if test "$finalize" = yes; then
  1949.               $echo "$modename: warning: relinking \`$file' on behalf of your buggy system linker" 1>&2
  1950.               $show "$finalize_command"
  1951.               if $run eval "$finalize_command"; then :
  1952.               else
  1953.                 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  1954.                 continue
  1955.               fi
  1956.               file="$objdir/$file"T
  1957.             else
  1958.               $echo "$modename: warning: cannot relink \`$file' on behalf of your buggy system linker" 1>&2
  1959.             fi
  1960.           else
  1961.             # Install the binary that we compiled earlier.
  1962.         file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  1963.           fi
  1964.         fi
  1965.  
  1966.         $show "$install_prog$stripme $file $destfile"
  1967.         $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  1968.         ;;
  1969.       esac
  1970.     done
  1971.  
  1972.     for file in $staticlibs; do
  1973.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  1974.  
  1975.       # Set up the ranlib parameters.
  1976.       oldlib="$destdir/$name"
  1977.  
  1978.       $show "$install_prog $file $oldlib"
  1979.       $run eval "$install_prog \$file \$oldlib" || exit $?
  1980.  
  1981.       # Do each command in the postinstall commands.
  1982.       eval cmds=\"$old_postinstall_cmds\"
  1983.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  1984.       for cmd in $cmds; do
  1985.         IFS="$save_ifs"
  1986.         $show "$cmd"
  1987.         $run eval "$cmd" || exit $?
  1988.       done
  1989.       IFS="$save_ifs"
  1990.     done
  1991.  
  1992.     if test -n "$future_libdirs"; then
  1993.       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  1994.     fi
  1995.  
  1996.     if test -n "$current_libdirs"; then
  1997.       # Maybe just do a dry run.
  1998.       test -n "$run" && current_libdirs=" -n$current_libdirs"
  1999.       exec $SHELL $0 --finish$current_libdirs
  2000.       exit 1
  2001.     fi
  2002.  
  2003.     exit 0
  2004.     ;;
  2005.  
  2006.   # libtool finish mode
  2007.   finish)
  2008.     modename="$modename: finish"
  2009.     libdirs="$nonopt"
  2010.     admincmds=
  2011.  
  2012.     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  2013.       for dir
  2014.       do
  2015.         libdirs="$libdirs $dir"
  2016.       done
  2017.  
  2018.       for libdir in $libdirs; do
  2019.     if test -n "$finish_cmds"; then
  2020.       # Do each command in the finish commands.
  2021.       eval cmds=\"$finish_cmds\"
  2022.           IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  2023.           for cmd in $cmds; do
  2024.             IFS="$save_ifs"
  2025.             $show "$cmd"
  2026.             $run eval "$cmd" || admincmds="$admincmds
  2027.        $cmd"
  2028.           done
  2029.           IFS="$save_ifs"
  2030.     fi
  2031.     if test -n "$finish_eval"; then
  2032.       # Do the single finish_eval.
  2033.       eval cmds=\"$finish_eval\"
  2034.       $run eval "$cmds" || admincmds="$admincmds
  2035.        $cmds"
  2036.     fi
  2037.       done
  2038.     fi
  2039.  
  2040.     echo "----------------------------------------------------------------------"
  2041.     echo "Libraries have been installed in:"
  2042.     for libdir in $libdirs; do
  2043.       echo "   $libdir"
  2044.     done
  2045.     echo
  2046.     echo "To link against installed libraries in a given directory, LIBDIR,"
  2047.     echo "you must use the \`-LLIBDIR' flag during linking."
  2048.     echo
  2049.     echo " You will also need to do at least one of the following:"
  2050.     if test -n "$shlibpath_var"; then
  2051.       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  2052.       echo "     during execution"
  2053.     fi
  2054.     if test -n "$runpath_var"; then
  2055.       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  2056.       echo "     during linking"
  2057.     fi
  2058.     if test -n "$hardcode_libdir_flag_spec"; then
  2059.       libdir=LIBDIR
  2060.       eval flag=\"$hardcode_libdir_flag_spec\"
  2061.  
  2062.       echo "   - use the \`$flag' linker flag"
  2063.     fi
  2064.     if test -n "$admincmds"; then
  2065.       echo "   - have your system administrator run these commands:$admincmds"
  2066.     fi
  2067.     if test -f /etc/ld.so.conf; then
  2068.       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  2069.     fi
  2070.     echo
  2071.     echo "See any operating system documentation about shared libraries for"
  2072.     echo "more information, such as the ld(1) and ld.so(8) manual pages."
  2073.     echo "----------------------------------------------------------------------"
  2074.     exit 0
  2075.     ;;
  2076.  
  2077.   # libtool execute mode
  2078.   execute)
  2079.     modename="$modename: execute"
  2080.  
  2081.     # The first argument is the command name.
  2082.     cmd="$nonopt"
  2083.     if test -z "$cmd"; then
  2084.       $echo "$modename: you must specify a COMMAND" 1>&2
  2085.       $echo "$help"
  2086.       exit 1
  2087.     fi
  2088.  
  2089.     # Handle -dlopen flags immediately.
  2090.     for file in $execute_dlfiles; do
  2091.       if test -f "$file"; then :
  2092.       else
  2093.     $echo "$modename: \`$file' is not a file" 1>&2
  2094.     $echo "$help" 1>&2
  2095.     exit 1
  2096.       fi
  2097.  
  2098.       dir=
  2099.       case "$file" in
  2100.       *.la)
  2101.         # Check to see that this really is a libtool archive.
  2102.         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  2103.         else
  2104.           $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  2105.           $echo "$help" 1>&2
  2106.           exit 1
  2107.         fi
  2108.  
  2109.     # Read the libtool library.
  2110.     dlname=
  2111.     library_names=
  2112.  
  2113.         # If there is no directory component, then add one.
  2114.     case "$file" in
  2115.     */* | *\\*) . $file ;;
  2116.         *) . ./$file ;;
  2117.     esac
  2118.  
  2119.     # Skip this library if it cannot be dlopened.
  2120.     if test -z "$dlname"; then
  2121.       # Warn if it was a shared library.
  2122.       test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  2123.       continue
  2124.     fi
  2125.  
  2126.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  2127.     test "X$dir" = "X$file" && dir=.
  2128.  
  2129.     if test -f "$dir/$objdir/$dlname"; then
  2130.       dir="$dir/$objdir"
  2131.     else
  2132.       $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  2133.       exit 1
  2134.     fi
  2135.     ;;
  2136.  
  2137.       *.lo)
  2138.     # Just add the directory containing the .lo file.
  2139.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  2140.     test "X$dir" = "X$file" && dir=.
  2141.     ;;
  2142.  
  2143.       *)
  2144.     $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  2145.         continue
  2146.     ;;
  2147.       esac
  2148.  
  2149.       # Get the absolute pathname.
  2150.       absdir=`cd "$dir" && pwd`
  2151.       test -n "$absdir" && dir="$absdir"
  2152.  
  2153.       # Now add the directory to shlibpath_var.
  2154.       if eval "test -z \"\$$shlibpath_var\""; then
  2155.     eval "$shlibpath_var=\"\$dir\""
  2156.       else
  2157.     eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  2158.       fi
  2159.     done
  2160.  
  2161.     # This variable tells wrapper scripts just to set shlibpath_var
  2162.     # rather than running their programs.
  2163.     libtool_execute_magic="$magic"
  2164.  
  2165.     # Check if any of the arguments is a wrapper script.
  2166.     args=
  2167.     for file
  2168.     do
  2169.       case "$file" in
  2170.       -*) ;;
  2171.       *)
  2172.         # Do a test to see if this is really a libtool program.
  2173.         if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  2174.       # If there is no directory component, then add one.
  2175.       case "$file" in
  2176.       */* | *\\*) . $file ;;
  2177.       *) . ./$file ;;
  2178.       esac
  2179.  
  2180.       # Transform arg to wrapped name.
  2181.       file="$progdir/$program"
  2182.     fi
  2183.         ;;
  2184.       esac
  2185.       # Quote arguments (to preserve shell metacharacters).
  2186.       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  2187.       args="$args \"$file\""
  2188.     done
  2189.  
  2190.     if test -z "$run"; then
  2191.       # Export the shlibpath_var.
  2192.       eval "export $shlibpath_var"
  2193.  
  2194.       # Now actually exec the command.
  2195.       eval "exec \$cmd$args"
  2196.  
  2197.       $echo "$modename: cannot exec \$cmd$args"
  2198.       exit 1
  2199.     else
  2200.       # Display what would be done.
  2201.       eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  2202.       $echo "export $shlibpath_var"
  2203.       $echo "$cmd$args"
  2204.       exit 0
  2205.     fi
  2206.     ;;
  2207.  
  2208.   # libtool uninstall mode
  2209.   uninstall)
  2210.     modename="$modename: uninstall"
  2211.     rm="$nonopt"
  2212.     files=
  2213.  
  2214.     for arg
  2215.     do
  2216.       case "$arg" in
  2217.       -*) rm="$rm $arg" ;;
  2218.       *) files="$files $arg" ;;
  2219.       esac
  2220.     done
  2221.  
  2222.     if test -z "$rm"; then
  2223.       $echo "$modename: you must specify an RM program" 1>&2
  2224.       $echo "$help" 1>&2
  2225.       exit 1
  2226.     fi
  2227.  
  2228.     for file in $files; do
  2229.       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  2230.       test "X$dir" = "X$file" && dir=.
  2231.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  2232.  
  2233.       rmfiles="$file"
  2234.  
  2235.       case "$name" in
  2236.       *.la)
  2237.         # Possibly a libtool archive, so verify it.
  2238.         if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  2239.           . $dir/$name
  2240.  
  2241.           # Delete the libtool libraries and symlinks.
  2242.           for n in $library_names; do
  2243.             rmfiles="$rmfiles $dir/$n"
  2244.             test "X$n" = "X$dlname" && dlname=
  2245.           done
  2246.           test -n "$dlname" && rmfiles="$rmfiles $dir/$dlname"
  2247.           test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  2248.  
  2249.       $show "$rm $rmfiles"
  2250.       $run $rm $rmfiles
  2251.  
  2252.       if test -n "$library_names"; then
  2253.         # Do each command in the postuninstall commands.
  2254.         eval cmds=\"$postuninstall_cmds\"
  2255.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  2256.         for cmd in $cmds; do
  2257.           IFS="$save_ifs"
  2258.           $show "$cmd"
  2259.           $run eval "$cmd"
  2260.         done
  2261.         IFS="$save_ifs"
  2262.       fi
  2263.  
  2264.           if test -n "$old_library"; then
  2265.         # Do each command in the old_postuninstall commands.
  2266.         eval cmds=\"$old_postuninstall_cmds\"
  2267.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS=';'
  2268.         for cmd in $cmds; do
  2269.           IFS="$save_ifs"
  2270.           $show "$cmd"
  2271.           $run eval "$cmd"
  2272.         done
  2273.         IFS="$save_ifs"
  2274.       fi
  2275.  
  2276.           # FIXME: should reinstall the best remaining shared library.
  2277.         fi
  2278.         ;;
  2279.  
  2280.       *.lo)
  2281.         if test "$build_old_libs" = yes; then
  2282.           oldobj=`$echo "X$name" | $Xsed -e 's/\.lo$/.o/'`
  2283.           rmfiles="$rmfiles $dir/$oldobj"
  2284.         fi
  2285.     $show "$rm $rmfiles"
  2286.     $run $rm $rmfiles
  2287.         ;;
  2288.  
  2289.       *)
  2290.           $show "$rm $rmfiles"
  2291.     $run $rm $rmfiles
  2292.     ;;
  2293.       esac
  2294.     done
  2295.     exit 0
  2296.     ;;
  2297.  
  2298.   "")
  2299.     $echo "$modename: you must specify a MODE" 1>&2
  2300.     $echo "$generic_help" 1>&2
  2301.     exit 1
  2302.     ;;
  2303.   esac
  2304.  
  2305.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  2306.   $echo "$generic_help" 1>&2
  2307.   exit 1
  2308. fi # test -z "$show_help"
  2309.  
  2310. # We need to display help for each of the modes.
  2311. case "$mode" in
  2312. "") $echo \
  2313. "Usage: $modename [OPTION]... [MODE-ARG]...
  2314.  
  2315. Provide generalized library-building support services.
  2316.  
  2317.     --config          show all configuration variables
  2318.     --debug           enable verbose shell tracing
  2319. -n, --dry-run         display commands without modifying any files
  2320.     --features        display basic configuration information and exit
  2321.     --finish          same as \`--mode=finish'
  2322.     --help            display this help message and exit
  2323.     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  2324.     --quiet           same as \`--silent'
  2325.     --silent          don't print informational messages
  2326.     --version         print version information
  2327.  
  2328. MODE must be one of the following:
  2329.  
  2330.       compile         compile a source file into a libtool object
  2331.       execute         automatically set library path, then run a program
  2332.       finish          complete the installation of libtool libraries
  2333.       install         install libraries or executables
  2334.       link            create a library or an executable
  2335.       uninstall       remove libraries from an installed directory
  2336.  
  2337. MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  2338. a more detailed description of MODE."
  2339.   exit 0
  2340.   ;;
  2341.  
  2342. compile)
  2343.   $echo \
  2344. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  2345.  
  2346. Compile a source file into a libtool library object.
  2347.  
  2348. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  2349. from the given SOURCEFILE.
  2350.  
  2351. The output file name is determined by removing the directory component from
  2352. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  2353. library object suffix, \`.lo'."
  2354.   ;;
  2355.  
  2356. execute)
  2357.   $echo \
  2358. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  2359.  
  2360. Automatically set library path, then run a program.
  2361.  
  2362. This mode accepts the following additional options:
  2363.  
  2364.   -dlopen FILE      add the directory containing FILE to the library path
  2365.  
  2366. This mode sets the library path environment variable according to \`-dlopen'
  2367. flags.
  2368.  
  2369. If any of the ARGS are libtool executable wrappers, then they are translated
  2370. into their corresponding uninstalled binary, and any of their required library
  2371. directories are added to the library path.
  2372.  
  2373. Then, COMMAND is executed, with ARGS as arguments."
  2374.   ;;
  2375.  
  2376. finish)
  2377.   $echo \
  2378. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  2379.  
  2380. Complete the installation of libtool libraries.
  2381.  
  2382. Each LIBDIR is a directory that contains libtool libraries.
  2383.  
  2384. The commands that this mode executes may require superuser privileges.  Use
  2385. the \`--dry-run' option if you just want to see what would be executed."
  2386.   ;;
  2387.  
  2388. install)
  2389.   $echo \
  2390. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  2391.  
  2392. Install executables or libraries.
  2393.  
  2394. INSTALL-COMMAND is the installation command.  The first component should be
  2395. either the \`install' or \`cp' program.
  2396.  
  2397. The rest of the components are interpreted as arguments to that command (only
  2398. BSD-compatible install options are recognized)."
  2399.   ;;
  2400.  
  2401. link)
  2402.   $echo \
  2403. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  2404.  
  2405. Link object files or libraries together to form another library, or to
  2406. create an executable program.
  2407.  
  2408. LINK-COMMAND is a command using the C compiler that you would use to create
  2409. a program from several object files.
  2410.  
  2411. The following components of LINK-COMMAND are treated specially:
  2412.  
  2413.   -all-static       do not do any dynamic linking at all
  2414.   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  2415.   -dlpreopen FILE   link in FILE and add its symbols to dld_preloaded_symbols
  2416.   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  2417.   -LLIBDIR          search LIBDIR for required installed libraries
  2418.   -lNAME            OUTPUT-FILE requires the installed library libNAME
  2419.   -no-undefined     declare that a library does not refer to external symbols
  2420.   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  2421.   -release RELEASE  specify package release information
  2422.   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  2423.   -static           do not do any dynamic linking of libtool libraries
  2424.   -version-info CURRENT[:REVISION[:AGE]]
  2425.                     specify library version info [each variable defaults to 0]
  2426.  
  2427. All other options (arguments beginning with \`-') are ignored.
  2428.  
  2429. Every other argument is treated as a filename.  Files ending in \`.la' are
  2430. treated as uninstalled libtool libraries, other files are standard or library
  2431. object files.
  2432.  
  2433. If the OUTPUT-FILE ends in \`.la', then a libtool library is created, only
  2434. library objects (\`.lo' files) may be specified, and \`-rpath' is required.
  2435.  
  2436. If OUTPUT-FILE ends in \`.a', then a standard library is created using \`ar'
  2437. and \`ranlib'.
  2438.  
  2439. If OUTPUT-FILE ends in \`.lo' or \`.o', then a reloadable object file is
  2440. created, otherwise an executable program is created."
  2441.   ;;
  2442.  
  2443. uninstall)
  2444.   $echo
  2445. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  2446.  
  2447. Remove libraries from an installation directory.
  2448.  
  2449. RM is the name of the program to use to delete files associated with each FILE
  2450. (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  2451. to RM.
  2452.  
  2453. If FILE is a libtool library, all the files associated with it are deleted.
  2454. Otherwise, only FILE itself is deleted using RM."
  2455.   ;;
  2456.  
  2457. *)
  2458.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  2459.   $echo "$help" 1>&2
  2460.   exit 1
  2461.   ;;
  2462. esac
  2463.  
  2464. echo
  2465. $echo "Try \`$modename --help' for more information about other modes."
  2466.  
  2467. exit 0
  2468.  
  2469. # Local Variables:
  2470. # mode:shell-script
  2471. # sh-indentation:2
  2472. # End:
  2473.