home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 6 / AACD06.ISO / AACD / System / Mesa-3.1 / ltmain.sh < prev    next >
Text File  |  2000-01-05  |  109KB  |  3,976 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-1999 Free Software Foundation, Inc.
  5. # Originally by 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. # Check that we have a working $echo.
  27. if test "X$1" = X--no-reexec; then
  28.   # Discard the --no-reexec flag, and continue.
  29.   shift
  30. elif test "X$1" = X--fallback-echo; then
  31.   # Avoid inline document here, it may be left over
  32.   :
  33. elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
  34.   # Yippee, $echo works!
  35.   :
  36. else
  37.   # Restart under the correct shell, and then maybe $echo will work.
  38.   exec $SHELL "$0" --no-reexec ${1+"$@"}
  39. fi
  40.  
  41. if test "X$1" = X--fallback-echo; then
  42.   # used as fallback echo
  43.   shift
  44.   cat <<EOF
  45. $*
  46. EOF
  47.   exit 0
  48. fi
  49.  
  50. # The name of this program.
  51. progname=`$echo "$0" | sed 's%^.*/%%'`
  52. modename="$progname"
  53.  
  54. # Constants.
  55. PROGRAM=ltmain.sh
  56. PACKAGE=libtool
  57. VERSION=1.3.3
  58. TIMESTAMP=" (1.385.2.181 1999/07/02 15:49:11)"
  59.  
  60. default_mode=
  61. help="Try \`$progname --help' for more information."
  62. magic="%%%MAGIC variable%%%"
  63. mkdir="mkdir"
  64. mv="mv -f"
  65. rm="rm -f"
  66.  
  67. # Sed substitution that helps us do robust quoting.  It backslashifies
  68. # metacharacters that are still active within double-quoted strings.
  69. Xsed='sed -e 1s/^X//'
  70. sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
  71. SP2NL='tr \040 \012'
  72. NL2SP='tr \015\012 \040\040'
  73.  
  74. # NLS nuisances.
  75. # Only set LANG and LC_ALL to C if already set.
  76. # These must not be set unconditionally because not all systems understand
  77. # e.g. LANG=C (notably SCO).
  78. # We save the old values to restore during execute mode.
  79. if test "${LC_ALL+set}" = set; then
  80.   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  81. fi
  82. if test "${LANG+set}" = set; then
  83.   save_LANG="$LANG"; LANG=C; export LANG
  84. fi
  85.  
  86. if test "$LTCONFIG_VERSION" != "$VERSION"; then
  87.   echo "$modename: ltconfig version \`$LTCONFIG_VERSION' does not match $PROGRAM version \`$VERSION'" 1>&2
  88.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  89.   exit 1
  90. fi
  91.  
  92. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  93.   echo "$modename: not configured to build any kind of library" 1>&2
  94.   echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  95.   exit 1
  96. fi
  97.  
  98. # Global variables.
  99. mode=$default_mode
  100. nonopt=
  101. prev=
  102. prevopt=
  103. run=
  104. show="$echo"
  105. show_help=
  106. execute_dlfiles=
  107. lo2o="s/\\.lo\$/.${objext}/"
  108. o2lo="s/\\.${objext}\$/.lo/"
  109.  
  110. # Parse our command line options once, thoroughly.
  111. while test $# -gt 0
  112. do
  113.   arg="$1"
  114.   shift
  115.  
  116.   case "$arg" in
  117.   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  118.   *) optarg= ;;
  119.   esac
  120.  
  121.   # If the previous option needs an argument, assign it.
  122.   if test -n "$prev"; then
  123.     case "$prev" in
  124.     execute_dlfiles)
  125.       eval "$prev=\"\$$prev \$arg\""
  126.       ;;
  127.     *)
  128.       eval "$prev=\$arg"
  129.       ;;
  130.     esac
  131.  
  132.     prev=
  133.     prevopt=
  134.     continue
  135.   fi
  136.  
  137.   # Have we seen a non-optional argument yet?
  138.   case "$arg" in
  139.   --help)
  140.     show_help=yes
  141.     ;;
  142.  
  143.   --version)
  144.     echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  145.     exit 0
  146.     ;;
  147.  
  148.   --config)
  149.     sed -e '1,/^### BEGIN LIBTOOL CONFIG/d' -e '/^### END LIBTOOL CONFIG/,$d' $0
  150.     exit 0
  151.     ;;
  152.  
  153.   --debug)
  154.     echo "$progname: enabling shell trace mode"
  155.     set -x
  156.     ;;
  157.  
  158.   --dry-run | -n)
  159.     run=:
  160.     ;;
  161.  
  162.   --features)
  163.     echo "host: $host"
  164.     if test "$build_libtool_libs" = yes; then
  165.       echo "enable shared libraries"
  166.     else
  167.       echo "disable shared libraries"
  168.     fi
  169.     if test "$build_old_libs" = yes; then
  170.       echo "enable static libraries"
  171.     else
  172.       echo "disable static libraries"
  173.     fi
  174.     exit 0
  175.     ;;
  176.  
  177.   --finish) mode="finish" ;;
  178.  
  179.   --mode) prevopt="--mode" prev=mode ;;
  180.   --mode=*) mode="$optarg" ;;
  181.  
  182.   --quiet | --silent)
  183.     show=:
  184.     ;;
  185.  
  186.   -dlopen)
  187.     prevopt="-dlopen"
  188.     prev=execute_dlfiles
  189.     ;;
  190.  
  191.   -*)
  192.     $echo "$modename: unrecognized option \`$arg'" 1>&2
  193.     $echo "$help" 1>&2
  194.     exit 1
  195.     ;;
  196.  
  197.   *)
  198.     nonopt="$arg"
  199.     break
  200.     ;;
  201.   esac
  202. done
  203.  
  204. if test -n "$prevopt"; then
  205.   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  206.   $echo "$help" 1>&2
  207.   exit 1
  208. fi
  209.  
  210. if test -z "$show_help"; then
  211.  
  212.   # Infer the operation mode.
  213.   if test -z "$mode"; then
  214.     case "$nonopt" in
  215.     *cc | *++ | gcc* | *-gcc*)
  216.       mode=link
  217.       for arg
  218.       do
  219.     case "$arg" in
  220.     -c)
  221.        mode=compile
  222.        break
  223.        ;;
  224.     esac
  225.       done
  226.       ;;
  227.     *db | *dbx | *strace | *truss)
  228.       mode=execute
  229.       ;;
  230.     *install*|cp|mv)
  231.       mode=install
  232.       ;;
  233.     *rm)
  234.       mode=uninstall
  235.       ;;
  236.     *)
  237.       # If we have no mode, but dlfiles were specified, then do execute mode.
  238.       test -n "$execute_dlfiles" && mode=execute
  239.  
  240.       # Just use the default operation mode.
  241.       if test -z "$mode"; then
  242.     if test -n "$nonopt"; then
  243.       $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  244.     else
  245.       $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  246.     fi
  247.       fi
  248.       ;;
  249.     esac
  250.   fi
  251.  
  252.   # Only execute mode is allowed to have -dlopen flags.
  253.   if test -n "$execute_dlfiles" && test "$mode" != execute; then
  254.     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  255.     $echo "$help" 1>&2
  256.     exit 1
  257.   fi
  258.  
  259.   # Change the help message to a mode-specific one.
  260.   generic_help="$help"
  261.   help="Try \`$modename --help --mode=$mode' for more information."
  262.  
  263.   # These modes are in order of execution frequency so that they run quickly.
  264.   case "$mode" in
  265.   # libtool compile mode
  266.   compile)
  267.     modename="$modename: compile"
  268.     # Get the compilation command and the source file.
  269.     base_compile=
  270.     lastarg=
  271.     srcfile="$nonopt"
  272.     suppress_output=
  273.  
  274.     user_target=no
  275.     for arg
  276.     do
  277.       # Accept any command-line options.
  278.       case "$arg" in
  279.       -o)
  280.     if test "$user_target" != "no"; then
  281.       $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  282.       exit 1
  283.     fi
  284.     user_target=next
  285.     ;;
  286.  
  287.       -static)
  288.     build_old_libs=yes
  289.     continue
  290.     ;;
  291.       esac
  292.  
  293.       case "$user_target" in
  294.       next)
  295.     # The next one is the -o target name
  296.     user_target=yes
  297.     continue
  298.     ;;
  299.       yes)
  300.     # We got the output file
  301.     user_target=set
  302.     libobj="$arg"
  303.     continue
  304.     ;;
  305.       esac
  306.  
  307.       # Accept the current argument as the source file.
  308.       lastarg="$srcfile"
  309.       srcfile="$arg"
  310.  
  311.       # Aesthetically quote the previous argument.
  312.  
  313.       # Backslashify any backslashes, double quotes, and dollar signs.
  314.       # These are the only characters that are still specially
  315.       # interpreted inside of double-quoted scrings.
  316.       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  317.  
  318.       # Double-quote args containing other shell metacharacters.
  319.       # Many Bourne shells cannot handle close brackets correctly in scan
  320.       # sets, so we specify it separately.
  321.       case "$lastarg" in
  322.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  323.     lastarg="\"$lastarg\""
  324.     ;;
  325.       esac
  326.  
  327.       # Add the previous argument to base_compile.
  328.       if test -z "$base_compile"; then
  329.     base_compile="$lastarg"
  330.       else
  331.     base_compile="$base_compile $lastarg"
  332.       fi
  333.     done
  334.  
  335.     case "$user_target" in
  336.     set)
  337.       ;;
  338.     no)
  339.       # Get the name of the library object.
  340.       libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  341.       ;;
  342.     *)
  343.       $echo "$modename: you must specify a target with \`-o'" 1>&2
  344.       exit 1
  345.       ;;
  346.     esac
  347.  
  348.     # Recognize several different file suffixes.
  349.     # If the user specifies -o file.o, it is replaced with file.lo
  350.     xform='[cCFSfmso]'
  351.     case "$libobj" in
  352.     *.ada) xform=ada ;;
  353.     *.adb) xform=adb ;;
  354.     *.ads) xform=ads ;;
  355.     *.asm) xform=asm ;;
  356.     *.c++) xform=c++ ;;
  357.     *.cc) xform=cc ;;
  358.     *.cpp) xform=cpp ;;
  359.     *.cxx) xform=cxx ;;
  360.     *.f90) xform=f90 ;;
  361.     *.for) xform=for ;;
  362.     esac
  363.  
  364.     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  365.  
  366.     case "$libobj" in
  367.     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  368.     *)
  369.       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  370.       exit 1
  371.       ;;
  372.     esac
  373.  
  374.     if test -z "$base_compile"; then
  375.       $echo "$modename: you must specify a compilation command" 1>&2
  376.       $echo "$help" 1>&2
  377.       exit 1
  378.     fi
  379.  
  380.     # Delete any leftover library objects.
  381.     if test "$build_old_libs" = yes; then
  382.       removelist="$obj $libobj"
  383.     else
  384.       removelist="$libobj"
  385.     fi
  386.  
  387.     $run $rm $removelist
  388.     trap "$run $rm $removelist; exit 1" 1 2 15
  389.  
  390.     # Calculate the filename of the output object if compiler does
  391.     # not support -o with -c
  392.     if test "$compiler_c_o" = no; then
  393.       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\..*$%%'`.${objext}
  394.       lockfile="$output_obj.lock"
  395.       removelist="$removelist $output_obj $lockfile"
  396.       trap "$run $rm $removelist; exit 1" 1 2 15
  397.     else
  398.       need_locks=no
  399.       lockfile=
  400.     fi
  401.  
  402.     # Lock this critical section if it is needed
  403.     # We use this script file to make the link, it avoids creating a new file
  404.     if test "$need_locks" = yes; then
  405.       until ln "$0" "$lockfile" 2>/dev/null; do
  406.     $show "Waiting for $lockfile to be removed"
  407.     sleep 2
  408.       done
  409.     elif test "$need_locks" = warn; then
  410.       if test -f "$lockfile"; then
  411.     echo "\
  412. *** ERROR, $lockfile exists and contains:
  413. `cat $lockfile 2>/dev/null`
  414.  
  415. This indicates that another process is trying to use the same
  416. temporary object file, and libtool could not work around it because
  417. your compiler does not support \`-c' and \`-o' together.  If you
  418. repeat this compilation, it may succeed, by chance, but you had better
  419. avoid parallel builds (make -j) in this platform, or get a better
  420. compiler."
  421.  
  422.     $run $rm $removelist
  423.     exit 1
  424.       fi
  425.       echo $srcfile > "$lockfile"
  426.     fi
  427.  
  428.     if test -n "$fix_srcfile_path"; then
  429.       eval srcfile=\"$fix_srcfile_path\"
  430.     fi
  431.  
  432.     # Only build a PIC object if we are building libtool libraries.
  433.     if test "$build_libtool_libs" = yes; then
  434.       # Without this assignment, base_compile gets emptied.
  435.       fbsd_hideous_sh_bug=$base_compile
  436.  
  437.       # All platforms use -DPIC, to notify preprocessed assembler code.
  438.       command="$base_compile $pic_flag -DPIC $srcfile"
  439.       if test "$build_old_libs" = yes; then
  440.     lo_libobj="$libobj"
  441.     dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
  442.     if test "X$dir" = "X$libobj"; then
  443.       dir="$objdir"
  444.     else
  445.       dir="$dir/$objdir"
  446.     fi
  447.     libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
  448.  
  449.     if test -d "$dir"; then
  450.       $show "$rm $libobj"
  451.       $run $rm $libobj
  452.     else
  453.       $show "$mkdir $dir"
  454.       $run $mkdir $dir
  455.       status=$?
  456.       if test $status -ne 0 && test ! -d $dir; then
  457.         exit $status
  458.       fi
  459.     fi
  460.       fi
  461.       if test "$compiler_o_lo" = yes; then
  462.     output_obj="$libobj"
  463.     command="$command -o $output_obj"
  464.       elif test "$compiler_c_o" = yes; then
  465.     output_obj="$obj"
  466.     command="$command -o $output_obj"
  467.       fi
  468.  
  469.       $run $rm "$output_obj"
  470.       $show "$command"
  471.       if $run eval "$command"; then :
  472.       else
  473.     test -n "$output_obj" && $run $rm $removelist
  474.     exit 1
  475.       fi
  476.  
  477.       if test "$need_locks" = warn &&
  478.      test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  479.     echo "\
  480. *** ERROR, $lockfile contains:
  481. `cat $lockfile 2>/dev/null`
  482.  
  483. but it should contain:
  484. $srcfile
  485.  
  486. This indicates that another process is trying to use the same
  487. temporary object file, and libtool could not work around it because
  488. your compiler does not support \`-c' and \`-o' together.  If you
  489. repeat this compilation, it may succeed, by chance, but you had better
  490. avoid parallel builds (make -j) in this platform, or get a better
  491. compiler."
  492.  
  493.     $run $rm $removelist
  494.     exit 1
  495.       fi
  496.  
  497.       # Just move the object if needed, then go on to compile the next one
  498.       if test x"$output_obj" != x"$libobj"; then
  499.     $show "$mv $output_obj $libobj"
  500.     if $run $mv $output_obj $libobj; then :
  501.     else
  502.       error=$?
  503.       $run $rm $removelist
  504.       exit $error
  505.     fi
  506.       fi
  507.  
  508.       # If we have no pic_flag, then copy the object into place and finish.
  509.       if test -z "$pic_flag" && test "$build_old_libs" = yes; then
  510.     # Rename the .lo from within objdir to obj
  511.     if test -f $obj; then
  512.       $show $rm $obj
  513.       $run $rm $obj
  514.     fi
  515.  
  516.     $show "$mv $libobj $obj"
  517.     if $run $mv $libobj $obj; then :
  518.     else
  519.       error=$?
  520.       $run $rm $removelist
  521.       exit $error
  522.     fi
  523.  
  524.     # Now arrange that obj and lo_libobj become the same file
  525.     $show "$LN_S $obj $lo_libobj"
  526.     if $run $LN_S $obj $lo_libobj; then
  527.       exit 0
  528.     else
  529.       error=$?
  530.       $run $rm $removelist
  531.       exit $error
  532.     fi
  533.       fi
  534.  
  535.       # Allow error messages only from the first compilation.
  536.       suppress_output=' >/dev/null 2>&1'
  537.     fi
  538.  
  539.     # Only build a position-dependent object if we build old libraries.
  540.     if test "$build_old_libs" = yes; then
  541.       command="$base_compile $srcfile"
  542.       if test "$compiler_c_o" = yes; then
  543.     command="$command -o $obj"
  544.     output_obj="$obj"
  545.       fi
  546.  
  547.       # Suppress compiler output if we already did a PIC compilation.
  548.       command="$command$suppress_output"
  549.       $run $rm "$output_obj"
  550.       $show "$command"
  551.       if $run eval "$command"; then :
  552.       else
  553.     $run $rm $removelist
  554.     exit 1
  555.       fi
  556.  
  557.       if test "$need_locks" = warn &&
  558.      test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
  559.     echo "\
  560. *** ERROR, $lockfile contains:
  561. `cat $lockfile 2>/dev/null`
  562.  
  563. but it should contain:
  564. $srcfile
  565.  
  566. This indicates that another process is trying to use the same
  567. temporary object file, and libtool could not work around it because
  568. your compiler does not support \`-c' and \`-o' together.  If you
  569. repeat this compilation, it may succeed, by chance, but you had better
  570. avoid parallel builds (make -j) in this platform, or get a better
  571. compiler."
  572.  
  573.     $run $rm $removelist
  574.     exit 1
  575.       fi
  576.  
  577.       # Just move the object if needed
  578.       if test x"$output_obj" != x"$obj"; then
  579.     $show "$mv $output_obj $obj"
  580.     if $run $mv $output_obj $obj; then :
  581.     else
  582.       error=$?
  583.       $run $rm $removelist
  584.       exit $error
  585.     fi
  586.       fi
  587.  
  588.       # Create an invalid libtool object if no PIC, so that we do not
  589.       # accidentally link it into a program.
  590.       if test "$build_libtool_libs" != yes; then
  591.     $show "echo timestamp > $libobj"
  592.     $run eval "echo timestamp > \$libobj" || exit $?
  593.       else
  594.     # Move the .lo from within objdir
  595.     $show "$mv $libobj $lo_libobj"
  596.     if $run $mv $libobj $lo_libobj; then :
  597.     else
  598.       error=$?
  599.       $run $rm $removelist
  600.       exit $error
  601.     fi
  602.       fi
  603.     fi
  604.  
  605.     # Unlock the critical section if it was locked
  606.     if test "$need_locks" != no; then
  607.       $rm "$lockfile"
  608.     fi
  609.  
  610.     exit 0
  611.     ;;
  612.  
  613.   # libtool link mode
  614.   link)
  615.     modename="$modename: link"
  616.     C_compiler="$CC" # save it, to compile generated C sources
  617.     CC="$nonopt"
  618.     case "$host" in
  619.     *-*-cygwin* | *-*-mingw* | *-*-os2*)
  620.       # It is impossible to link a dll without this setting, and
  621.       # we shouldn't force the makefile maintainer to figure out
  622.       # which system we are compiling for in order to pass an extra
  623.       # flag for every libtool invokation.
  624.       # allow_undefined=no
  625.  
  626.       # FIXME: Unfortunately, there are problems with the above when trying
  627.       # to make a dll which has undefined symbols, in which case not
  628.       # even a static library is built.  For now, we need to specify
  629.       # -no-undefined on the libtool link line when we can be certain
  630.       # that all symbols are satisfied, otherwise we get a static library.
  631.       allow_undefined=yes
  632.  
  633.       # This is a source program that is used to create dlls on Windows
  634.       # Don't remove nor modify the starting and closing comments
  635. # /* ltdll.c starts here */
  636. # #define WIN32_LEAN_AND_MEAN
  637. # #include <windows.h>
  638. # #undef WIN32_LEAN_AND_MEAN
  639. # #include <stdio.h>
  640. #
  641. # #ifndef __CYGWIN__
  642. # #  ifdef __CYGWIN32__
  643. # #    define __CYGWIN__ __CYGWIN32__
  644. # #  endif
  645. # #endif
  646. #
  647. # #ifdef __cplusplus
  648. # extern "C" {
  649. # #endif
  650. # BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
  651. # #ifdef __cplusplus
  652. # }
  653. # #endif
  654. #
  655. # #ifdef __CYGWIN__
  656. # #include <cygwin/cygwin_dll.h>
  657. # DECLARE_CYGWIN_DLL( DllMain );
  658. # #endif
  659. # HINSTANCE __hDllInstance_base;
  660. #
  661. # BOOL APIENTRY
  662. # DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
  663. # {
  664. #   __hDllInstance_base = hInst;
  665. #   return TRUE;
  666. # }
  667. # /* ltdll.c ends here */
  668.       # This is a source program that is used to create import libraries
  669.       # on Windows for dlls which lack them. Don't remove nor modify the
  670.       # starting and closing comments
  671. # /* impgen.c starts here */
  672. # /*   Copyright (C) 1999 Free Software Foundation, Inc.
  673. #  This file is part of GNU libtool.
  674. #  This program is free software; you can redistribute it and/or modify
  675. #  it under the terms of the GNU General Public License as published by
  676. #  the Free Software Foundation; either version 2 of the License, or
  677. #  (at your option) any later version.
  678. #  This program is distributed in the hope that it will be useful,
  679. #  but WITHOUT ANY WARRANTY; without even the implied warranty of
  680. #  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  681. #  GNU General Public License for more details.
  682. #  You should have received a copy of the GNU General Public License
  683. #  along with this program; if not, write to the Free Software
  684. #  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  685. #  */
  686. #  #include <stdio.h>        /* for printf() */
  687. #  #include <unistd.h>        /* for open(), lseek(), read() */
  688. #  #include <fcntl.h>        /* for O_RDONLY, O_BINARY */
  689. #  #include <string.h>        /* for strdup() */
  690. #  static unsigned int
  691. #  pe_get16 (fd, offset)
  692. #       int fd;
  693. #       int offset;
  694. #  {
  695. #    unsigned char b[2];
  696. #    lseek (fd, offset, SEEK_SET);
  697. #    read (fd, b, 2);
  698. #    return b[0] + (b[1]<<8);
  699. #  }
  700. #  static unsigned int
  701. #  pe_get32 (fd, offset)
  702. #      int fd;
  703. #      int offset;
  704. #  {
  705. #    unsigned char b[4];
  706. #    lseek (fd, offset, SEEK_SET);
  707. #    read (fd, b, 4);
  708. #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  709. #  }
  710. #  static unsigned int
  711. #  pe_as32 (ptr)
  712. #       void *ptr;
  713. #  {
  714. #    unsigned char *b = ptr;
  715. #    return b[0] + (b[1]<<8) + (b[2]<<16) + (b[3]<<24);
  716. #  }
  717. #  int
  718. #  main (argc, argv)
  719. #      int argc;
  720. #      char *argv[];
  721. #  {
  722. #      int dll;
  723. #      unsigned long pe_header_offset, opthdr_ofs, num_entries, i;
  724. #      unsigned long export_rva, export_size, nsections, secptr, expptr;
  725. #      unsigned long name_rvas, nexp;
  726. #      unsigned char *expdata, *erva;
  727. #      char *filename, *dll_name;
  728. #      filename = argv[1];
  729. #      dll = open(filename, O_RDONLY|O_BINARY);
  730. #      if (!dll)
  731. #      return 1;
  732. #      dll_name = filename;
  733. #    
  734. #      for (i=0; filename[i]; i++)
  735. #      if (filename[i] == '/' || filename[i] == '\\'  || filename[i] == ':')
  736. #          dll_name = filename + i +1;
  737. #      pe_header_offset = pe_get32 (dll, 0x3c);
  738. #      opthdr_ofs = pe_header_offset + 4 + 20;
  739. #      num_entries = pe_get32 (dll, opthdr_ofs + 92);
  740. #      if (num_entries < 1) /* no exports */
  741. #      return 1;
  742. #      export_rva = pe_get32 (dll, opthdr_ofs + 96);
  743. #      export_size = pe_get32 (dll, opthdr_ofs + 100);
  744. #      nsections = pe_get16 (dll, pe_header_offset + 4 +2);
  745. #      secptr = (pe_header_offset + 4 + 20 +
  746. #            pe_get16 (dll, pe_header_offset + 4 + 16));
  747. #      expptr = 0;
  748. #      for (i = 0; i < nsections; i++)
  749. #      {
  750. #      char sname[8];
  751. #      unsigned long secptr1 = secptr + 40 * i;
  752. #      unsigned long vaddr = pe_get32 (dll, secptr1 + 12);
  753. #      unsigned long vsize = pe_get32 (dll, secptr1 + 16);
  754. #      unsigned long fptr = pe_get32 (dll, secptr1 + 20);
  755. #      lseek(dll, secptr1, SEEK_SET);
  756. #      read(dll, sname, 8);
  757. #      if (vaddr <= export_rva && vaddr+vsize > export_rva)
  758. #      {
  759. #          expptr = fptr + (export_rva - vaddr);
  760. #          if (export_rva + export_size > vaddr + vsize)
  761. #          export_size = vsize - (export_rva - vaddr);
  762. #          break;
  763. #      }
  764. #      }
  765. #      expdata = (unsigned char*)malloc(export_size);
  766. #      lseek (dll, expptr, SEEK_SET);
  767. #      read (dll, expdata, export_size);
  768. #      erva = expdata - export_rva;
  769. #      nexp = pe_as32 (expdata+24);
  770. #      name_rvas = pe_as32 (expdata+32);
  771. #      printf ("EXPORTS\n");
  772. #      for (i = 0; i<nexp; i++)
  773. #      {
  774. #      unsigned long name_rva = pe_as32 (erva+name_rvas+i*4);
  775. #      printf ("\t%s @ %ld ;\n", erva+name_rva, 1+ i);
  776. #      }
  777. #      return 0;
  778. #  }
  779. # /* impgen.c ends here */
  780.       ;;
  781.     *)
  782.       allow_undefined=yes
  783.       ;;
  784.     esac
  785.     compile_command="$CC"
  786.     finalize_command="$CC"
  787.  
  788.     compile_rpath=
  789.     finalize_rpath=
  790.     compile_shlibpath=
  791.     finalize_shlibpath=
  792.     convenience=
  793.     old_convenience=
  794.     deplibs=
  795.     linkopts=
  796.  
  797.     if test -n "$shlibpath_var"; then
  798.       # get the directories listed in $shlibpath_var
  799.       eval lib_search_path=\`\$echo \"X \${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  800.     else
  801.       lib_search_path=
  802.     fi
  803.     # now prepend the system-specific ones
  804.     eval lib_search_path=\"$sys_lib_search_path_spec\$lib_search_path\"
  805.     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  806.     
  807.     avoid_version=no
  808.     dlfiles=
  809.     dlprefiles=
  810.     dlself=no
  811.     export_dynamic=no
  812.     export_symbols=
  813.     export_symbols_regex=
  814.     generated=
  815.     libobjs=
  816.     link_against_libtool_libs=
  817.     ltlibs=
  818.     module=no
  819.     objs=
  820.     prefer_static_libs=no
  821.     preload=no
  822.     prev=
  823.     prevarg=
  824.     release=
  825.     rpath=
  826.     xrpath=
  827.     perm_rpath=
  828.     temp_rpath=
  829.     thread_safe=no
  830.     vinfo=
  831.  
  832.     # We need to know -static, to get the right output filenames.
  833.     for arg
  834.     do
  835.       case "$arg" in
  836.       -all-static | -static)
  837.     if test "X$arg" = "X-all-static"; then
  838.       if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  839.         $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  840.       fi
  841.       if test -n "$link_static_flag"; then
  842.         dlopen_self=$dlopen_self_static
  843.       fi
  844.     else
  845.       if test -z "$pic_flag" && test -n "$link_static_flag"; then
  846.         dlopen_self=$dlopen_self_static
  847.       fi
  848.     fi
  849.     build_libtool_libs=no
  850.     build_old_libs=yes
  851.     prefer_static_libs=yes
  852.     break
  853.     ;;
  854.       esac
  855.     done
  856.  
  857.     # See if our shared archives depend on static archives.
  858.     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  859.  
  860.     # Go through the arguments, transforming them on the way.
  861.     while test $# -gt 0; do
  862.       arg="$1"
  863.       shift
  864.  
  865.       # If the previous option needs an argument, assign it.
  866.       if test -n "$prev"; then
  867.     case "$prev" in
  868.     output)
  869.       compile_command="$compile_command @OUTPUT@"
  870.       finalize_command="$finalize_command @OUTPUT@"
  871.       ;;
  872.     esac
  873.  
  874.     case "$prev" in
  875.     dlfiles|dlprefiles)
  876.       if test "$preload" = no; then
  877.         # Add the symbol object into the linking commands.
  878.         compile_command="$compile_command @SYMFILE@"
  879.         finalize_command="$finalize_command @SYMFILE@"
  880.         preload=yes
  881.       fi
  882.       case "$arg" in
  883.       *.la | *.lo) ;;  # We handle these cases below.
  884.       force)
  885.         if test "$dlself" = no; then
  886.           dlself=needless
  887.           export_dynamic=yes
  888.         fi
  889.         prev=
  890.         continue
  891.         ;;
  892.       self)
  893.         if test "$prev" = dlprefiles; then
  894.           dlself=yes
  895.         elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  896.           dlself=yes
  897.         else
  898.           dlself=needless
  899.           export_dynamic=yes
  900.         fi
  901.         prev=
  902.         continue
  903.         ;;
  904.       *)
  905.         if test "$prev" = dlfiles; then
  906.           dlfiles="$dlfiles $arg"
  907.         else
  908.           dlprefiles="$dlprefiles $arg"
  909.         fi
  910.         prev=
  911.         ;;
  912.       esac
  913.       ;;
  914.     expsyms)
  915.       export_symbols="$arg"
  916.       if test ! -f "$arg"; then
  917.         $echo "$modename: symbol file \`$arg' does not exist"
  918.         exit 1
  919.       fi
  920.       prev=
  921.       continue
  922.       ;;
  923.     expsyms_regex)
  924.       export_symbols_regex="$arg"
  925.       prev=
  926.       continue
  927.       ;;
  928.     release)
  929.       release="-$arg"
  930.       prev=
  931.       continue
  932.       ;;
  933.     rpath | xrpath)
  934.       # We need an absolute path.
  935.       case "$arg" in
  936.       [\\/]* | [A-Za-z]:[\\/]*) ;;
  937.       *)
  938.         $echo "$modename: only absolute run-paths are allowed" 1>&2
  939.         exit 1
  940.         ;;
  941.       esac
  942.       if test "$prev" = rpath; then
  943.         case "$rpath " in
  944.         *" $arg "*) ;;
  945.         *) rpath="$rpath $arg" ;;
  946.         esac
  947.       else
  948.         case "$xrpath " in
  949.         *" $arg "*) ;;
  950.         *) xrpath="$xrpath $arg" ;;
  951.         esac
  952.       fi
  953.       prev=
  954.       continue
  955.       ;;
  956.     *)
  957.       eval "$prev=\"\$arg\""
  958.       prev=
  959.       continue
  960.       ;;
  961.     esac
  962.       fi
  963.  
  964.       prevarg="$arg"
  965.  
  966.       case "$arg" in
  967.       -all-static)
  968.     if test -n "$link_static_flag"; then
  969.       compile_command="$compile_command $link_static_flag"
  970.       finalize_command="$finalize_command $link_static_flag"
  971.     fi
  972.     continue
  973.     ;;
  974.  
  975.       -allow-undefined)
  976.     # FIXME: remove this flag sometime in the future.
  977.     $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  978.     continue
  979.     ;;
  980.  
  981.       -avoid-version)
  982.     avoid_version=yes
  983.     continue
  984.     ;;
  985.  
  986.       -dlopen)
  987.     prev=dlfiles
  988.     continue
  989.     ;;
  990.  
  991.       -dlpreopen)
  992.     prev=dlprefiles
  993.     continue
  994.     ;;
  995.  
  996.       -export-dynamic)
  997.     export_dynamic=yes
  998.     continue
  999.     ;;
  1000.  
  1001.       -export-symbols | -export-symbols-regex)
  1002.     if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1003.       $echo "$modename: not more than one -exported-symbols argument allowed"
  1004.       exit 1
  1005.     fi
  1006.     if test "X$arg" = "X-export-symbols"; then
  1007.       prev=expsyms
  1008.     else
  1009.       prev=expsyms_regex
  1010.     fi
  1011.     continue
  1012.     ;;
  1013.  
  1014.       -L*)
  1015.     dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1016.     # We need an absolute path.
  1017.     case "$dir" in
  1018.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  1019.     *)
  1020.       absdir=`cd "$dir" && pwd`
  1021.       if test -z "$absdir"; then
  1022.         $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1023.         $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1024.         absdir="$dir"
  1025.       fi
  1026.       dir="$absdir"
  1027.       ;;
  1028.     esac
  1029.     case " $deplibs " in
  1030.     *" $arg "*) ;;
  1031.     *) deplibs="$deplibs $arg";;
  1032.     esac
  1033.     case " $lib_search_path " in
  1034.     *" $dir "*) ;;
  1035.     *) lib_search_path="$lib_search_path $dir";;
  1036.     esac
  1037.     case "$host" in
  1038.     *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1039.       dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1040.       case ":$dllsearchpath:" in
  1041.       ::) dllsearchpath="$dllsearchdir";;
  1042.       *":$dllsearchdir:"*) ;;
  1043.       *) dllsearchpath="$dllsearchpath:$dllsearchdir";;
  1044.       esac
  1045.       ;;
  1046.     esac
  1047.     ;;
  1048.  
  1049.       -l*)
  1050.     if test "$arg" = "-lc"; then
  1051.       case "$host" in
  1052.       *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1053.         # These systems don't actually have c library (as such)
  1054.         continue
  1055.         ;;
  1056.       esac
  1057.     elif test "$arg" = "-lm"; then
  1058.       case "$host" in
  1059.       *-*-cygwin* | *-*-beos*)
  1060.         # These systems don't actually have math library (as such)
  1061.         continue
  1062.         ;;
  1063.       esac
  1064.     fi
  1065.     deplibs="$deplibs $arg"
  1066.     ;;
  1067.  
  1068.       -module)
  1069.     module=yes
  1070.     continue
  1071.     ;;
  1072.  
  1073.       -no-undefined)
  1074.     allow_undefined=no
  1075.     continue
  1076.     ;;
  1077.  
  1078.       -o) prev=output ;;
  1079.  
  1080.       -release)
  1081.     prev=release
  1082.     continue
  1083.     ;;
  1084.  
  1085.       -rpath)
  1086.     prev=rpath
  1087.     continue
  1088.     ;;
  1089.  
  1090.       -R)
  1091.     prev=xrpath
  1092.     continue
  1093.     ;;
  1094.  
  1095.       -R*)
  1096.     dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1097.     # We need an absolute path.
  1098.     case "$dir" in
  1099.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  1100.     *)
  1101.       $echo "$modename: only absolute run-paths are allowed" 1>&2
  1102.       exit 1
  1103.       ;;
  1104.     esac
  1105.     case "$xrpath " in
  1106.     *" $dir "*) ;;
  1107.     *) xrpath="$xrpath $dir" ;;
  1108.     esac
  1109.     continue
  1110.     ;;
  1111.  
  1112.       -static)
  1113.     # If we have no pic_flag, then this is the same as -all-static.
  1114.     if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1115.       compile_command="$compile_command $link_static_flag"
  1116.       finalize_command="$finalize_command $link_static_flag"
  1117.     fi
  1118.     continue
  1119.     ;;
  1120.  
  1121.       -thread-safe)
  1122.     thread_safe=yes
  1123.     continue
  1124.     ;;
  1125.  
  1126.       -version-info)
  1127.     prev=vinfo
  1128.     continue
  1129.     ;;
  1130.  
  1131.       # Some other compiler flag.
  1132.       -* | +*)
  1133.     # Unknown arguments in both finalize_command and compile_command need
  1134.     # to be aesthetically quoted because they are evaled later.
  1135.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1136.     case "$arg" in
  1137.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1138.       arg="\"$arg\""
  1139.       ;;
  1140.     esac
  1141.     ;;
  1142.  
  1143.       *.o | *.obj | *.a | *.lib)
  1144.     # A standard object.
  1145.     objs="$objs $arg"
  1146.     ;;
  1147.  
  1148.       *.lo)
  1149.     # A library object.
  1150.     if test "$prev" = dlfiles; then
  1151.       dlfiles="$dlfiles $arg"
  1152.       if test "$build_libtool_libs" = yes && test "$dlopen" = yes; then
  1153.         prev=
  1154.         continue
  1155.       else
  1156.         # If libtool objects are unsupported, then we need to preload.
  1157.         prev=dlprefiles
  1158.       fi
  1159.     fi
  1160.  
  1161.     if test "$prev" = dlprefiles; then
  1162.       # Preload the old-style object.
  1163.       dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
  1164.       prev=
  1165.     fi
  1166.     libobjs="$libobjs $arg"
  1167.     ;;
  1168.  
  1169.       *.la)
  1170.     # A libtool-controlled library.
  1171.  
  1172.     dlname=
  1173.     libdir=
  1174.     library_names=
  1175.     old_library=
  1176.  
  1177.     # Check to see that this really is a libtool archive.
  1178.     if (sed -e '2q' $arg | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1179.     else
  1180.       $echo "$modename: \`$arg' is not a valid libtool archive" 1>&2
  1181.       exit 1
  1182.     fi
  1183.  
  1184.     # If the library was installed with an old release of libtool,
  1185.     # it will not redefine variable installed.
  1186.     installed=yes
  1187.  
  1188.     # Read the .la file
  1189.     # If there is no directory component, then add one.
  1190.     case "$arg" in
  1191.     */* | *\\*) . $arg ;;
  1192.     *) . ./$arg ;;
  1193.     esac
  1194.  
  1195.     # Get the name of the library we link against.
  1196.     linklib=
  1197.     for l in $old_library $library_names; do
  1198.       linklib="$l"
  1199.     done
  1200.  
  1201.     if test -z "$linklib"; then
  1202.       $echo "$modename: cannot find name of link library for \`$arg'" 1>&2
  1203.       exit 1
  1204.     fi
  1205.  
  1206.     # Find the relevant object directory and library name.
  1207.     name=`$echo "X$arg" | $Xsed -e 's%^.*/%%' -e 's/\.la$//' -e 's/^lib//'`
  1208.  
  1209.     if test "X$installed" = Xyes; then
  1210.       dir="$libdir"
  1211.     else
  1212.       dir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1213.       if test "X$dir" = "X$arg"; then
  1214.         dir="$objdir"
  1215.       else
  1216.         dir="$dir/$objdir"
  1217.       fi
  1218.     fi
  1219.  
  1220.     if test -n "$dependency_libs"; then
  1221.       # Extract -R and -L from dependency_libs
  1222.       temp_deplibs=
  1223.       for deplib in $dependency_libs; do
  1224.         case "$deplib" in
  1225.         -R*) temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1226.          case " $rpath $xrpath " in
  1227.          *" $temp_xrpath "*) ;;
  1228.          *) xrpath="$xrpath $temp_xrpath";;
  1229.          esac;;
  1230.         -L*) case "$compile_command $temp_deplibs " in
  1231.          *" $deplib "*) ;;
  1232.          *) temp_deplibs="$temp_deplibs $deplib";;
  1233.          esac
  1234.          temp_dir=`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1235.          case " $lib_search_path " in
  1236.          *" $temp_dir "*) ;;
  1237.          *) lib_search_path="$lib_search_path $temp_dir";;
  1238.          esac
  1239.          ;;
  1240.         *) temp_deplibs="$temp_deplibs $deplib";;
  1241.         esac
  1242.       done
  1243.       dependency_libs="$temp_deplibs"
  1244.     fi
  1245.  
  1246.     if test -z "$libdir"; then
  1247.       # It is a libtool convenience library, so add in its objects.
  1248.       convenience="$convenience $dir/$old_library"
  1249.       old_convenience="$old_convenience $dir/$old_library"
  1250.       deplibs="$deplibs$dependency_libs"
  1251.       compile_command="$compile_command $dir/$old_library$dependency_libs"
  1252.       finalize_command="$finalize_command $dir/$old_library$dependency_libs"
  1253.       continue
  1254.     fi
  1255.  
  1256.     # This library was specified with -dlopen.
  1257.     if test "$prev" = dlfiles; then
  1258.       dlfiles="$dlfiles $arg"
  1259.       if test -z "$dlname" || test "$dlopen" != yes || test "$build_libtool_libs" = no; then
  1260.         # If there is no dlname, no dlopen support or we're linking statically,
  1261.         # we need to preload.
  1262.         prev=dlprefiles
  1263.       else
  1264.         # We should not create a dependency on this library, but we
  1265.         # may need any libraries it requires.
  1266.         compile_command="$compile_command$dependency_libs"
  1267.         finalize_command="$finalize_command$dependency_libs"
  1268.         prev=
  1269.         continue
  1270.       fi
  1271.     fi
  1272.  
  1273.     # The library was specified with -dlpreopen.
  1274.     if test "$prev" = dlprefiles; then
  1275.       # Prefer using a static library (so that no silly _DYNAMIC symbols
  1276.       # are required to link).
  1277.       if test -n "$old_library"; then
  1278.         dlprefiles="$dlprefiles $dir/$old_library"
  1279.       else
  1280.         dlprefiles="$dlprefiles $dir/$linklib"
  1281.       fi
  1282.       prev=
  1283.     fi
  1284.  
  1285.     if test -n "$library_names" &&
  1286.        { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1287.       link_against_libtool_libs="$link_against_libtool_libs $arg"
  1288.       if test -n "$shlibpath_var"; then
  1289.         # Make sure the rpath contains only unique directories.
  1290.         case "$temp_rpath " in
  1291.         *" $dir "*) ;;
  1292.         *) temp_rpath="$temp_rpath $dir" ;;
  1293.         esac
  1294.       fi
  1295.  
  1296.       # We need an absolute path.
  1297.       case "$dir" in
  1298.       [\\/] | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1299.       *)
  1300.         absdir=`cd "$dir" && pwd`
  1301.         if test -z "$absdir"; then
  1302.           $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1303.           $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1304.           absdir="$dir"
  1305.         fi
  1306.         ;;
  1307.       esac
  1308.       
  1309.       # This is the magic to use -rpath.
  1310.       # Skip directories that are in the system default run-time
  1311.       # search path, unless they have been requested with -R.
  1312.       case " $sys_lib_dlsearch_path " in
  1313.       *" $absdir "*) ;;
  1314.       *)
  1315.         case "$compile_rpath " in
  1316.         *" $absdir "*) ;;
  1317.         *) compile_rpath="$compile_rpath $absdir" 
  1318.         esac
  1319.         ;;
  1320.       esac
  1321.  
  1322.       case " $sys_lib_dlsearch_path " in
  1323.       *" $libdir "*) ;;
  1324.       *)
  1325.         case "$finalize_rpath " in
  1326.         *" $libdir "*) ;;
  1327.         *) finalize_rpath="$finalize_rpath $libdir"
  1328.         esac
  1329.         ;;
  1330.       esac
  1331.  
  1332.       lib_linked=yes
  1333.       case "$hardcode_action" in
  1334.       immediate | unsupported)
  1335.         if test "$hardcode_direct" = no; then
  1336.           compile_command="$compile_command $dir/$linklib"
  1337.           deplibs="$deplibs $dir/$linklib"
  1338.           case "$host" in
  1339.           *-*-cygwin* | *-*-mingw* | *-*-os2*)
  1340.         dllsearchdir=`cd "$dir" && pwd || echo "$dir"`
  1341.         if test -n "$dllsearchpath"; then
  1342.           dllsearchpath="$dllsearchpath:$dllsearchdir"
  1343.         else
  1344.           dllsearchpath="$dllsearchdir"
  1345.         fi
  1346.         ;;
  1347.           esac
  1348.         elif test "$hardcode_minus_L" = no; then
  1349.           case "$host" in
  1350.           *-*-sunos*)
  1351.         compile_shlibpath="$compile_shlibpath$dir:"
  1352.         ;;
  1353.           esac
  1354.           case "$compile_command " in
  1355.           *" -L$dir "*) ;;
  1356.           *) compile_command="$compile_command -L$dir";;
  1357.           esac
  1358.           compile_command="$compile_command -l$name"
  1359.           deplibs="$deplibs -L$dir -l$name"
  1360.         elif test "$hardcode_shlibpath_var" = no; then
  1361.           case ":$compile_shlibpath:" in
  1362.           *":$dir:"*) ;;
  1363.           *) compile_shlibpath="$compile_shlibpath$dir:";;
  1364.           esac
  1365.           compile_command="$compile_command -l$name"
  1366.           deplibs="$deplibs -l$name"
  1367.         else
  1368.           lib_linked=no
  1369.         fi
  1370.         ;;
  1371.  
  1372.       relink)
  1373.         if test "$hardcode_direct" = yes; then
  1374.           compile_command="$compile_command $absdir/$linklib"
  1375.           deplibs="$deplibs $absdir/$linklib"
  1376.         elif test "$hardcode_minus_L" = yes; then
  1377.           case "$compile_command " in
  1378.           *" -L$absdir "*) ;;
  1379.           *) compile_command="$compile_command -L$absdir";;
  1380.           esac
  1381.           compile_command="$compile_command -l$name"
  1382.           deplibs="$deplibs -L$absdir -l$name"
  1383.         elif test "$hardcode_shlibpath_var" = yes; then
  1384.           case ":$compile_shlibpath:" in
  1385.           *":$absdir:"*) ;;
  1386.           *) compile_shlibpath="$compile_shlibpath$absdir:";;
  1387.           esac
  1388.           compile_command="$compile_command -l$name"
  1389.           deplibs="$deplibs -l$name"
  1390.         else
  1391.           lib_linked=no
  1392.         fi
  1393.         ;;
  1394.  
  1395.       *)
  1396.         lib_linked=no
  1397.         ;;
  1398.       esac
  1399.  
  1400.       if test "$lib_linked" != yes; then
  1401.         $echo "$modename: configuration error: unsupported hardcode properties"
  1402.         exit 1
  1403.       fi
  1404.  
  1405.       # Finalize command for both is simple: just hardcode it.
  1406.       if test "$hardcode_direct" = yes; then
  1407.         finalize_command="$finalize_command $libdir/$linklib"
  1408.       elif test "$hardcode_minus_L" = yes; then
  1409.         case "$finalize_command " in
  1410.         *" -L$libdir "*) ;;
  1411.         *) finalize_command="$finalize_command -L$libdir";;
  1412.         esac
  1413.         finalize_command="$finalize_command -l$name"
  1414.       elif test "$hardcode_shlibpath_var" = yes; then
  1415.         case ":$finalize_shlibpath:" in
  1416.         *":$libdir:"*) ;;
  1417.         *) finalize_shlibpath="$finalize_shlibpath$libdir:";;
  1418.         esac
  1419.         finalize_command="$finalize_command -l$name"
  1420.       else
  1421.         # We cannot seem to hardcode it, guess we'll fake it.
  1422.         case "$finalize_command " in
  1423.         *" -L$dir "*) ;;
  1424.         *) finalize_command="$finalize_command -L$libdir";;
  1425.         esac
  1426.         finalize_command="$finalize_command -l$name"
  1427.       fi
  1428.     else
  1429.       # Transform directly to old archives if we don't build new libraries.
  1430.       if test -n "$pic_flag" && test -z "$old_library"; then
  1431.         $echo "$modename: cannot find static library for \`$arg'" 1>&2
  1432.         exit 1
  1433.       fi
  1434.  
  1435.       # Here we assume that one of hardcode_direct or hardcode_minus_L
  1436.       # is not unsupported.  This is valid on all known static and
  1437.       # shared platforms.
  1438.       if test "$hardcode_direct" != unsupported; then
  1439.         test -n "$old_library" && linklib="$old_library"
  1440.         compile_command="$compile_command $dir/$linklib"
  1441.         finalize_command="$finalize_command $dir/$linklib"
  1442.       else
  1443.         case "$compile_command " in
  1444.         *" -L$dir "*) ;;
  1445.         *) compile_command="$compile_command -L$dir";;
  1446.         esac
  1447.         compile_command="$compile_command -l$name"
  1448.         case "$finalize_command " in
  1449.         *" -L$dir "*) ;;
  1450.         *) finalize_command="$finalize_command -L$dir";;
  1451.         esac
  1452.         finalize_command="$finalize_command -l$name"
  1453.       fi
  1454.     fi
  1455.  
  1456.     # Add in any libraries that this one depends upon.
  1457.     compile_command="$compile_command$dependency_libs"
  1458.     finalize_command="$finalize_command$dependency_libs"
  1459.     continue
  1460.     ;;
  1461.  
  1462.       # Some other compiler argument.
  1463.       *)
  1464.     # Unknown arguments in both finalize_command and compile_command need
  1465.     # to be aesthetically quoted because they are evaled later.
  1466.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1467.     case "$arg" in
  1468.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  1469.       arg="\"$arg\""
  1470.       ;;
  1471.     esac
  1472.     ;;
  1473.       esac
  1474.  
  1475.       # Now actually substitute the argument into the commands.
  1476.       if test -n "$arg"; then
  1477.     compile_command="$compile_command $arg"
  1478.     finalize_command="$finalize_command $arg"
  1479.       fi
  1480.     done
  1481.  
  1482.     if test -n "$prev"; then
  1483.       $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1484.       $echo "$help" 1>&2
  1485.       exit 1
  1486.     fi
  1487.  
  1488.     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1489.       eval arg=\"$export_dynamic_flag_spec\"
  1490.       compile_command="$compile_command $arg"
  1491.       finalize_command="$finalize_command $arg"
  1492.     fi
  1493.  
  1494.     oldlibs=
  1495.     # calculate the name of the file, without its directory
  1496.     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1497.     libobjs_save="$libobjs"
  1498.  
  1499.     case "$output" in
  1500.     "")
  1501.       $echo "$modename: you must specify an output file" 1>&2
  1502.       $echo "$help" 1>&2
  1503.       exit 1
  1504.       ;;
  1505.  
  1506.     *.a | *.lib)
  1507.       if test -n "$link_against_libtool_libs"; then
  1508.     $echo "$modename: error: cannot link libtool libraries into archives" 1>&2
  1509.     exit 1
  1510.       fi
  1511.  
  1512.       if test -n "$deplibs"; then
  1513.     $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1514.       fi
  1515.  
  1516.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1517.     $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1518.       fi
  1519.  
  1520.       if test -n "$rpath"; then
  1521.     $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1522.       fi
  1523.  
  1524.       if test -n "$xrpath"; then
  1525.     $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1526.       fi
  1527.  
  1528.       if test -n "$vinfo"; then
  1529.     $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
  1530.       fi
  1531.  
  1532.       if test -n "$release"; then
  1533.     $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1534.       fi
  1535.  
  1536.       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1537.     $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1538.       fi
  1539.  
  1540.       # Now set the variables for building old libraries.
  1541.       build_libtool_libs=no
  1542.       oldlibs="$output"
  1543.       ;;
  1544.  
  1545.     *.la)
  1546.       # Make sure we only generate libraries of the form `libNAME.la'.
  1547.       case "$outputname" in
  1548.       lib*)
  1549.     name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1550.     eval libname=\"$libname_spec\"
  1551.     ;;
  1552.       *)
  1553.     if test "$module" = no; then
  1554.       $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1555.       $echo "$help" 1>&2
  1556.       exit 1
  1557.     fi
  1558.     if test "$need_lib_prefix" != no; then
  1559.       # Add the "lib" prefix for modules if required
  1560.       name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1561.       eval libname=\"$libname_spec\"
  1562.     else
  1563.       libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1564.     fi
  1565.     ;;
  1566.       esac
  1567.  
  1568.       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1569.       if test "X$output_objdir" = "X$output"; then
  1570.     output_objdir="$objdir"
  1571.       else
  1572.     output_objdir="$output_objdir/$objdir"
  1573.       fi
  1574.  
  1575.       if test -n "$objs"; then
  1576.     $echo "$modename: cannot build libtool library \`$output' from non-libtool objects:$objs" 2>&1
  1577.     exit 1
  1578.       fi
  1579.  
  1580.       # How the heck are we supposed to write a wrapper for a shared library?
  1581.       if test -n "$link_against_libtool_libs"; then
  1582.      $echo "$modename: error: cannot link shared libraries into libtool libraries" 1>&2
  1583.      exit 1
  1584.       fi
  1585.  
  1586.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1587.     $echo "$modename: warning: \`-dlopen' is ignored for libtool libraries" 1>&2
  1588.       fi
  1589.  
  1590.       set dummy $rpath
  1591.       if test $# -gt 2; then
  1592.     $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1593.       fi
  1594.       install_libdir="$2"
  1595.  
  1596.       oldlibs=
  1597.       if test -z "$rpath"; then
  1598.     if test "$build_libtool_libs" = yes; then
  1599.       # Building a libtool convenience library.
  1600.       libext=al
  1601.       oldlibs="$output_objdir/$libname.$libext $oldlibs"
  1602.       build_libtool_libs=convenience
  1603.       build_old_libs=yes
  1604.     fi
  1605.     dependency_libs="$deplibs"
  1606.  
  1607.     if test -n "$vinfo"; then
  1608.       $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
  1609.     fi
  1610.  
  1611.     if test -n "$release"; then
  1612.       $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  1613.     fi
  1614.       else
  1615.  
  1616.     # Parse the version information argument.
  1617.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS=':'
  1618.     set dummy $vinfo 0 0 0
  1619.     IFS="$save_ifs"
  1620.  
  1621.     if test -n "$8"; then
  1622.       $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1623.       $echo "$help" 1>&2
  1624.       exit 1
  1625.     fi
  1626.  
  1627.     current="$2"
  1628.     revision="$3"
  1629.     age="$4"
  1630.  
  1631.     # Check that each of the things are valid numbers.
  1632.     case "$current" in
  1633.     0 | [1-9] | [1-9][0-9]*) ;;
  1634.     *)
  1635.       $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
  1636.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1637.       exit 1
  1638.       ;;
  1639.     esac
  1640.  
  1641.     case "$revision" in
  1642.     0 | [1-9] | [1-9][0-9]*) ;;
  1643.     *)
  1644.       $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
  1645.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1646.       exit 1
  1647.       ;;
  1648.     esac
  1649.  
  1650.     case "$age" in
  1651.     0 | [1-9] | [1-9][0-9]*) ;;
  1652.     *)
  1653.       $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
  1654.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1655.       exit 1
  1656.       ;;
  1657.     esac
  1658.  
  1659.     if test $age -gt $current; then
  1660.       $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1661.       $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1662.       exit 1
  1663.     fi
  1664.  
  1665.     # Calculate the version variables.
  1666.     major=
  1667.     versuffix=
  1668.     verstring=
  1669.     case "$version_type" in
  1670.     none) ;;
  1671.  
  1672.     irix)
  1673.       major=`expr $current - $age + 1`
  1674.       versuffix="$major.$revision"
  1675.       verstring="sgi$major.$revision"
  1676.  
  1677.       # Add in all the interfaces that we are compatible with.
  1678.       loop=$revision
  1679.       while test $loop != 0; do
  1680.         iface=`expr $revision - $loop`
  1681.         loop=`expr $loop - 1`
  1682.         verstring="sgi$major.$iface:$verstring"
  1683.       done
  1684.       ;;
  1685.  
  1686.     linux)
  1687.       major=.`expr $current - $age`
  1688.       versuffix="$major.$age.$revision"
  1689.       ;;
  1690.  
  1691.     osf)
  1692.       major=`expr $current - $age`
  1693.       versuffix=".$current.$age.$revision"
  1694.       verstring="$current.$age.$revision"
  1695.  
  1696.       # Add in all the interfaces that we are compatible with.
  1697.       loop=$age
  1698.       while test $loop != 0; do
  1699.         iface=`expr $current - $loop`
  1700.         loop=`expr $loop - 1`
  1701.         verstring="$verstring:${iface}.0"
  1702.       done
  1703.  
  1704.       # Make executables depend on our current version.
  1705.       verstring="$verstring:${current}.0"
  1706.       ;;
  1707.  
  1708.     sunos)
  1709.       major=".$current"
  1710.       versuffix=".$current.$revision"
  1711.       ;;
  1712.  
  1713.     freebsd-aout)
  1714.       major=".$current"
  1715.       versuffix=".$current.$revision";
  1716.       ;;
  1717.  
  1718.     freebsd-elf)
  1719.       major=".$current"
  1720.       versuffix=".$current";
  1721.       ;;
  1722.  
  1723.     windows)
  1724.       # Like Linux, but with '-' rather than '.', since we only
  1725.       # want one extension on Windows 95.
  1726.       major=`expr $current - $age`
  1727.       versuffix="-$major-$age-$revision"
  1728.       ;;
  1729.  
  1730.     *)
  1731.       $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1732.       echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1733.       exit 1
  1734.       ;;
  1735.     esac
  1736.  
  1737.     # Clear the version info if we defaulted, and they specified a release.
  1738.     if test -z "$vinfo" && test -n "$release"; then
  1739.       major=
  1740.       verstring="0.0"
  1741.       if test "$need_version" = no; then
  1742.         versuffix=
  1743.       else
  1744.         versuffix=".0.0"
  1745.       fi
  1746.     fi
  1747.  
  1748.     # Remove version info from name if versioning should be avoided
  1749.     if test "$avoid_version" = yes && test "$need_version" = no; then
  1750.       major=
  1751.       versuffix=
  1752.       verstring=""
  1753.     fi
  1754.     
  1755.     # Check to see if the archive will have undefined symbols.
  1756.     if test "$allow_undefined" = yes; then
  1757.       if test "$allow_undefined_flag" = unsupported; then
  1758.         $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1759.         build_libtool_libs=no
  1760.         build_old_libs=yes
  1761.       fi
  1762.     else
  1763.       # Don't allow undefined symbols.
  1764.       allow_undefined_flag="$no_undefined_flag"
  1765.     fi
  1766.  
  1767.     dependency_libs="$deplibs"
  1768.     case "$host" in
  1769.     *-*-cygwin* | *-*-mingw* | *-*-os2* | *-*-beos*)
  1770.       # these systems don't actually have a c library (as such)!
  1771.       ;;
  1772.     *)
  1773.       # Add libc to deplibs on all other systems.
  1774.       deplibs="$deplibs -lc"
  1775.       ;;
  1776.     esac
  1777.       fi
  1778.  
  1779.       # Create the output directory, or remove our outputs if we need to.
  1780.       if test -d $output_objdir; then
  1781.     $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
  1782.     $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
  1783.       else
  1784.     $show "$mkdir $output_objdir"
  1785.     $run $mkdir $output_objdir
  1786.     status=$?
  1787.     if test $status -ne 0 && test ! -d $output_objdir; then
  1788.       exit $status
  1789.     fi
  1790.       fi
  1791.  
  1792.       # Now set the variables for building old libraries.
  1793.       if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
  1794.     oldlibs="$oldlibs $output_objdir/$libname.$libext"
  1795.  
  1796.     # Transform .lo files to .o files.
  1797.     oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1798.       fi
  1799.  
  1800.       if test "$build_libtool_libs" = yes; then
  1801.     # Transform deplibs into only deplibs that can be linked in shared.
  1802.     name_save=$name
  1803.     libname_save=$libname
  1804.     release_save=$release
  1805.     versuffix_save=$versuffix
  1806.     major_save=$major
  1807.     # I'm not sure if I'm treating the release correctly.  I think
  1808.     # release should show up in the -l (ie -lgmp5) so we don't want to
  1809.     # add it in twice.  Is that correct?
  1810.     release=""
  1811.     versuffix=""
  1812.     major=""
  1813.     newdeplibs=
  1814.     droppeddeps=no
  1815.     case "$deplibs_check_method" in
  1816.     pass_all)
  1817.       # Don't check for shared/static.  Everything works.
  1818.       # This might be a little naive.  We might want to check
  1819.       # whether the library exists or not.  But this is on
  1820.       # osf3 & osf4 and I'm not really sure... Just
  1821.       # implementing what was already the behaviour.
  1822.       newdeplibs=$deplibs
  1823.       ;;
  1824.     test_compile)
  1825.       # This code stresses the "libraries are programs" paradigm to its
  1826.       # limits. Maybe even breaks it.  We compile a program, linking it
  1827.       # against the deplibs as a proxy for the library.  Then we can check
  1828.       # whether they linked in statically or dynamically with ldd.
  1829.       $rm conftest.c
  1830.       cat > conftest.c <<EOF
  1831.       int main() { return 0; }
  1832. EOF
  1833.       $rm conftest
  1834.       $C_compiler -o conftest conftest.c $deplibs
  1835.       if test $? -eq 0 ; then
  1836.         ldd_output=`ldd conftest`
  1837.         for i in $deplibs; do
  1838.           name="`expr $i : '-l\(.*\)'`"
  1839.           # If $name is empty we are operating on a -L argument.
  1840.           if test "$name" != "" ; then
  1841.         libname=`eval \\$echo \"$libname_spec\"`
  1842.         deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1843.         set dummy $deplib_matches
  1844.         deplib_match=$2
  1845.         if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1846.           newdeplibs="$newdeplibs $i"
  1847.         else
  1848.           droppeddeps=yes
  1849.           echo
  1850.           echo "*** Warning: This library needs some functionality provided by $i."
  1851.           echo "*** I have the capability to make that library automatically link in when"
  1852.           echo "*** you link to this library.  But I can only do this if you have a"
  1853.           echo "*** shared version of the library, which you do not appear to have."
  1854.         fi
  1855.           else
  1856.         newdeplibs="$newdeplibs $i"
  1857.           fi
  1858.         done
  1859.       else
  1860.         # Error occured in the first compile.  Let's try to salvage the situation:
  1861.         # Compile a seperate program for each library.
  1862.         for i in $deplibs; do
  1863.           name="`expr $i : '-l\(.*\)'`"
  1864.          # If $name is empty we are operating on a -L argument.
  1865.           if test "$name" != "" ; then
  1866.         $rm conftest
  1867.         $C_compiler -o conftest conftest.c $i
  1868.         # Did it work?
  1869.         if test $? -eq 0 ; then
  1870.           ldd_output=`ldd conftest`
  1871.           libname=`eval \\$echo \"$libname_spec\"`
  1872.           deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1873.           set dummy $deplib_matches
  1874.           deplib_match=$2
  1875.           if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1876.             newdeplibs="$newdeplibs $i"
  1877.           else
  1878.             droppeddeps=yes
  1879.             echo
  1880.             echo "*** Warning: This library needs some functionality provided by $i."
  1881.             echo "*** I have the capability to make that library automatically link in when"
  1882.             echo "*** you link to this library.  But I can only do this if you have a"
  1883.             echo "*** shared version of the library, which you do not appear to have."
  1884.           fi
  1885.         else
  1886.           droppeddeps=yes
  1887.           echo
  1888.           echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1889.           echo "***  make it link in!  You will probably need to install it or some"
  1890.           echo "*** library that it depends on before this library will be fully"
  1891.           echo "*** functional.  Installing it before continuing would be even better."
  1892.         fi
  1893.           else
  1894.         newdeplibs="$newdeplibs $i"
  1895.           fi
  1896.         done
  1897.       fi
  1898.       ;;
  1899.     file_magic*)
  1900.       set dummy $deplibs_check_method
  1901.       file_magic_regex="`expr \"$deplibs_check_method\" : \"$2 \(.*\)\"`"
  1902.       for a_deplib in $deplibs; do
  1903.         name="`expr $a_deplib : '-l\(.*\)'`"
  1904.         # If $name is empty we are operating on a -L argument.
  1905.         if test "$name" != "" ; then
  1906.           libname=`eval \\$echo \"$libname_spec\"`
  1907.           for i in $lib_search_path; do
  1908.             potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1909.             for potent_lib in $potential_libs; do
  1910.               # Follow soft links.
  1911.               if ls -lLd "$potent_lib" 2>/dev/null \
  1912.              | grep " -> " >/dev/null; then
  1913.             continue 
  1914.               fi
  1915.               # The statement above tries to avoid entering an
  1916.               # endless loop below, in case of cyclic links.
  1917.               # We might still enter an endless loop, since a link
  1918.               # loop can be closed while we follow links,
  1919.               # but so what?
  1920.               potlib="$potent_lib"
  1921.               while test -h "$potlib" 2>/dev/null; do
  1922.             potliblink=`ls -ld $potlib | sed 's/.* -> //'`
  1923.             case "$potliblink" in
  1924.             [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  1925.             *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  1926.             esac
  1927.               done
  1928.               if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  1929.              | sed 10q \
  1930.              | egrep "$file_magic_regex" > /dev/null; then
  1931.             newdeplibs="$newdeplibs $a_deplib"
  1932.             a_deplib=""
  1933.             break 2
  1934.               fi
  1935.             done
  1936.           done
  1937.           if test -n "$a_deplib" ; then
  1938.         droppeddeps=yes
  1939.         echo
  1940.         echo "*** Warning: This library needs some functionality provided by $a_deplib."
  1941.         echo "*** I have the capability to make that library automatically link in when"
  1942.         echo "*** you link to this library.  But I can only do this if you have a"
  1943.         echo "*** shared version of the library, which you do not appear to have."
  1944.           fi
  1945.         else
  1946.           # Add a -L argument.
  1947.           newdeplibs="$newdeplibs $a_deplib"
  1948.         fi
  1949.       done # Gone through all deplibs.
  1950.       ;;
  1951.     none | unknown | *)
  1952.       newdeplibs=""
  1953.       if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  1954.            -e 's/ -[LR][^ ]*//g' -e 's/[     ]//g' |
  1955.          grep . >/dev/null; then
  1956.         echo
  1957.         if test "X$deplibs_check_method" = "Xnone"; then
  1958.           echo "*** Warning: inter-library dependencies are not supported in this platform."
  1959.         else
  1960.           echo "*** Warning: inter-library dependencies are not known to be supported."
  1961.         fi
  1962.         echo "*** All declared inter-library dependencies are being dropped."
  1963.         droppeddeps=yes
  1964.       fi
  1965.       ;;
  1966.     esac
  1967.     versuffix=$versuffix_save
  1968.     major=$major_save
  1969.     release=$release_save
  1970.     libname=$libname_save
  1971.     name=$name_save
  1972.  
  1973.     if test "$droppeddeps" = yes; then
  1974.       if test "$module" = yes; then
  1975.         echo
  1976.         echo "*** Warning: libtool could not satisfy all declared inter-library"
  1977.         echo "*** dependencies of module $libname.  Therefore, libtool will create"
  1978.         echo "*** a static module, that should work as long as the dlopening"
  1979.         echo "*** application is linked with the -dlopen flag."
  1980.         if test -z "$global_symbol_pipe"; then
  1981.           echo
  1982.           echo "*** However, this would only work if libtool was able to extract symbol"
  1983.           echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1984.           echo "*** not find such a program.  So, this module is probably useless."
  1985.           echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1986.         fi
  1987.         if test "$build_old_libs" = no; then
  1988.           oldlibs="$output_objdir/$libname.$libext"
  1989.           build_libtool_libs=module
  1990.           build_old_libs=yes
  1991.         else
  1992.           build_libtool_libs=no
  1993.         fi
  1994.       else
  1995.         echo "*** The inter-library dependencies that have been dropped here will be"
  1996.         echo "*** automatically added whenever a program is linked with this library"
  1997.         echo "*** or is declared to -dlopen it."
  1998.       fi
  1999.     fi
  2000.     # Done checking deplibs!
  2001.     deplibs=$newdeplibs
  2002.       fi
  2003.  
  2004.       # All the library-specific variables (install_libdir is set above).
  2005.       library_names=
  2006.       old_library=
  2007.       dlname=
  2008.       
  2009.       # Test again, we may have decided not to build it any more
  2010.       if test "$build_libtool_libs" = yes; then
  2011.     # Get the real and link names of the library.
  2012.     eval library_names=\"$library_names_spec\"
  2013.     set dummy $library_names
  2014.     realname="$2"
  2015.     shift; shift
  2016.  
  2017.     if test -n "$soname_spec"; then
  2018.       eval soname=\"$soname_spec\"
  2019.     else
  2020.       soname="$realname"
  2021.     fi
  2022.  
  2023.     lib="$output_objdir/$realname"
  2024.     for link
  2025.     do
  2026.       linknames="$linknames $link"
  2027.     done
  2028.  
  2029.     # Ensure that we have .o objects for linkers which dislike .lo
  2030.     # (e.g. aix) incase we are running --disable-static
  2031.     for obj in $libobjs; do
  2032.       oldobj=`$echo "X$obj" | $Xsed -e "$lo2o"`
  2033.       if test ! -f $oldobj; then
  2034.         $show "${LN_S} $obj $oldobj"
  2035.         $run ${LN_S} $obj $oldobj || exit $?
  2036.       fi
  2037.     done
  2038.  
  2039.     # Use standard objects if they are pic
  2040.     test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2041.  
  2042.     # Prepare the list of exported symbols
  2043.     if test -z "$export_symbols"; then
  2044.       if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  2045.         $show "generating symbol list for \`$libname.la'"
  2046.         export_symbols="$output_objdir/$libname.exp"
  2047.         $run $rm $export_symbols
  2048.         eval cmds=\"$export_symbols_cmds\"
  2049.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2050.         for cmd in $cmds; do
  2051.           IFS="$save_ifs"
  2052.           $show "$cmd"
  2053.           $run eval "$cmd" || exit $?
  2054.         done
  2055.         IFS="$save_ifs"
  2056.         if test -n "$export_symbols_regex"; then
  2057.           $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  2058.           $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  2059.           $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  2060.           $run eval '$mv "${export_symbols}T" "$export_symbols"'
  2061.         fi
  2062.       fi
  2063.     fi
  2064.  
  2065.     if test -n "$export_symbols" && test -n "$include_expsyms"; then
  2066.       $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  2067.     fi
  2068.  
  2069.     if test -n "$convenience"; then
  2070.       if test -n "$whole_archive_flag_spec"; then
  2071.         eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  2072.       else
  2073.         gentop="$output_objdir/${outputname}x"
  2074.         $show "${rm}r $gentop"
  2075.         $run ${rm}r "$gentop"
  2076.         $show "mkdir $gentop"
  2077.         $run mkdir "$gentop"
  2078.         status=$?
  2079.         if test $status -ne 0 && test ! -d "$gentop"; then
  2080.           exit $status
  2081.         fi
  2082.         generated="$generated $gentop"
  2083.  
  2084.         for xlib in $convenience; do
  2085.           # Extract the objects.
  2086.           case "$xlib" in
  2087.           [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2088.           *) xabs=`pwd`"/$xlib" ;;
  2089.           esac
  2090.           xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2091.           xdir="$gentop/$xlib"
  2092.  
  2093.           $show "${rm}r $xdir"
  2094.           $run ${rm}r "$xdir"
  2095.           $show "mkdir $xdir"
  2096.           $run mkdir "$xdir"
  2097.           status=$?
  2098.           if test $status -ne 0 && test ! -d "$xdir"; then
  2099.         exit $status
  2100.           fi
  2101.           $show "(cd $xdir && $AR x $xabs)"
  2102.           $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2103.  
  2104.           libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2105.         done
  2106.       fi
  2107.     fi
  2108.  
  2109.     if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  2110.       eval flag=\"$thread_safe_flag_spec\"
  2111.       linkopts="$linkopts $flag"
  2112.     fi
  2113.  
  2114.     # Do each of the archive commands.
  2115.     if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  2116.       eval cmds=\"$archive_expsym_cmds\"
  2117.     else
  2118.       eval cmds=\"$archive_cmds\"
  2119.     fi
  2120.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2121.     for cmd in $cmds; do
  2122.       IFS="$save_ifs"
  2123.       $show "$cmd"
  2124.       $run eval "$cmd" || exit $?
  2125.     done
  2126.     IFS="$save_ifs"
  2127.  
  2128.     # Create links to the real library.
  2129.     for linkname in $linknames; do
  2130.       if test "$realname" != "$linkname"; then
  2131.         $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  2132.         $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  2133.       fi
  2134.     done
  2135.  
  2136.     # If -module or -export-dynamic was specified, set the dlname.
  2137.     if test "$module" = yes || test "$export_dynamic" = yes; then
  2138.       # On all known operating systems, these are identical.
  2139.       dlname="$soname"
  2140.     fi
  2141.       fi
  2142.       ;;
  2143.  
  2144.     *.lo | *.o | *.obj)
  2145.       if test -n "$link_against_libtool_libs"; then
  2146.     $echo "$modename: error: cannot link libtool libraries into objects" 1>&2
  2147.     exit 1
  2148.       fi
  2149.  
  2150.       if test -n "$deplibs"; then
  2151.     $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  2152.       fi
  2153.  
  2154.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2155.     $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  2156.       fi
  2157.  
  2158.       if test -n "$rpath"; then
  2159.     $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  2160.       fi
  2161.  
  2162.       if test -n "$xrpath"; then
  2163.     $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  2164.       fi
  2165.  
  2166.       if test -n "$vinfo"; then
  2167.     $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  2168.       fi
  2169.  
  2170.       if test -n "$release"; then
  2171.     $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  2172.       fi
  2173.  
  2174.       case "$output" in
  2175.       *.lo)
  2176.     if test -n "$objs"; then
  2177.       $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  2178.       exit 1
  2179.     fi
  2180.     libobj="$output"
  2181.     obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  2182.     ;;
  2183.       *)
  2184.     libobj=
  2185.     obj="$output"
  2186.     ;;
  2187.       esac
  2188.  
  2189.       # Delete the old objects.
  2190.       $run $rm $obj $libobj
  2191.  
  2192.       # Objects from convenience libraries.  This assumes
  2193.       # single-version convenience libraries.  Whenever we create
  2194.       # different ones for PIC/non-PIC, this we'll have to duplicate
  2195.       # the extraction.
  2196.       reload_conv_objs=
  2197.       gentop=
  2198.       # reload_cmds runs $LD directly, so let us get rid of
  2199.       # -Wl from whole_archive_flag_spec
  2200.       wl= 
  2201.  
  2202.       if test -n "$convenience"; then
  2203.     if test -n "$whole_archive_flag_spec"; then
  2204.       eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  2205.     else
  2206.       gentop="$output_objdir/${obj}x"
  2207.       $show "${rm}r $gentop"
  2208.       $run ${rm}r "$gentop"
  2209.       $show "mkdir $gentop"
  2210.       $run mkdir "$gentop"
  2211.       status=$?
  2212.       if test $status -ne 0 && test ! -d "$gentop"; then
  2213.         exit $status
  2214.       fi
  2215.       generated="$generated $gentop"
  2216.  
  2217.       for xlib in $convenience; do
  2218.         # Extract the objects.
  2219.         case "$xlib" in
  2220.         [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2221.         *) xabs=`pwd`"/$xlib" ;;
  2222.         esac
  2223.         xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2224.         xdir="$gentop/$xlib"
  2225.  
  2226.         $show "${rm}r $xdir"
  2227.         $run ${rm}r "$xdir"
  2228.         $show "mkdir $xdir"
  2229.         $run mkdir "$xdir"
  2230.         status=$?
  2231.         if test $status -ne 0 && test ! -d "$xdir"; then
  2232.           exit $status
  2233.         fi
  2234.         $show "(cd $xdir && $AR x $xabs)"
  2235.         $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2236.  
  2237.         reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
  2238.       done
  2239.     fi
  2240.       fi
  2241.  
  2242.       # Create the old-style object.
  2243.       reload_objs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs"
  2244.  
  2245.       output="$obj"
  2246.       eval cmds=\"$reload_cmds\"
  2247.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2248.       for cmd in $cmds; do
  2249.     IFS="$save_ifs"
  2250.     $show "$cmd"
  2251.     $run eval "$cmd" || exit $?
  2252.       done
  2253.       IFS="$save_ifs"
  2254.  
  2255.       # Exit if we aren't doing a library object file.
  2256.       if test -z "$libobj"; then
  2257.     if test -n "$gentop"; then
  2258.       $show "${rm}r $gentop"
  2259.       $run ${rm}r $gentop
  2260.     fi
  2261.  
  2262.     exit 0
  2263.       fi
  2264.  
  2265.       if test "$build_libtool_libs" != yes; then
  2266.     if test -n "$gentop"; then
  2267.       $show "${rm}r $gentop"
  2268.       $run ${rm}r $gentop
  2269.     fi
  2270.  
  2271.     # Create an invalid libtool object if no PIC, so that we don't
  2272.     # accidentally link it into a program.
  2273.     $show "echo timestamp > $libobj"
  2274.     $run eval "echo timestamp > $libobj" || exit $?
  2275.     exit 0
  2276.       fi
  2277.  
  2278.       if test -n "$pic_flag"; then
  2279.     # Only do commands if we really have different PIC objects.
  2280.     reload_objs="$libobjs $reload_conv_objs"
  2281.     output="$libobj"
  2282.     eval cmds=\"$reload_cmds\"
  2283.     IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2284.     for cmd in $cmds; do
  2285.       IFS="$save_ifs"
  2286.       $show "$cmd"
  2287.       $run eval "$cmd" || exit $?
  2288.     done
  2289.     IFS="$save_ifs"
  2290.       else
  2291.     # Just create a symlink.
  2292.     $show $rm $libobj
  2293.     $run $rm $libobj
  2294.     $show "$LN_S $obj $libobj"
  2295.     $run $LN_S $obj $libobj || exit $?
  2296.       fi
  2297.  
  2298.       if test -n "$gentop"; then
  2299.     $show "${rm}r $gentop"
  2300.     $run ${rm}r $gentop
  2301.       fi
  2302.  
  2303.       exit 0
  2304.       ;;
  2305.  
  2306.     # Anything else should be a program.
  2307.     *)
  2308.       if test -n "$vinfo"; then
  2309.     $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  2310.       fi
  2311.  
  2312.       if test -n "$release"; then
  2313.     $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  2314.       fi
  2315.  
  2316.       if test "$preload" = yes; then
  2317.     if test "$dlopen" = unknown && test "$dlopen_self" = unknown &&
  2318.        test "$dlopen_self_static" = unknown; then
  2319.       $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  2320.     fi 
  2321.       fi
  2322.     
  2323.       if test -n "$rpath$xrpath"; then
  2324.     # If the user specified any rpath flags, then add them.
  2325.     for libdir in $rpath $xrpath; do
  2326.       # This is the magic to use -rpath.
  2327.       case "$compile_rpath " in
  2328.       *" $libdir "*) ;;
  2329.       *) compile_rpath="$compile_rpath $libdir" ;;
  2330.       esac
  2331.       case "$finalize_rpath " in
  2332.       *" $libdir "*) ;;
  2333.       *) finalize_rpath="$finalize_rpath $libdir" ;;
  2334.       esac
  2335.     done
  2336.       fi
  2337.  
  2338.       # Now hardcode the library paths
  2339.       rpath=
  2340.       hardcode_libdirs=
  2341.       for libdir in $compile_rpath $finalize_rpath; do
  2342.     if test -n "$hardcode_libdir_flag_spec"; then
  2343.       if test -n "$hardcode_libdir_separator"; then
  2344.         if test -z "$hardcode_libdirs"; then
  2345.           hardcode_libdirs="$libdir"
  2346.         else
  2347.           # Just accumulate the unique libdirs.
  2348.           case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2349.           *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2350.         ;;
  2351.           *)
  2352.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2353.         ;;
  2354.           esac
  2355.         fi
  2356.       else
  2357.         eval flag=\"$hardcode_libdir_flag_spec\"
  2358.         rpath="$rpath $flag"
  2359.       fi
  2360.     elif test -n "$runpath_var"; then
  2361.       case "$perm_rpath " in
  2362.       *" $libdir "*) ;;
  2363.       *) perm_rpath="$perm_rpath $libdir" ;;
  2364.       esac
  2365.     fi
  2366.       done
  2367.       # Substitute the hardcoded libdirs into the rpath.
  2368.       if test -n "$hardcode_libdir_separator" &&
  2369.      test -n "$hardcode_libdirs"; then
  2370.     libdir="$hardcode_libdirs"
  2371.     eval rpath=\" $hardcode_libdir_flag_spec\"
  2372.       fi
  2373.       compile_rpath="$rpath"
  2374.  
  2375.       rpath=
  2376.       hardcode_libdirs=
  2377.       for libdir in $finalize_rpath; do
  2378.     if test -n "$hardcode_libdir_flag_spec"; then
  2379.       if test -n "$hardcode_libdir_separator"; then
  2380.         if test -z "$hardcode_libdirs"; then
  2381.           hardcode_libdirs="$libdir"
  2382.         else
  2383.           # Just accumulate the unique libdirs.
  2384.           case "$hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator" in
  2385.           *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
  2386.         ;;
  2387.           *)
  2388.         hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
  2389.         ;;
  2390.           esac
  2391.         fi
  2392.       else
  2393.         eval flag=\"$hardcode_libdir_flag_spec\"
  2394.         rpath="$rpath $flag"
  2395.       fi
  2396.     elif test -n "$runpath_var"; then
  2397.       case "$finalize_perm_rpath " in
  2398.       *" $libdir "*) ;;
  2399.       *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
  2400.       esac
  2401.     fi
  2402.       done
  2403.       # Substitute the hardcoded libdirs into the rpath.
  2404.       if test -n "$hardcode_libdir_separator" &&
  2405.      test -n "$hardcode_libdirs"; then
  2406.     libdir="$hardcode_libdirs"
  2407.     eval rpath=\" $hardcode_libdir_flag_spec\"
  2408.       fi
  2409.       finalize_rpath="$rpath"
  2410.  
  2411.       output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  2412.       if test "X$output_objdir" = "X$output"; then
  2413.     output_objdir="$objdir"
  2414.       else
  2415.     output_objdir="$output_objdir/$objdir"
  2416.       fi
  2417.  
  2418.       # Create the binary in the object directory, then wrap it.
  2419.       if test ! -d $output_objdir; then
  2420.     $show "$mkdir $output_objdir"
  2421.     $run $mkdir $output_objdir
  2422.     status=$?
  2423.     if test $status -ne 0 && test ! -d $output_objdir; then
  2424.       exit $status
  2425.     fi
  2426.       fi
  2427.  
  2428.       if test -n "$libobjs" && test "$build_old_libs" = yes; then
  2429.     # Transform all the library objects into standard objects.
  2430.     compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2431.     finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2432.       fi
  2433.  
  2434.       dlsyms=
  2435.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2436.     if test -n "$NM" && test -n "$global_symbol_pipe"; then
  2437.       dlsyms="${outputname}S.c"
  2438.     else
  2439.       $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  2440.     fi
  2441.       fi
  2442.  
  2443.       if test -n "$dlsyms"; then
  2444.     case "$dlsyms" in
  2445.     "") ;;
  2446.     *.c)
  2447.       # Discover the nlist of each of the dlfiles.
  2448.       nlist="$output_objdir/${outputname}.nm"
  2449.  
  2450.       $show "$rm $nlist ${nlist}S ${nlist}T"
  2451.       $run $rm "$nlist" "${nlist}S" "${nlist}T"
  2452.  
  2453.       # Parse the name list into a source file.
  2454.       $show "creating $output_objdir/$dlsyms"
  2455.  
  2456.       test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  2457. /* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  2458. /* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  2459.  
  2460. #ifdef __cplusplus
  2461. extern \"C\" {
  2462. #endif
  2463.  
  2464. /* Prevent the only kind of declaration conflicts we can make. */
  2465. #define lt_preloaded_symbols some_other_symbol
  2466.  
  2467. /* External symbol declarations for the compiler. */\
  2468. "
  2469.  
  2470.       if test "$dlself" = yes; then
  2471.         $show "generating symbol list for \`$output'"
  2472.  
  2473.         test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
  2474.  
  2475.         # Add our own program objects to the symbol list.
  2476.         progfiles=`$echo "X$objs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  2477.         for arg in $progfiles; do
  2478.           $show "extracting global C symbols from \`$arg'"
  2479.           $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2480.         done
  2481.  
  2482.         if test -n "$exclude_expsyms"; then
  2483.           $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  2484.           $run eval '$mv "$nlist"T "$nlist"'
  2485.         fi
  2486.         
  2487.         if test -n "$export_symbols_regex"; then
  2488.           $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  2489.           $run eval '$mv "$nlist"T "$nlist"'
  2490.         fi
  2491.  
  2492.         # Prepare the list of exported symbols
  2493.         if test -z "$export_symbols"; then
  2494.           export_symbols="$output_objdir/$output.exp"
  2495.           $run $rm $export_symbols
  2496.           $run eval "sed -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  2497.         else
  2498.           $run eval "sed -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
  2499.           $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
  2500.           $run eval 'mv "$nlist"T "$nlist"'
  2501.         fi
  2502.       fi
  2503.  
  2504.       for arg in $dlprefiles; do
  2505.         $show "extracting global C symbols from \`$arg'"
  2506.         name=`echo "$arg" | sed -e 's%^.*/%%'`
  2507.         $run eval 'echo ": $name " >> "$nlist"'
  2508.         $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
  2509.       done
  2510.  
  2511.       if test -z "$run"; then
  2512.         # Make sure we have at least an empty file.
  2513.         test -f "$nlist" || : > "$nlist"
  2514.  
  2515.         if test -n "$exclude_expsyms"; then
  2516.           egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  2517.           $mv "$nlist"T "$nlist"
  2518.         fi
  2519.  
  2520.         # Try sorting and uniquifying the output.
  2521.         if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
  2522.           :
  2523.         else
  2524.           grep -v "^: " < "$nlist" > "$nlist"S
  2525.         fi
  2526.  
  2527.         if test -f "$nlist"S; then
  2528.           eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
  2529.         else
  2530.           echo '/* NONE */' >> "$output_objdir/$dlsyms"
  2531.         fi
  2532.  
  2533.         $echo >> "$output_objdir/$dlsyms" "\
  2534.  
  2535. #undef lt_preloaded_symbols
  2536.  
  2537. #if defined (__STDC__) && __STDC__
  2538. # define lt_ptr_t void *
  2539. #else
  2540. # define lt_ptr_t char *
  2541. # define const
  2542. #endif
  2543.  
  2544. /* The mapping between symbol names and symbols. */
  2545. const struct {
  2546.   const char *name;
  2547.   lt_ptr_t address;
  2548. }
  2549. lt_preloaded_symbols[] =
  2550. {\
  2551. "
  2552.  
  2553.         sed -n -e 's/^: \([^ ]*\) $/  {\"\1\", (lt_ptr_t) 0},/p' \
  2554.         -e 's/^. \([^ ]*\) \([^ ]*\)$/  {"\2", (lt_ptr_t) \&\2},/p' \
  2555.           < "$nlist" >> "$output_objdir/$dlsyms"
  2556.  
  2557.         $echo >> "$output_objdir/$dlsyms" "\
  2558.   {0, (lt_ptr_t) 0}
  2559. };
  2560.  
  2561. /* This works around a problem in FreeBSD linker */
  2562. #ifdef FREEBSD_WORKAROUND
  2563. static const void *lt_preloaded_setup() {
  2564.   return lt_preloaded_symbols;
  2565. }
  2566. #endif
  2567.  
  2568. #ifdef __cplusplus
  2569. }
  2570. #endif\
  2571. "
  2572.       fi
  2573.  
  2574.       pic_flag_for_symtable=
  2575.       case "$host" in
  2576.       # compiling the symbol table file with pic_flag works around
  2577.       # a FreeBSD bug that causes programs to crash when -lm is
  2578.       # linked before any other PIC object.  But we must not use
  2579.       # pic_flag when linking with -static.  The problem exists in
  2580.       # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  2581.       *-*-freebsd2*|*-*-freebsd3.0*)
  2582.         case "$compile_command " in
  2583.         *" -static "*) ;;
  2584.         *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
  2585.         esac
  2586.       esac
  2587.  
  2588.       # Now compile the dynamic symbol file.
  2589.       $show "(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
  2590.       $run eval '(cd $output_objdir && $C_compiler -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
  2591.  
  2592.       # Clean up the generated files.
  2593.       $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
  2594.       $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
  2595.  
  2596.       # Transform the symbol file into the correct name.
  2597.       compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2598.       finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
  2599.       ;;
  2600.     *)
  2601.       $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
  2602.       exit 1
  2603.       ;;
  2604.     esac
  2605.       else
  2606.     # We keep going just in case the user didn't refer to
  2607.     # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  2608.     # really was required.
  2609.  
  2610.     # Nullify the symbol file.
  2611.     compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  2612.     finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  2613.       fi
  2614.  
  2615.       if test -z "$link_against_libtool_libs" || test "$build_libtool_libs" != yes; then
  2616.     # Replace the output file specification.
  2617.     compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
  2618.     link_command="$compile_command$compile_rpath"
  2619.  
  2620.     # We have no uninstalled library dependencies, so finalize right now.
  2621.     $show "$link_command"
  2622.     $run eval "$link_command"
  2623.     status=$?
  2624.     
  2625.     # Delete the generated files.
  2626.     if test -n "$dlsyms"; then
  2627.       $show "$rm $output_objdir/${outputname}S.${objext}"
  2628.       $run $rm "$output_objdir/${outputname}S.${objext}"
  2629.     fi
  2630.  
  2631.     exit $status
  2632.       fi
  2633.  
  2634.       if test -n "$shlibpath_var"; then
  2635.     # We should set the shlibpath_var
  2636.     rpath=
  2637.     for dir in $temp_rpath; do
  2638.       case "$dir" in
  2639.       [\\/]* | [A-Za-z]:[\\/]*)
  2640.         # Absolute path.
  2641.         rpath="$rpath$dir:"
  2642.         ;;
  2643.       *)
  2644.         # Relative path: add a thisdir entry.
  2645.         rpath="$rpath\$thisdir/$dir:"
  2646.         ;;
  2647.       esac
  2648.     done
  2649.     temp_rpath="$rpath"
  2650.       fi
  2651.  
  2652.       if test -n "$compile_shlibpath$finalize_shlibpath"; then
  2653.     compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
  2654.       fi
  2655.       if test -n "$finalize_shlibpath"; then
  2656.     finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
  2657.       fi
  2658.  
  2659.       compile_var=
  2660.       finalize_var=
  2661.       if test -n "$runpath_var"; then
  2662.     if test -n "$perm_rpath"; then
  2663.       # We should set the runpath_var.
  2664.       rpath=
  2665.       for dir in $perm_rpath; do
  2666.         rpath="$rpath$dir:"
  2667.       done
  2668.       compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2669.     fi
  2670.     if test -n "$finalize_perm_rpath"; then
  2671.       # We should set the runpath_var.
  2672.       rpath=
  2673.       for dir in $finalize_perm_rpath; do
  2674.         rpath="$rpath$dir:"
  2675.       done
  2676.       finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
  2677.     fi
  2678.       fi
  2679.  
  2680.       if test "$hardcode_action" = relink; then
  2681.     # Fast installation is not supported
  2682.     link_command="$compile_var$compile_command$compile_rpath"
  2683.     relink_command="$finalize_var$finalize_command$finalize_rpath"
  2684.     
  2685.     $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
  2686.     $echo "$modename: \`$output' will be relinked during installation" 1>&2
  2687.       else
  2688.     if test "$fast_install" != no; then
  2689.       link_command="$finalize_var$compile_command$finalize_rpath"
  2690.       if test "$fast_install" = yes; then
  2691.         relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
  2692.       else
  2693.         # fast_install is set to needless
  2694.         relink_command=
  2695.       fi
  2696.     else
  2697.       link_command="$compile_var$compile_command$compile_rpath"
  2698.       relink_command="$finalize_var$finalize_command$finalize_rpath"
  2699.     fi
  2700.       fi
  2701.  
  2702.       # Replace the output file specification.
  2703.       link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
  2704.       
  2705.       # Delete the old output files.
  2706.       $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
  2707.  
  2708.       $show "$link_command"
  2709.       $run eval "$link_command" || exit $?
  2710.  
  2711.       # Now create the wrapper script.
  2712.       $show "creating $output"
  2713.  
  2714.       # Quote the relink command for shipping.
  2715.       if test -n "$relink_command"; then
  2716.     relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
  2717.       fi
  2718.  
  2719.       # Quote $echo for shipping.
  2720.       if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
  2721.     case "$0" in
  2722.     [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
  2723.     *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
  2724.     esac
  2725.     qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
  2726.       else
  2727.     qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
  2728.       fi
  2729.  
  2730.       # Only actually do things if our run command is non-null.
  2731.       if test -z "$run"; then
  2732.     # win32 will think the script is a binary if it has
  2733.     # a .exe suffix, so we strip it off here.
  2734.     case $output in
  2735.       *.exe) output=`echo $output|sed 's,.exe$,,'` ;;
  2736.     esac
  2737.     $rm $output
  2738.     trap "$rm $output; exit 1" 1 2 15
  2739.  
  2740.     $echo > $output "\
  2741. #! $SHELL
  2742.  
  2743. # $output - temporary wrapper script for $objdir/$outputname
  2744. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  2745. #
  2746. # The $output program cannot be directly executed until all the libtool
  2747. # libraries that it depends on are installed.
  2748. #
  2749. # This wrapper script should never be moved out of the build directory.
  2750. # If it is, it will not operate correctly.
  2751.  
  2752. # Sed substitution that helps us do robust quoting.  It backslashifies
  2753. # metacharacters that are still active within double-quoted strings.
  2754. Xsed='sed -e 1s/^X//'
  2755. sed_quote_subst='$sed_quote_subst'
  2756.  
  2757. # The HP-UX ksh and POSIX shell print the target directory to stdout
  2758. # if CDPATH is set.
  2759. if test \"\${CDPATH+set}\" = set; then CDPATH=; export CDPATH; fi
  2760.  
  2761. relink_command=\"$relink_command\"
  2762.  
  2763. # This environment variable determines our operation mode.
  2764. if test \"\$libtool_install_magic\" = \"$magic\"; then
  2765.   # install mode needs the following variable:
  2766.   link_against_libtool_libs='$link_against_libtool_libs'
  2767. else
  2768.   # When we are sourced in execute mode, \$file and \$echo are already set.
  2769.   if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2770.     echo=\"$qecho\"
  2771.     file=\"\$0\"
  2772.     # Make sure echo works.
  2773.     if test \"X\$1\" = X--no-reexec; then
  2774.       # Discard the --no-reexec flag, and continue.
  2775.       shift
  2776.     elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
  2777.       # Yippee, \$echo works!
  2778.       :
  2779.     else
  2780.       # Restart under the correct shell, and then maybe \$echo will work.
  2781.       exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  2782.     fi
  2783.   fi\
  2784. "
  2785.     $echo >> $output "\
  2786.  
  2787.   # Find the directory that this script lives in.
  2788.   thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  2789.   test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  2790.  
  2791.   # Follow symbolic links until we get to the real thisdir.
  2792.   file=\`ls -ld \"\$file\" | sed -n 's/.*-> //p'\`
  2793.   while test -n \"\$file\"; do
  2794.     destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  2795.  
  2796.     # If there was a directory component, then change thisdir.
  2797.     if test \"x\$destdir\" != \"x\$file\"; then
  2798.       case \"\$destdir\" in
  2799.       [\\/]* | [A-Za-z]:[\\/]*) thisdir=\"\$destdir\" ;;
  2800.       *) thisdir=\"\$thisdir/\$destdir\" ;;
  2801.       esac
  2802.     fi
  2803.  
  2804.     file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  2805.     file=\`ls -ld \"\$thisdir/\$file\" | sed -n 's/.*-> //p'\`
  2806.   done
  2807.  
  2808.   # Try to get the absolute directory name.
  2809.   absdir=\`cd \"\$thisdir\" && pwd\`
  2810.   test -n \"\$absdir\" && thisdir=\"\$absdir\"
  2811. "
  2812.  
  2813.     if test "$fast_install" = yes; then
  2814.       echo >> $output "\
  2815.   program=lt-'$outputname'
  2816.   progdir=\"\$thisdir/$objdir\"
  2817.   
  2818.   if test ! -f \"\$progdir/\$program\" || \\
  2819.      { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | sed 1q\`; \\
  2820.        test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  2821.  
  2822.     file=\"\$\$-\$program\"
  2823.  
  2824.     if test ! -d \"\$progdir\"; then
  2825.       $mkdir \"\$progdir\"
  2826.     else
  2827.       $rm \"\$progdir/\$file\"
  2828.     fi"
  2829.  
  2830.       echo >> $output "\
  2831.  
  2832.     # relink executable if necessary
  2833.     if test -n \"\$relink_command\"; then
  2834.       if (cd \"\$thisdir\" && eval \$relink_command); then :
  2835.       else
  2836.     $rm \"\$progdir/\$file\"
  2837.     exit 1
  2838.       fi
  2839.     fi
  2840.  
  2841.     $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  2842.     { $rm \"\$progdir/\$program\";
  2843.       $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  2844.     $rm \"\$progdir/\$file\"
  2845.   fi"
  2846.     else
  2847.       echo >> $output "\
  2848.   program='$outputname$exeext'
  2849.   progdir=\"\$thisdir/$objdir\"
  2850. "
  2851.     fi
  2852.  
  2853.     echo >> $output "\
  2854.  
  2855.   if test -f \"\$progdir/\$program\"; then"
  2856.  
  2857.     # Export our shlibpath_var if we have one.
  2858.     if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  2859.       $echo >> $output "\
  2860.     # Add our own library path to $shlibpath_var
  2861.     $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  2862.  
  2863.     # Some systems cannot cope with colon-terminated $shlibpath_var
  2864.     # The second colon is a workaround for a bug in BeOS R4 sed
  2865.     $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  2866.  
  2867.     export $shlibpath_var
  2868. "
  2869.     fi
  2870.  
  2871.     # fixup the dll searchpath if we need to.
  2872.     if test -n "$dllsearchpath"; then
  2873.       $echo >> $output "\
  2874.     # Add the dll search path components to the executable PATH
  2875.     PATH=$dllsearchpath:\$PATH
  2876. "
  2877.     fi
  2878.  
  2879.     $echo >> $output "\
  2880.     if test \"\$libtool_execute_magic\" != \"$magic\"; then
  2881.       # Run the actual program with our arguments.
  2882. "
  2883.     case $host in
  2884.     *-*-cygwin* | *-*-mingw | *-*-os2*)
  2885.       # win32 systems need to use the prog path for dll
  2886.       # lookup to work
  2887.       $echo >> $output "\
  2888.       exec \$progdir\\\\\$program \${1+\"\$@\"}
  2889. "
  2890.       ;;
  2891.     *)
  2892.       $echo >> $output "\
  2893.       # Export the path to the program.
  2894.       PATH=\"\$progdir:\$PATH\"
  2895.       export PATH
  2896.  
  2897.       exec \$program \${1+\"\$@\"}
  2898. "
  2899.       ;;
  2900.     esac
  2901.     $echo >> $output "\
  2902.       \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
  2903.       exit 1
  2904.     fi
  2905.   else
  2906.     # The program doesn't exist.
  2907.     \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
  2908.     \$echo \"This script is just a wrapper for \$program.\" 1>&2
  2909.     echo \"See the $PACKAGE documentation for more information.\" 1>&2
  2910.     exit 1
  2911.   fi
  2912. fi\
  2913. "
  2914.     chmod +x $output
  2915.       fi
  2916.       exit 0
  2917.       ;;
  2918.     esac
  2919.  
  2920.     # See if we need to build an old-fashioned archive.
  2921.     for oldlib in $oldlibs; do
  2922.  
  2923.       if test "$build_libtool_libs" = convenience; then
  2924.     oldobjs="$libobjs_save"
  2925.     addlibs="$convenience"
  2926.     build_libtool_libs=no
  2927.       else
  2928.     if test "$build_libtool_libs" = module; then
  2929.       oldobjs="$libobjs_save"
  2930.       build_libtool_libs=no
  2931.     else
  2932.       oldobjs="$objs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
  2933.     fi
  2934.     addlibs="$old_convenience"
  2935.       fi
  2936.  
  2937.       if test -n "$addlibs"; then
  2938.     gentop="$output_objdir/${outputname}x"
  2939.     $show "${rm}r $gentop"
  2940.     $run ${rm}r "$gentop"
  2941.     $show "mkdir $gentop"
  2942.     $run mkdir "$gentop"
  2943.     status=$?
  2944.     if test $status -ne 0 && test ! -d "$gentop"; then
  2945.       exit $status
  2946.     fi
  2947.     generated="$generated $gentop"
  2948.       
  2949.     # Add in members from convenience archives.
  2950.     for xlib in $addlibs; do
  2951.       # Extract the objects.
  2952.       case "$xlib" in
  2953.       [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
  2954.       *) xabs=`pwd`"/$xlib" ;;
  2955.       esac
  2956.       xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
  2957.       xdir="$gentop/$xlib"
  2958.  
  2959.       $show "${rm}r $xdir"
  2960.       $run ${rm}r "$xdir"
  2961.       $show "mkdir $xdir"
  2962.       $run mkdir "$xdir"
  2963.       status=$?
  2964.       if test $status -ne 0 && test ! -d "$xdir"; then
  2965.         exit $status
  2966.       fi
  2967.       $show "(cd $xdir && $AR x $xabs)"
  2968.       $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
  2969.  
  2970.       oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
  2971.     done
  2972.       fi
  2973.  
  2974.       # Do each command in the archive commands.
  2975.       if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
  2976.     eval cmds=\"$old_archive_from_new_cmds\"
  2977.       else
  2978.     # Ensure that we have .o objects in place incase we decided
  2979.     # not to build a shared library, and have fallen back to building
  2980.     # static libs even though --disable-static was passed!
  2981.     for oldobj in $oldobjs; do
  2982.       if test ! -f $oldobj; then
  2983.         obj=`$echo "X$oldobj" | $Xsed -e "$o2lo"`
  2984.         $show "${LN_S} $obj $oldobj"
  2985.         $run ${LN_S} $obj $oldobj || exit $?
  2986.       fi
  2987.     done
  2988.  
  2989.     eval cmds=\"$old_archive_cmds\"
  2990.       fi
  2991.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  2992.       for cmd in $cmds; do
  2993.     IFS="$save_ifs"
  2994.     $show "$cmd"
  2995.     $run eval "$cmd" || exit $?
  2996.       done
  2997.       IFS="$save_ifs"
  2998.     done
  2999.  
  3000.     if test -n "$generated"; then
  3001.       $show "${rm}r$generated"
  3002.       $run ${rm}r$generated
  3003.     fi
  3004.  
  3005.     # Now create the libtool archive.
  3006.     case "$output" in
  3007.     *.la)
  3008.       old_library=
  3009.       test "$build_old_libs" = yes && old_library="$libname.$libext"
  3010.       $show "creating $output"
  3011.  
  3012.       if test -n "$xrpath"; then
  3013.     temp_xrpath=
  3014.     for libdir in $xrpath; do
  3015.       temp_xrpath="$temp_xrpath -R$libdir"
  3016.     done
  3017.     dependency_libs="$temp_xrpath $dependency_libs"
  3018.       fi
  3019.  
  3020.       # Only create the output if not a dry run.
  3021.       if test -z "$run"; then
  3022.     for installed in no yes; do
  3023.       if test "$installed" = yes; then
  3024.         if test -z "$install_libdir"; then
  3025.           break
  3026.         fi
  3027.         output="$output_objdir/$outputname"i
  3028.       fi
  3029.       $rm $output
  3030.       $echo > $output "\
  3031. # $outputname - a libtool library file
  3032. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  3033. #
  3034. # Please DO NOT delete this file!
  3035. # It is necessary for linking the library.
  3036.  
  3037. # The name that we can dlopen(3).
  3038. dlname='$dlname'
  3039.  
  3040. # Names of this library.
  3041. library_names='$library_names'
  3042.  
  3043. # The name of the static archive.
  3044. old_library='$old_library'
  3045.  
  3046. # Libraries that this one depends upon.
  3047. dependency_libs='$dependency_libs'
  3048.  
  3049. # Version information for $libname.
  3050. current=$current
  3051. age=$age
  3052. revision=$revision
  3053.  
  3054. # Is this an already installed library?
  3055. installed=$installed
  3056.  
  3057. # Directory that this library needs to be installed in:
  3058. libdir='$install_libdir'\
  3059. "
  3060.     done
  3061.       fi
  3062.  
  3063.       # Do a symbolic link so that the libtool archive can be found in
  3064.       # LD_LIBRARY_PATH before the program is installed.
  3065.       $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
  3066.       $run eval "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" || exit $?
  3067.       ;;
  3068.     esac
  3069.     exit 0
  3070.     ;;
  3071.  
  3072.   # libtool install mode
  3073.   install)
  3074.     modename="$modename: install"
  3075.  
  3076.     # There may be an optional sh(1) argument at the beginning of
  3077.     # install_prog (especially on Windows NT).
  3078.     if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh; then
  3079.       # Aesthetically quote it.
  3080.       arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
  3081.       case "$arg" in
  3082.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3083.     arg="\"$arg\""
  3084.     ;;
  3085.       esac
  3086.       install_prog="$arg "
  3087.       arg="$1"
  3088.       shift
  3089.     else
  3090.       install_prog=
  3091.       arg="$nonopt"
  3092.     fi
  3093.  
  3094.     # The real first argument should be the name of the installation program.
  3095.     # Aesthetically quote it.
  3096.     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3097.     case "$arg" in
  3098.     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3099.       arg="\"$arg\""
  3100.       ;;
  3101.     esac
  3102.     install_prog="$install_prog$arg"
  3103.  
  3104.     # We need to accept at least all the BSD install flags.
  3105.     dest=
  3106.     files=
  3107.     opts=
  3108.     prev=
  3109.     install_type=
  3110.     isdir=no
  3111.     stripme=
  3112.     for arg
  3113.     do
  3114.       if test -n "$dest"; then
  3115.     files="$files $dest"
  3116.     dest="$arg"
  3117.     continue
  3118.       fi
  3119.  
  3120.       case "$arg" in
  3121.       -d) isdir=yes ;;
  3122.       -f) prev="-f" ;;
  3123.       -g) prev="-g" ;;
  3124.       -m) prev="-m" ;;
  3125.       -o) prev="-o" ;;
  3126.       -s)
  3127.     stripme=" -s"
  3128.     continue
  3129.     ;;
  3130.       -*) ;;
  3131.  
  3132.       *)
  3133.     # If the previous option needed an argument, then skip it.
  3134.     if test -n "$prev"; then
  3135.       prev=
  3136.     else
  3137.       dest="$arg"
  3138.       continue
  3139.     fi
  3140.     ;;
  3141.       esac
  3142.  
  3143.       # Aesthetically quote the argument.
  3144.       arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  3145.       case "$arg" in
  3146.       *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \    ]*|*]*)
  3147.     arg="\"$arg\""
  3148.     ;;
  3149.       esac
  3150.       install_prog="$install_prog $arg"
  3151.     done
  3152.  
  3153.     if test -z "$install_prog"; then
  3154.       $echo "$modename: you must specify an install program" 1>&2
  3155.       $echo "$help" 1>&2
  3156.       exit 1
  3157.     fi
  3158.  
  3159.     if test -n "$prev"; then
  3160.       $echo "$modename: the \`$prev' option requires an argument" 1>&2
  3161.       $echo "$help" 1>&2
  3162.       exit 1
  3163.     fi
  3164.  
  3165.     if test -z "$files"; then
  3166.       if test -z "$dest"; then
  3167.     $echo "$modename: no file or destination specified" 1>&2
  3168.       else
  3169.     $echo "$modename: you must specify a destination" 1>&2
  3170.       fi
  3171.       $echo "$help" 1>&2
  3172.       exit 1
  3173.     fi
  3174.  
  3175.     # Strip any trailing slash from the destination.
  3176.     dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
  3177.  
  3178.     # Check to see that the destination is a directory.
  3179.     test -d "$dest" && isdir=yes
  3180.     if test "$isdir" = yes; then
  3181.       destdir="$dest"
  3182.       destname=
  3183.     else
  3184.       destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
  3185.       test "X$destdir" = "X$dest" && destdir=.
  3186.       destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
  3187.  
  3188.       # Not a directory, so check to see that there is only one file specified.
  3189.       set dummy $files
  3190.       if test $# -gt 2; then
  3191.     $echo "$modename: \`$dest' is not a directory" 1>&2
  3192.     $echo "$help" 1>&2
  3193.     exit 1
  3194.       fi
  3195.     fi
  3196.     case "$destdir" in
  3197.     [\\/]* | [A-Za-z]:[\\/]*) ;;
  3198.     *)
  3199.       for file in $files; do
  3200.     case "$file" in
  3201.     *.lo) ;;
  3202.     *)
  3203.       $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
  3204.       $echo "$help" 1>&2
  3205.       exit 1
  3206.       ;;
  3207.     esac
  3208.       done
  3209.       ;;
  3210.     esac
  3211.  
  3212.     # This variable tells wrapper scripts just to set variables rather
  3213.     # than running their programs.
  3214.     libtool_install_magic="$magic"
  3215.  
  3216.     staticlibs=
  3217.     future_libdirs=
  3218.     current_libdirs=
  3219.     for file in $files; do
  3220.  
  3221.       # Do each installation.
  3222.       case "$file" in
  3223.       *.a | *.lib)
  3224.     # Do the static libraries later.
  3225.     staticlibs="$staticlibs $file"
  3226.     ;;
  3227.  
  3228.       *.la)
  3229.     # Check to see that this really is a libtool archive.
  3230.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3231.     else
  3232.       $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
  3233.       $echo "$help" 1>&2
  3234.       exit 1
  3235.     fi
  3236.  
  3237.     library_names=
  3238.     old_library=
  3239.     # If there is no directory component, then add one.
  3240.     case "$file" in
  3241.     */* | *\\*) . $file ;;
  3242.     *) . ./$file ;;
  3243.     esac
  3244.  
  3245.     # Add the libdir to current_libdirs if it is the destination.
  3246.     if test "X$destdir" = "X$libdir"; then
  3247.       case "$current_libdirs " in
  3248.       *" $libdir "*) ;;
  3249.       *) current_libdirs="$current_libdirs $libdir" ;;
  3250.       esac
  3251.     else
  3252.       # Note the libdir as a future libdir.
  3253.       case "$future_libdirs " in
  3254.       *" $libdir "*) ;;
  3255.       *) future_libdirs="$future_libdirs $libdir" ;;
  3256.       esac
  3257.     fi
  3258.  
  3259.     dir="`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/"
  3260.     test "X$dir" = "X$file/" && dir=
  3261.     dir="$dir$objdir"
  3262.  
  3263.     # See the names of the shared library.
  3264.     set dummy $library_names
  3265.     if test -n "$2"; then
  3266.       realname="$2"
  3267.       shift
  3268.       shift
  3269.  
  3270.       # Install the shared library and build the symlinks.
  3271.       $show "$install_prog $dir/$realname $destdir/$realname"
  3272.       $run eval "$install_prog $dir/$realname $destdir/$realname" || exit $?
  3273.  
  3274.       if test $# -gt 0; then
  3275.         # Delete the old symlinks, and create new ones.
  3276.         for linkname
  3277.         do
  3278.           if test "$linkname" != "$realname"; then
  3279.         $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3280.         $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
  3281.           fi
  3282.         done
  3283.       fi
  3284.  
  3285.       # Do each command in the postinstall commands.
  3286.       lib="$destdir/$realname"
  3287.       eval cmds=\"$postinstall_cmds\"
  3288.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3289.       for cmd in $cmds; do
  3290.         IFS="$save_ifs"
  3291.         $show "$cmd"
  3292.         $run eval "$cmd" || exit $?
  3293.       done
  3294.       IFS="$save_ifs"
  3295.     fi
  3296.  
  3297.     # Install the pseudo-library for information purposes.
  3298.     name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3299.     instname="$dir/$name"i
  3300.     $show "$install_prog $instname $destdir/$name"
  3301.     $run eval "$install_prog $instname $destdir/$name" || exit $?
  3302.  
  3303.     # Maybe install the static library, too.
  3304.     test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  3305.     ;;
  3306.  
  3307.       *.lo)
  3308.     # Install (i.e. copy) a libtool object.
  3309.  
  3310.     # Figure out destination file name, if it wasn't already specified.
  3311.     if test -n "$destname"; then
  3312.       destfile="$destdir/$destname"
  3313.     else
  3314.       destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3315.       destfile="$destdir/$destfile"
  3316.     fi
  3317.  
  3318.     # Deduce the name of the destination old-style object file.
  3319.     case "$destfile" in
  3320.     *.lo)
  3321.       staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
  3322.       ;;
  3323.     *.o | *.obj)
  3324.       staticdest="$destfile"
  3325.       destfile=
  3326.       ;;
  3327.     *)
  3328.       $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
  3329.       $echo "$help" 1>&2
  3330.       exit 1
  3331.       ;;
  3332.     esac
  3333.  
  3334.     # Install the libtool object if requested.
  3335.     if test -n "$destfile"; then
  3336.       $show "$install_prog $file $destfile"
  3337.       $run eval "$install_prog $file $destfile" || exit $?
  3338.     fi
  3339.  
  3340.     # Install the old object if enabled.
  3341.     if test "$build_old_libs" = yes; then
  3342.       # Deduce the name of the old-style object file.
  3343.       staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
  3344.  
  3345.       $show "$install_prog $staticobj $staticdest"
  3346.       $run eval "$install_prog \$staticobj \$staticdest" || exit $?
  3347.     fi
  3348.     exit 0
  3349.     ;;
  3350.  
  3351.       *)
  3352.     # Figure out destination file name, if it wasn't already specified.
  3353.     if test -n "$destname"; then
  3354.       destfile="$destdir/$destname"
  3355.     else
  3356.       destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3357.       destfile="$destdir/$destfile"
  3358.     fi
  3359.  
  3360.     # Do a test to see if this is really a libtool program.
  3361.     if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3362.       link_against_libtool_libs=
  3363.       relink_command=
  3364.  
  3365.       # If there is no directory component, then add one.
  3366.       case "$file" in
  3367.       */* | *\\*) . $file ;;
  3368.       *) . ./$file ;;
  3369.       esac
  3370.  
  3371.       # Check the variables that should have been set.
  3372.       if test -z "$link_against_libtool_libs"; then
  3373.         $echo "$modename: invalid libtool wrapper script \`$file'" 1>&2
  3374.         exit 1
  3375.       fi
  3376.  
  3377.       finalize=yes
  3378.       for lib in $link_against_libtool_libs; do
  3379.         # Check to see that each library is installed.
  3380.         libdir=
  3381.         if test -f "$lib"; then
  3382.           # If there is no directory component, then add one.
  3383.           case "$lib" in
  3384.           */* | *\\*) . $lib ;;
  3385.           *) . ./$lib ;;
  3386.           esac
  3387.         fi
  3388.         libfile="$libdir/`$echo "X$lib" | $Xsed -e 's%^.*/%%g'`"
  3389.         if test -n "$libdir" && test ! -f "$libfile"; then
  3390.           $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
  3391.           finalize=no
  3392.         fi
  3393.       done
  3394.  
  3395.       outputname=
  3396.       if test "$fast_install" = no && test -n "$relink_command"; then
  3397.         if test "$finalize" = yes && test -z "$run"; then
  3398.           tmpdir="/tmp"
  3399.           test -n "$TMPDIR" && tmpdir="$TMPDIR"
  3400.           tmpdir="$tmpdir/libtool-$$"
  3401.           if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
  3402.           else
  3403.         $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
  3404.         continue
  3405.           fi
  3406.           outputname="$tmpdir/$file"
  3407.           # Replace the output file specification.
  3408.           relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  3409.  
  3410.           $show "$relink_command"
  3411.           if $run eval "$relink_command"; then :
  3412.           else
  3413.         $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
  3414.         ${rm}r "$tmpdir"
  3415.         continue
  3416.           fi
  3417.           file="$outputname"
  3418.         else
  3419.           $echo "$modename: warning: cannot relink \`$file'" 1>&2
  3420.         fi
  3421.       else
  3422.         # Install the binary that we compiled earlier.
  3423.         file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  3424.       fi
  3425.     fi
  3426.  
  3427.     $show "$install_prog$stripme $file $destfile"
  3428.     $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
  3429.     test -n "$outputname" && ${rm}r "$tmpdir"
  3430.     ;;
  3431.       esac
  3432.     done
  3433.  
  3434.     for file in $staticlibs; do
  3435.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3436.  
  3437.       # Set up the ranlib parameters.
  3438.       oldlib="$destdir/$name"
  3439.  
  3440.       $show "$install_prog $file $oldlib"
  3441.       $run eval "$install_prog \$file \$oldlib" || exit $?
  3442.  
  3443.       # Do each command in the postinstall commands.
  3444.       eval cmds=\"$old_postinstall_cmds\"
  3445.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3446.       for cmd in $cmds; do
  3447.     IFS="$save_ifs"
  3448.     $show "$cmd"
  3449.     $run eval "$cmd" || exit $?
  3450.       done
  3451.       IFS="$save_ifs"
  3452.     done
  3453.  
  3454.     if test -n "$future_libdirs"; then
  3455.       $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
  3456.     fi
  3457.  
  3458.     if test -n "$current_libdirs"; then
  3459.       # Maybe just do a dry run.
  3460.       test -n "$run" && current_libdirs=" -n$current_libdirs"
  3461.       exec $SHELL $0 --finish$current_libdirs
  3462.       exit 1
  3463.     fi
  3464.  
  3465.     exit 0
  3466.     ;;
  3467.  
  3468.   # libtool finish mode
  3469.   finish)
  3470.     modename="$modename: finish"
  3471.     libdirs="$nonopt"
  3472.     admincmds=
  3473.  
  3474.     if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  3475.       for dir
  3476.       do
  3477.     libdirs="$libdirs $dir"
  3478.       done
  3479.  
  3480.       for libdir in $libdirs; do
  3481.     if test -n "$finish_cmds"; then
  3482.       # Do each command in the finish commands.
  3483.       eval cmds=\"$finish_cmds\"
  3484.       IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3485.       for cmd in $cmds; do
  3486.         IFS="$save_ifs"
  3487.         $show "$cmd"
  3488.         $run eval "$cmd" || admincmds="$admincmds
  3489.        $cmd"
  3490.       done
  3491.       IFS="$save_ifs"
  3492.     fi
  3493.     if test -n "$finish_eval"; then
  3494.       # Do the single finish_eval.
  3495.       eval cmds=\"$finish_eval\"
  3496.       $run eval "$cmds" || admincmds="$admincmds
  3497.        $cmds"
  3498.     fi
  3499.       done
  3500.     fi
  3501.  
  3502.     # Exit here if they wanted silent mode.
  3503.     test "$show" = : && exit 0
  3504.  
  3505.     echo "----------------------------------------------------------------------"
  3506.     echo "Libraries have been installed in:"
  3507.     for libdir in $libdirs; do
  3508.       echo "   $libdir"
  3509.     done
  3510.     echo
  3511.     echo "If you ever happen to want to link against installed libraries"
  3512.     echo "in a given directory, LIBDIR, you must either use libtool, and"
  3513.     echo "specify the full pathname of the library, or use \`-LLIBDIR'"
  3514.     echo "flag during linking and do at least one of the following:"
  3515.     if test -n "$shlibpath_var"; then
  3516.       echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  3517.       echo "     during execution"
  3518.     fi
  3519.     if test -n "$runpath_var"; then
  3520.       echo "   - add LIBDIR to the \`$runpath_var' environment variable"
  3521.       echo "     during linking"
  3522.     fi
  3523.     if test -n "$hardcode_libdir_flag_spec"; then
  3524.       libdir=LIBDIR
  3525.       eval flag=\"$hardcode_libdir_flag_spec\"
  3526.  
  3527.       echo "   - use the \`$flag' linker flag"
  3528.     fi
  3529.     if test -n "$admincmds"; then
  3530.       echo "   - have your system administrator run these commands:$admincmds"
  3531.     fi
  3532.     if test -f /etc/ld.so.conf; then
  3533.       echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  3534.     fi
  3535.     echo
  3536.     echo "See any operating system documentation about shared libraries for"
  3537.     echo "more information, such as the ld(1) and ld.so(8) manual pages."
  3538.     echo "----------------------------------------------------------------------"
  3539.     exit 0
  3540.     ;;
  3541.  
  3542.   # libtool execute mode
  3543.   execute)
  3544.     modename="$modename: execute"
  3545.  
  3546.     # The first argument is the command name.
  3547.     cmd="$nonopt"
  3548.     if test -z "$cmd"; then
  3549.       $echo "$modename: you must specify a COMMAND" 1>&2
  3550.       $echo "$help"
  3551.       exit 1
  3552.     fi
  3553.  
  3554.     # Handle -dlopen flags immediately.
  3555.     for file in $execute_dlfiles; do
  3556.       if test ! -f "$file"; then
  3557.     $echo "$modename: \`$file' is not a file" 1>&2
  3558.     $echo "$help" 1>&2
  3559.     exit 1
  3560.       fi
  3561.  
  3562.       dir=
  3563.       case "$file" in
  3564.       *.la)
  3565.     # Check to see that this really is a libtool archive.
  3566.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  3567.     else
  3568.       $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  3569.       $echo "$help" 1>&2
  3570.       exit 1
  3571.     fi
  3572.  
  3573.     # Read the libtool library.
  3574.     dlname=
  3575.     library_names=
  3576.  
  3577.     # If there is no directory component, then add one.
  3578.     case "$file" in
  3579.     */* | *\\*) . $file ;;
  3580.     *) . ./$file ;;
  3581.     esac
  3582.  
  3583.     # Skip this library if it cannot be dlopened.
  3584.     if test -z "$dlname"; then
  3585.       # Warn if it was a shared library.
  3586.       test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
  3587.       continue
  3588.     fi
  3589.  
  3590.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3591.     test "X$dir" = "X$file" && dir=.
  3592.  
  3593.     if test -f "$dir/$objdir/$dlname"; then
  3594.       dir="$dir/$objdir"
  3595.     else
  3596.       $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
  3597.       exit 1
  3598.     fi
  3599.     ;;
  3600.  
  3601.       *.lo)
  3602.     # Just add the directory containing the .lo file.
  3603.     dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3604.     test "X$dir" = "X$file" && dir=.
  3605.     ;;
  3606.  
  3607.       *)
  3608.     $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
  3609.     continue
  3610.     ;;
  3611.       esac
  3612.  
  3613.       # Get the absolute pathname.
  3614.       absdir=`cd "$dir" && pwd`
  3615.       test -n "$absdir" && dir="$absdir"
  3616.  
  3617.       # Now add the directory to shlibpath_var.
  3618.       if eval "test -z \"\$$shlibpath_var\""; then
  3619.     eval "$shlibpath_var=\"\$dir\""
  3620.       else
  3621.     eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  3622.       fi
  3623.     done
  3624.  
  3625.     # This variable tells wrapper scripts just to set shlibpath_var
  3626.     # rather than running their programs.
  3627.     libtool_execute_magic="$magic"
  3628.  
  3629.     # Check if any of the arguments is a wrapper script.
  3630.     args=
  3631.     for file
  3632.     do
  3633.       case "$file" in
  3634.       -*) ;;
  3635.       *)
  3636.     # Do a test to see if this is really a libtool program.
  3637.     if (sed -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3638.       # If there is no directory component, then add one.
  3639.       case "$file" in
  3640.       */* | *\\*) . $file ;;
  3641.       *) . ./$file ;;
  3642.       esac
  3643.  
  3644.       # Transform arg to wrapped name.
  3645.       file="$progdir/$program"
  3646.     fi
  3647.     ;;
  3648.       esac
  3649.       # Quote arguments (to preserve shell metacharacters).
  3650.       file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
  3651.       args="$args \"$file\""
  3652.     done
  3653.  
  3654.     if test -z "$run"; then
  3655.       # Export the shlibpath_var.
  3656.       eval "export $shlibpath_var"
  3657.  
  3658.       # Restore saved enviroment variables
  3659.       if test "${save_LC_ALL+set}" = set; then
  3660.     LC_ALL="$save_LC_ALL"; export LC_ALL
  3661.       fi
  3662.       if test "${save_LANG+set}" = set; then
  3663.     LANG="$save_LANG"; export LANG
  3664.       fi
  3665.  
  3666.       # Now actually exec the command.
  3667.       eval "exec \$cmd$args"
  3668.  
  3669.       $echo "$modename: cannot exec \$cmd$args"
  3670.       exit 1
  3671.     else
  3672.       # Display what would be done.
  3673.       eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
  3674.       $echo "export $shlibpath_var"
  3675.       $echo "$cmd$args"
  3676.       exit 0
  3677.     fi
  3678.     ;;
  3679.  
  3680.   # libtool uninstall mode
  3681.   uninstall)
  3682.     modename="$modename: uninstall"
  3683.     rm="$nonopt"
  3684.     files=
  3685.  
  3686.     for arg
  3687.     do
  3688.       case "$arg" in
  3689.       -*) rm="$rm $arg" ;;
  3690.       *) files="$files $arg" ;;
  3691.       esac
  3692.     done
  3693.  
  3694.     if test -z "$rm"; then
  3695.       $echo "$modename: you must specify an RM program" 1>&2
  3696.       $echo "$help" 1>&2
  3697.       exit 1
  3698.     fi
  3699.  
  3700.     for file in $files; do
  3701.       dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
  3702.       test "X$dir" = "X$file" && dir=.
  3703.       name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
  3704.  
  3705.       rmfiles="$file"
  3706.  
  3707.       case "$name" in
  3708.       *.la)
  3709.     # Possibly a libtool archive, so verify it.
  3710.     if (sed -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  3711.       . $dir/$name
  3712.  
  3713.       # Delete the libtool libraries and symlinks.
  3714.       for n in $library_names; do
  3715.         rmfiles="$rmfiles $dir/$n"
  3716.       done
  3717.       test -n "$old_library" && rmfiles="$rmfiles $dir/$old_library"
  3718.  
  3719.       $show "$rm $rmfiles"
  3720.       $run $rm $rmfiles
  3721.  
  3722.       if test -n "$library_names"; then
  3723.         # Do each command in the postuninstall commands.
  3724.         eval cmds=\"$postuninstall_cmds\"
  3725.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3726.         for cmd in $cmds; do
  3727.           IFS="$save_ifs"
  3728.           $show "$cmd"
  3729.           $run eval "$cmd"
  3730.         done
  3731.         IFS="$save_ifs"
  3732.       fi
  3733.  
  3734.       if test -n "$old_library"; then
  3735.         # Do each command in the old_postuninstall commands.
  3736.         eval cmds=\"$old_postuninstall_cmds\"
  3737.         IFS="${IFS=     }"; save_ifs="$IFS"; IFS='~'
  3738.         for cmd in $cmds; do
  3739.           IFS="$save_ifs"
  3740.           $show "$cmd"
  3741.           $run eval "$cmd"
  3742.         done
  3743.         IFS="$save_ifs"
  3744.       fi
  3745.  
  3746.       # FIXME: should reinstall the best remaining shared library.
  3747.     fi
  3748.     ;;
  3749.  
  3750.       *.lo)
  3751.     if test "$build_old_libs" = yes; then
  3752.       oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
  3753.       rmfiles="$rmfiles $dir/$oldobj"
  3754.     fi
  3755.     $show "$rm $rmfiles"
  3756.     $run $rm $rmfiles
  3757.     ;;
  3758.  
  3759.       *)
  3760.     $show "$rm $rmfiles"
  3761.     $run $rm $rmfiles
  3762.     ;;
  3763.       esac
  3764.     done
  3765.     exit 0
  3766.     ;;
  3767.  
  3768.   "")
  3769.     $echo "$modename: you must specify a MODE" 1>&2
  3770.     $echo "$generic_help" 1>&2
  3771.     exit 1
  3772.     ;;
  3773.   esac
  3774.  
  3775.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3776.   $echo "$generic_help" 1>&2
  3777.   exit 1
  3778. fi # test -z "$show_help"
  3779.  
  3780. # We need to display help for each of the modes.
  3781. case "$mode" in
  3782. "") $echo \
  3783. "Usage: $modename [OPTION]... [MODE-ARG]...
  3784.  
  3785. Provide generalized library-building support services.
  3786.  
  3787.     --config          show all configuration variables
  3788.     --debug           enable verbose shell tracing
  3789. -n, --dry-run         display commands without modifying any files
  3790.     --features        display basic configuration information and exit
  3791.     --finish          same as \`--mode=finish'
  3792.     --help            display this help message and exit
  3793.     --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
  3794.     --quiet           same as \`--silent'
  3795.     --silent          don't print informational messages
  3796.     --version         print version information
  3797.  
  3798. MODE must be one of the following:
  3799.  
  3800.       compile         compile a source file into a libtool object
  3801.       execute         automatically set library path, then run a program
  3802.       finish          complete the installation of libtool libraries
  3803.       install         install libraries or executables
  3804.       link            create a library or an executable
  3805.       uninstall       remove libraries from an installed directory
  3806.  
  3807. MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
  3808. a more detailed description of MODE."
  3809.   exit 0
  3810.   ;;
  3811.  
  3812. compile)
  3813.   $echo \
  3814. "Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  3815.  
  3816. Compile a source file into a libtool library object.
  3817.  
  3818. This mode accepts the following additional options:
  3819.  
  3820.   -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  3821.   -static           always build a \`.o' file suitable for static linking
  3822.  
  3823. COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  3824. from the given SOURCEFILE.
  3825.  
  3826. The output file name is determined by removing the directory component from
  3827. SOURCEFILE, then substituting the C source code suffix \`.c' with the
  3828. library object suffix, \`.lo'."
  3829.   ;;
  3830.  
  3831. execute)
  3832.   $echo \
  3833. "Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
  3834.  
  3835. Automatically set library path, then run a program.
  3836.  
  3837. This mode accepts the following additional options:
  3838.  
  3839.   -dlopen FILE      add the directory containing FILE to the library path
  3840.  
  3841. This mode sets the library path environment variable according to \`-dlopen'
  3842. flags.
  3843.  
  3844. If any of the ARGS are libtool executable wrappers, then they are translated
  3845. into their corresponding uninstalled binary, and any of their required library
  3846. directories are added to the library path.
  3847.  
  3848. Then, COMMAND is executed, with ARGS as arguments."
  3849.   ;;
  3850.  
  3851. finish)
  3852.   $echo \
  3853. "Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
  3854.  
  3855. Complete the installation of libtool libraries.
  3856.  
  3857. Each LIBDIR is a directory that contains libtool libraries.
  3858.  
  3859. The commands that this mode executes may require superuser privileges.  Use
  3860. the \`--dry-run' option if you just want to see what would be executed."
  3861.   ;;
  3862.  
  3863. install)
  3864.   $echo \
  3865. "Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
  3866.  
  3867. Install executables or libraries.
  3868.  
  3869. INSTALL-COMMAND is the installation command.  The first component should be
  3870. either the \`install' or \`cp' program.
  3871.  
  3872. The rest of the components are interpreted as arguments to that command (only
  3873. BSD-compatible install options are recognized)."
  3874.   ;;
  3875.  
  3876. link)
  3877.   $echo \
  3878. "Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
  3879.  
  3880. Link object files or libraries together to form another library, or to
  3881. create an executable program.
  3882.  
  3883. LINK-COMMAND is a command using the C compiler that you would use to create
  3884. a program from several object files.
  3885.  
  3886. The following components of LINK-COMMAND are treated specially:
  3887.  
  3888.   -all-static       do not do any dynamic linking at all
  3889.   -avoid-version    do not add a version suffix if possible
  3890.   -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  3891.   -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
  3892.   -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  3893.   -export-symbols SYMFILE
  3894.             try to export only the symbols listed in SYMFILE
  3895.   -export-symbols-regex REGEX
  3896.             try to export only the symbols matching REGEX
  3897.   -LLIBDIR          search LIBDIR for required installed libraries
  3898.   -lNAME            OUTPUT-FILE requires the installed library libNAME
  3899.   -module           build a library that can dlopened
  3900.   -no-undefined     declare that a library does not refer to external symbols
  3901.   -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  3902.   -release RELEASE  specify package release information
  3903.   -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  3904.   -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  3905.   -static           do not do any dynamic linking of libtool libraries
  3906.   -version-info CURRENT[:REVISION[:AGE]]
  3907.             specify library version info [each variable defaults to 0]
  3908.  
  3909. All other options (arguments beginning with \`-') are ignored.
  3910.  
  3911. Every other argument is treated as a filename.  Files ending in \`.la' are
  3912. treated as uninstalled libtool libraries, other files are standard or library
  3913. object files.
  3914.  
  3915. If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  3916. only library objects (\`.lo' files) may be specified, and \`-rpath' is
  3917. required, except when creating a convenience library.
  3918.  
  3919. If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  3920. using \`ar' and \`ranlib', or on Windows using \`lib'.
  3921.  
  3922. If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  3923. is created, otherwise an executable program is created."
  3924.   ;;
  3925.  
  3926. uninstall)
  3927.   $echo \
  3928. "Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  3929.  
  3930. Remove libraries from an installation directory.
  3931.  
  3932. RM is the name of the program to use to delete files associated with each FILE
  3933. (typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  3934. to RM.
  3935.  
  3936. If FILE is a libtool library, all the files associated with it are deleted.
  3937. Otherwise, only FILE itself is deleted using RM."
  3938.   ;;
  3939.  
  3940. *)
  3941.   $echo "$modename: invalid operation mode \`$mode'" 1>&2
  3942.   $echo "$help" 1>&2
  3943.   exit 1
  3944.   ;;
  3945. esac
  3946.  
  3947. echo
  3948. $echo "Try \`$modename --help' for more information about other modes."
  3949.  
  3950. exit 0
  3951.  
  3952. # Local Variables:
  3953. # mode:shell-script
  3954. # sh-indentation:2
  3955. # End:
  3956.