ltmain.sh
上传用户:shenzhenrh
上传日期:2013-05-12
资源大小:2904k
文件大小:179k
源码类别:

信息检索与抽取

开发平台:

Unix_Linux

  1. # ltmain.sh - Provide generalized library-building support services.
  2. # NOTE: Changing this file will not affect anything until you rerun configure.
  3. #
  4. # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004
  5. # Free Software Foundation, Inc.
  6. # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  7. #
  8. # This program is free software; you can redistribute it and/or modify
  9. # it under the terms of the GNU General Public License as published by
  10. # the Free Software Foundation; either version 2 of the License, or
  11. # (at your option) any later version.
  12. #
  13. # This program is distributed in the hope that it will be useful, but
  14. # WITHOUT ANY WARRANTY; without even the implied warranty of
  15. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16. # General Public License for more details.
  17. #
  18. # You should have received a copy of the GNU General Public License
  19. # along with this program; if not, write to the Free Software
  20. # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  21. #
  22. # As a special exception to the GNU General Public License, if you
  23. # distribute this file as part of a program that contains a
  24. # configuration script generated by Autoconf, you may include it under
  25. # the same distribution terms that you use for the rest of that program.
  26. basename="s,^.*/,,g"
  27. # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
  28. # is ksh but when the shell is invoked as "sh" and the current value of
  29. # the _XPG environment variable is not equal to 1 (one), the special
  30. # positional parameter $0, within a function call, is the name of the
  31. # function.
  32. progpath="$0"
  33. # The name of this program:
  34. progname=`echo "$progpath" | $SED $basename`
  35. modename="$progname"
  36. # Global variables:
  37. EXIT_SUCCESS=0
  38. EXIT_FAILURE=1
  39. PROGRAM=ltmain.sh
  40. PACKAGE=libtool
  41. VERSION=1.5.10
  42. TIMESTAMP=" (1.1220.2.130 2004/09/19 12:13:49)"
  43. # See if we are running on zsh, and set the options which allow our
  44. # commands through without removal of  escapes.
  45. if test -n "${ZSH_VERSION+set}" ; then
  46.   setopt NO_GLOB_SUBST
  47. fi
  48. # Check that we have a working $echo.
  49. if test "X$1" = X--no-reexec; then
  50.   # Discard the --no-reexec flag, and continue.
  51.   shift
  52. elif test "X$1" = X--fallback-echo; then
  53.   # Avoid inline document here, it may be left over
  54.   :
  55. elif test "X`($echo 't') 2>/dev/null`" = 'Xt'; then
  56.   # Yippee, $echo works!
  57.   :
  58. else
  59.   # Restart under the correct shell, and then maybe $echo will work.
  60.   exec $SHELL "$progpath" --no-reexec ${1+"$@"}
  61. fi
  62. if test "X$1" = X--fallback-echo; then
  63.   # used as fallback echo
  64.   shift
  65.   cat <<EOF
  66. $*
  67. EOF
  68.   exit $EXIT_SUCCESS
  69. fi
  70. default_mode=
  71. help="Try `$progname --help' for more information."
  72. magic="%%%MAGIC variable%%%"
  73. mkdir="mkdir"
  74. mv="mv -f"
  75. rm="rm -f"
  76. # Sed substitution that helps us do robust quoting.  It backslashifies
  77. # metacharacters that are still active within double-quoted strings.
  78. Xsed="${SED}"' -e 1s/^X//'
  79. sed_quote_subst='s/([\`\"$\\])/\1/g'
  80. # test EBCDIC or ASCII
  81. case `echo A|tr A '301'` in
  82.  A) # EBCDIC based system
  83.   SP2NL="tr '100' 'n'"
  84.   NL2SP="tr 'rn' '100100'"
  85.   ;;
  86.  *) # Assume ASCII based system
  87.   SP2NL="tr '40' '12'"
  88.   NL2SP="tr '1512' '4040'"
  89.   ;;
  90. esac
  91. # NLS nuisances.
  92. # Only set LANG and LC_ALL to C if already set.
  93. # These must not be set unconditionally because not all systems understand
  94. # e.g. LANG=C (notably SCO).
  95. # We save the old values to restore during execute mode.
  96. if test "${LC_ALL+set}" = set; then
  97.   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
  98. fi
  99. if test "${LANG+set}" = set; then
  100.   save_LANG="$LANG"; LANG=C; export LANG
  101. fi
  102. # Make sure IFS has a sensible default
  103. : ${IFS=" 
  104. "}
  105. if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  106.   $echo "$modename: not configured to build any kind of library" 1>&2
  107.   $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  108.   exit $EXIT_FAILURE
  109. fi
  110. # Global variables.
  111. mode=$default_mode
  112. nonopt=
  113. prev=
  114. prevopt=
  115. run=
  116. show="$echo"
  117. show_help=
  118. execute_dlfiles=
  119. lo2o="s/\.lo$/.${objext}/"
  120. o2lo="s/\.${objext}$/.lo/"
  121. #####################################
  122. # Shell function definitions:
  123. # This seems to be the best place for them
  124. # func_win32_libid arg
  125. # return the library type of file 'arg'
  126. #
  127. # Need a lot of goo to handle *both* DLLs and import libs
  128. # Has to be a shell function in order to 'eat' the argument
  129. # that is supplied when $file_magic_command is called.
  130. func_win32_libid () {
  131.   win32_libid_type="unknown"
  132.   win32_fileres=`file -L $1 2>/dev/null`
  133.   case $win32_fileres in
  134.   *ar archive import library*) # definitely import
  135.     win32_libid_type="x86 archive import"
  136.     ;;
  137.   *ar archive*) # could be an import, or static
  138.     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | 
  139.       $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
  140.       win32_nmres=`eval $NM -f posix -A $1 | 
  141. sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
  142.       if test "X$win32_nmres" = "Ximport" ; then
  143.         win32_libid_type="x86 archive import"
  144.       else
  145.         win32_libid_type="x86 archive static"
  146.       fi
  147.     fi
  148.     ;;
  149.   *DLL*)
  150.     win32_libid_type="x86 DLL"
  151.     ;;
  152.   *executable*) # but shell scripts are "executable" too...
  153.     case $win32_fileres in
  154.     *MS Windows PE Intel*)
  155.       win32_libid_type="x86 DLL"
  156.       ;;
  157.     esac
  158.     ;;
  159.   esac
  160.   $echo $win32_libid_type
  161. }
  162. # func_infer_tag arg
  163. # Infer tagged configuration to use if any are available and
  164. # if one wasn't chosen via the "--tag" command line option.
  165. # Only attempt this if the compiler in the base compile
  166. # command doesn't match the default compiler.
  167. # arg is usually of the form 'gcc ...'
  168. func_infer_tag () {
  169.     if test -n "$available_tags" && test -z "$tagname"; then
  170.       CC_quoted=
  171.       for arg in $CC; do
  172. case $arg in
  173.   *[[~#^&*(){}|;<>?'  ]*|*]*|"")
  174.   arg=""$arg""
  175.   ;;
  176. esac
  177. CC_quoted="$CC_quoted $arg"
  178.       done
  179.       case $@ in
  180.       # Blanks in the command may have been stripped by the calling shell,
  181.       # but not from the CC environment variable when configure was run.
  182.       " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
  183.       # Blanks at the start of $base_compile will cause this to fail
  184.       # if we don't check for them as well.
  185.       *)
  186. for z in $available_tags; do
  187.   if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  188.     # Evaluate the configuration.
  189.     eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  190.     CC_quoted=
  191.     for arg in $CC; do
  192.     # Double-quote args containing other shell metacharacters.
  193.     case $arg in
  194.       *[[~#^&*(){}|;<>?'  ]*|*]*|"")
  195.       arg=""$arg""
  196.       ;;
  197.     esac
  198.     CC_quoted="$CC_quoted $arg"
  199.   done
  200.     case "$@ " in
  201.       " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
  202.       # The compiler in the base compile command matches
  203.       # the one in the tagged configuration.
  204.       # Assume this is the tagged configuration we want.
  205.       tagname=$z
  206.       break
  207.       ;;
  208.     esac
  209.   fi
  210. done
  211. # If $tagname still isn't set, then no tagged configuration
  212. # was found and let the user know that the "--tag" command
  213. # line option must be used.
  214. if test -z "$tagname"; then
  215.   $echo "$modename: unable to infer tagged configuration"
  216.   $echo "$modename: specify a tag with `--tag'" 1>&2
  217.   exit $EXIT_FAILURE
  218. #        else
  219. #          $echo "$modename: using $tagname tagged configuration"
  220. fi
  221. ;;
  222.       esac
  223.     fi
  224. }
  225. # func_extract_archives gentop oldlib ...
  226. func_extract_archives () {
  227.     my_gentop="$1"; shift
  228.     my_oldlibs=${1+"$@"}
  229.     my_oldobjs=""
  230.     my_xlib=""
  231.     my_xabs=""
  232.     my_xdir=""
  233.     my_status=""
  234.     $show "${rm}r $my_gentop"
  235.     $run ${rm}r "$my_gentop"
  236.     $show "$mkdir $my_gentop"
  237.     $run $mkdir "$my_gentop"
  238.     my_status=$?
  239.     if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
  240.       exit $my_status
  241.     fi
  242.     for my_xlib in $my_oldlibs; do
  243.       # Extract the objects.
  244.       case $my_xlib in
  245. [\/]* | [A-Za-z]:[\/]*) my_xabs="$my_xlib" ;;
  246. *) my_xabs=`pwd`"/$my_xlib" ;;
  247.       esac
  248.       my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
  249.       my_xdir="$my_gentop/$my_xlib"
  250.       $show "${rm}r $my_xdir"
  251.       $run ${rm}r "$my_xdir"
  252.       $show "$mkdir $my_xdir"
  253.       $run $mkdir "$my_xdir"
  254.       status=$?
  255.       if test "$status" -ne 0 && test ! -d "$my_xdir"; then
  256. exit $status
  257.       fi
  258.       case $host in
  259.       *-darwin*)
  260. $show "Extracting $my_xabs"
  261. # Do not bother doing anything if just a dry run
  262. if test -z "$run"; then
  263.   darwin_orig_dir=`pwd`
  264.   cd $my_xdir || exit $?
  265.   darwin_archive=$my_xabs
  266.   darwin_curdir=`pwd`
  267.   darwin_base_archive=`basename $darwin_archive`
  268.   darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
  269.   if test -n "$darwin_arches"; then 
  270.     darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
  271.     darwin_arch=
  272.     $show "$darwin_base_archive has multiple architectures $darwin_arches"
  273.     for darwin_arch in  $darwin_arches ; do
  274.       mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  275.       lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
  276.       # Remove the table of contents from the thin files.
  277.       $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
  278.       $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF SORTED 2>/dev/null || true
  279.       cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  280.       $AR -xo "${darwin_base_archive}"
  281.       rm "${darwin_base_archive}"
  282.       cd "$darwin_curdir"
  283.     done # $darwin_arches
  284.       ## Okay now we have a bunch of thin objects, gotta fatten them up :)
  285.     darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
  286.     darwin_file=
  287.     darwin_files=
  288.     for darwin_file in $darwin_filelist; do
  289.       darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
  290.       lipo -create -output "$darwin_file" $darwin_files
  291.     done # $darwin_filelist
  292.     rm -rf unfat-$$
  293.     cd "$darwin_orig_dir"
  294.   else
  295.     cd $darwin_orig_dir
  296.     (cd $my_xdir && $AR x $my_xabs) || exit $?
  297.   fi # $darwin_arches
  298. fi # $run
  299.       ;;
  300.       *)
  301. # We will extract separately just the conflicting names and we will
  302. # no longer touch any unique names. It is faster to leave these
  303. # extract automatically by $AR in one run.
  304. $show "(cd $my_xdir && $AR x $my_xabs)"
  305. $run eval "(cd $my_xdir && $AR x $my_xabs)" || exit $?
  306. if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
  307.   :
  308. else
  309.   $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
  310.   $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
  311.   $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
  312.   do
  313.     i=1
  314.     while test "$i" -le "$count"
  315.     do
  316.       # Put our $i before any first dot (extension)
  317.       # Never overwrite any file
  318.       name_to="$name"
  319.       while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
  320.       do
  321. name_to=`$echo "X$name_to" | $Xsed -e "s/([^.]*)/1-$i/"`
  322.       done
  323.       $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
  324.       $run eval "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
  325.       i=`expr $i + 1`
  326.     done
  327.   done
  328. fi
  329. ;;
  330.       esac
  331.       my_oldobjs="$my_oldobjs "`find $my_xdir -name *.$objext -print -o -name *.lo -print | $NL2SP`
  332.     done
  333.     func_extract_archives_result="$my_oldobjs"
  334. }
  335. # End of Shell function definitions
  336. #####################################
  337. # Darwin sucks
  338. eval std_shrext="$shrext_cmds"
  339. # Parse our command line options once, thoroughly.
  340. while test "$#" -gt 0
  341. do
  342.   arg="$1"
  343.   shift
  344.   case $arg in
  345.   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  346.   *) optarg= ;;
  347.   esac
  348.   # If the previous option needs an argument, assign it.
  349.   if test -n "$prev"; then
  350.     case $prev in
  351.     execute_dlfiles)
  352.       execute_dlfiles="$execute_dlfiles $arg"
  353.       ;;
  354.     tag)
  355.       tagname="$arg"
  356.       preserve_args="${preserve_args}=$arg"
  357.       # Check whether tagname contains only valid characters
  358.       case $tagname in
  359.       *[!-_A-Za-z0-9,/]*)
  360. $echo "$progname: invalid tag name: $tagname" 1>&2
  361. exit $EXIT_FAILURE
  362. ;;
  363.       esac
  364.       case $tagname in
  365.       CC)
  366. # Don't test for the "default" C tag, as we know, it's there, but
  367. # not specially marked.
  368. ;;
  369.       *)
  370. if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
  371.   taglist="$taglist $tagname"
  372.   # Evaluate the configuration.
  373.   eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
  374. else
  375.   $echo "$progname: ignoring unknown tag $tagname" 1>&2
  376. fi
  377. ;;
  378.       esac
  379.       ;;
  380.     *)
  381.       eval "$prev=$arg"
  382.       ;;
  383.     esac
  384.     prev=
  385.     prevopt=
  386.     continue
  387.   fi
  388.   # Have we seen a non-optional argument yet?
  389.   case $arg in
  390.   --help)
  391.     show_help=yes
  392.     ;;
  393.   --version)
  394.     $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  395.     $echo
  396.     $echo "Copyright (C) 2003  Free Software Foundation, Inc."
  397.     $echo "This is free software; see the source for copying conditions.  There is NO"
  398.     $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
  399.     exit $EXIT_SUCCESS
  400.     ;;
  401.   --config)
  402.     ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
  403.     # Now print the configurations for the tags.
  404.     for tagname in $taglist; do
  405.       ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
  406.     done
  407.     exit $EXIT_SUCCESS
  408.     ;;
  409.   --debug)
  410.     $echo "$progname: enabling shell trace mode"
  411.     set -x
  412.     preserve_args="$preserve_args $arg"
  413.     ;;
  414.   --dry-run | -n)
  415.     run=:
  416.     ;;
  417.   --features)
  418.     $echo "host: $host"
  419.     if test "$build_libtool_libs" = yes; then
  420.       $echo "enable shared libraries"
  421.     else
  422.       $echo "disable shared libraries"
  423.     fi
  424.     if test "$build_old_libs" = yes; then
  425.       $echo "enable static libraries"
  426.     else
  427.       $echo "disable static libraries"
  428.     fi
  429.     exit $EXIT_SUCCESS
  430.     ;;
  431.   --finish) mode="finish" ;;
  432.   --mode) prevopt="--mode" prev=mode ;;
  433.   --mode=*) mode="$optarg" ;;
  434.   --preserve-dup-deps) duplicate_deps="yes" ;;
  435.   --quiet | --silent)
  436.     show=:
  437.     preserve_args="$preserve_args $arg"
  438.     ;;
  439.   --tag) prevopt="--tag" prev=tag ;;
  440.   --tag=*)
  441.     set tag "$optarg" ${1+"$@"}
  442.     shift
  443.     prev=tag
  444.     preserve_args="$preserve_args --tag"
  445.     ;;
  446.   -dlopen)
  447.     prevopt="-dlopen"
  448.     prev=execute_dlfiles
  449.     ;;
  450.   -*)
  451.     $echo "$modename: unrecognized option `$arg'" 1>&2
  452.     $echo "$help" 1>&2
  453.     exit $EXIT_FAILURE
  454.     ;;
  455.   *)
  456.     nonopt="$arg"
  457.     break
  458.     ;;
  459.   esac
  460. done
  461. if test -n "$prevopt"; then
  462.   $echo "$modename: option `$prevopt' requires an argument" 1>&2
  463.   $echo "$help" 1>&2
  464.   exit $EXIT_FAILURE
  465. fi
  466. # If this variable is set in any of the actions, the command in it
  467. # will be execed at the end.  This prevents here-documents from being
  468. # left over by shells.
  469. exec_cmd=
  470. if test -z "$show_help"; then
  471.   # Infer the operation mode.
  472.   if test -z "$mode"; then
  473.     $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
  474.     $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
  475.     case $nonopt in
  476.     *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
  477.       mode=link
  478.       for arg
  479.       do
  480. case $arg in
  481. -c)
  482.    mode=compile
  483.    break
  484.    ;;
  485. esac
  486.       done
  487.       ;;
  488.     *db | *dbx | *strace | *truss)
  489.       mode=execute
  490.       ;;
  491.     *install*|cp|mv)
  492.       mode=install
  493.       ;;
  494.     *rm)
  495.       mode=uninstall
  496.       ;;
  497.     *)
  498.       # If we have no mode, but dlfiles were specified, then do execute mode.
  499.       test -n "$execute_dlfiles" && mode=execute
  500.       # Just use the default operation mode.
  501.       if test -z "$mode"; then
  502. if test -n "$nonopt"; then
  503.   $echo "$modename: warning: cannot infer operation mode from `$nonopt'" 1>&2
  504. else
  505.   $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  506. fi
  507.       fi
  508.       ;;
  509.     esac
  510.   fi
  511.   # Only execute mode is allowed to have -dlopen flags.
  512.   if test -n "$execute_dlfiles" && test "$mode" != execute; then
  513.     $echo "$modename: unrecognized option `-dlopen'" 1>&2
  514.     $echo "$help" 1>&2
  515.     exit $EXIT_FAILURE
  516.   fi
  517.   # Change the help message to a mode-specific one.
  518.   generic_help="$help"
  519.   help="Try `$modename --help --mode=$mode' for more information."
  520.   # These modes are in order of execution frequency so that they run quickly.
  521.   case $mode in
  522.   # libtool compile mode
  523.   compile)
  524.     modename="$modename: compile"
  525.     # Get the compilation command and the source file.
  526.     base_compile=
  527.     srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
  528.     suppress_opt=yes
  529.     suppress_output=
  530.     arg_mode=normal
  531.     libobj=
  532.     later=
  533.     for arg
  534.     do
  535.       case "$arg_mode" in
  536.       arg  )
  537. # do not "continue".  Instead, add this to base_compile
  538. lastarg="$arg"
  539. arg_mode=normal
  540. ;;
  541.       target )
  542. libobj="$arg"
  543. arg_mode=normal
  544. continue
  545. ;;
  546.       normal )
  547. # Accept any command-line options.
  548. case $arg in
  549. -o)
  550.   if test -n "$libobj" ; then
  551.     $echo "$modename: you cannot specify `-o' more than once" 1>&2
  552.     exit $EXIT_FAILURE
  553.   fi
  554.   arg_mode=target
  555.   continue
  556.   ;;
  557. -static | -prefer-pic | -prefer-non-pic)
  558.   later="$later $arg"
  559.   continue
  560.   ;;
  561. -no-suppress)
  562.   suppress_opt=no
  563.   continue
  564.   ;;
  565. -Xcompiler)
  566.   arg_mode=arg  #  the next one goes into the "base_compile" arg list
  567.   continue      #  The current "srcfile" will either be retained or
  568.   ;;            #  replaced later.  I would guess that would be a bug.
  569. -Wc,*)
  570.   args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
  571.   lastarg=
  572.   save_ifs="$IFS"; IFS=','
  573.     for arg in $args; do
  574.     IFS="$save_ifs"
  575.     # Double-quote args containing other shell metacharacters.
  576.     # Many Bourne shells cannot handle close brackets correctly
  577.     # in scan sets, so we specify it separately.
  578.     case $arg in
  579.       *[[~#^&*(){}|;<>?'  ]*|*]*|"")
  580.       arg=""$arg""
  581.       ;;
  582.     esac
  583.     lastarg="$lastarg $arg"
  584.   done
  585.   IFS="$save_ifs"
  586.   lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
  587.   # Add the arguments to base_compile.
  588.   base_compile="$base_compile $lastarg"
  589.   continue
  590.   ;;
  591. * )
  592.   # Accept the current argument as the source file.
  593.   # The previous "srcfile" becomes the current argument.
  594.   #
  595.   lastarg="$srcfile"
  596.   srcfile="$arg"
  597.   ;;
  598. esac  #  case $arg
  599. ;;
  600.       esac    #  case $arg_mode
  601.       # Aesthetically quote the previous argument.
  602.       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  603.       case $lastarg in
  604.       # Double-quote args containing other shell metacharacters.
  605.       # Many Bourne shells cannot handle close brackets correctly
  606.       # in scan sets, so we specify it separately.
  607.       *[[~#^&*(){}|;<>?'  ]*|*]*|"")
  608. lastarg=""$lastarg""
  609. ;;
  610.       esac
  611.       base_compile="$base_compile $lastarg"
  612.     done # for arg
  613.     case $arg_mode in
  614.     arg)
  615.       $echo "$modename: you must specify an argument for -Xcompile"
  616.       exit $EXIT_FAILURE
  617.       ;;
  618.     target)
  619.       $echo "$modename: you must specify a target with `-o'" 1>&2
  620.       exit $EXIT_FAILURE
  621.       ;;
  622.     *)
  623.       # Get the name of the library object.
  624.       [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  625.       ;;
  626.     esac
  627.     # Recognize several different file suffixes.
  628.     # If the user specifies -o file.o, it is replaced with file.lo
  629.     xform='[cCFSifmso]'
  630.     case $libobj in
  631.     *.ada) xform=ada ;;
  632.     *.adb) xform=adb ;;
  633.     *.ads) xform=ads ;;
  634.     *.asm) xform=asm ;;
  635.     *.c++) xform=c++ ;;
  636.     *.cc) xform=cc ;;
  637.     *.ii) xform=ii ;;
  638.     *.class) xform=class ;;
  639.     *.cpp) xform=cpp ;;
  640.     *.cxx) xform=cxx ;;
  641.     *.f90) xform=f90 ;;
  642.     *.for) xform=for ;;
  643.     *.java) xform=java ;;
  644.     esac
  645.     libobj=`$echo "X$libobj" | $Xsed -e "s/.$xform$/.lo/"`
  646.     case $libobj in
  647.     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  648.     *)
  649.       $echo "$modename: cannot determine name of library object from `$libobj'" 1>&2
  650.       exit $EXIT_FAILURE
  651.       ;;
  652.     esac
  653.     func_infer_tag $base_compile
  654.     for arg in $later; do
  655.       case $arg in
  656.       -static)
  657. build_old_libs=yes
  658. continue
  659. ;;
  660.       -prefer-pic)
  661. pic_mode=yes
  662. continue
  663. ;;
  664.       -prefer-non-pic)
  665. pic_mode=no
  666. continue
  667. ;;
  668.       esac
  669.     done
  670.     objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  671.     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  672.     if test "X$xdir" = "X$obj"; then
  673.       xdir=
  674.     else
  675.       xdir=$xdir/
  676.     fi
  677.     lobj=${xdir}$objdir/$objname
  678.     if test -z "$base_compile"; then
  679.       $echo "$modename: you must specify a compilation command" 1>&2
  680.       $echo "$help" 1>&2
  681.       exit $EXIT_FAILURE
  682.     fi
  683.     # Delete any leftover library objects.
  684.     if test "$build_old_libs" = yes; then
  685.       removelist="$obj $lobj $libobj ${libobj}T"
  686.     else
  687.       removelist="$lobj $libobj ${libobj}T"
  688.     fi
  689.     $run $rm $removelist
  690.     trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  691.     # On Cygwin there's no "real" PIC flag so we must build both object types
  692.     case $host_os in
  693.     cygwin* | mingw* | pw32* | os2*)
  694.       pic_mode=default
  695.       ;;
  696.     esac
  697.     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
  698.       # non-PIC code in shared libraries is not supported
  699.       pic_mode=default
  700.     fi
  701.     # Calculate the filename of the output object if compiler does
  702.     # not support -o with -c
  703.     if test "$compiler_c_o" = no; then
  704.       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%.[^.]*$%%'`.${objext}
  705.       lockfile="$output_obj.lock"
  706.       removelist="$removelist $output_obj $lockfile"
  707.       trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  708.     else
  709.       output_obj=
  710.       need_locks=no
  711.       lockfile=
  712.     fi
  713.     # Lock this critical section if it is needed
  714.     # We use this script file to make the link, it avoids creating a new file
  715.     if test "$need_locks" = yes; then
  716.       until $run ln "$progpath" "$lockfile" 2>/dev/null; do
  717. $show "Waiting for $lockfile to be removed"
  718. sleep 2
  719.       done
  720.     elif test "$need_locks" = warn; then
  721.       if test -f "$lockfile"; then
  722. $echo "
  723. *** ERROR, $lockfile exists and contains:
  724. `cat $lockfile 2>/dev/null`
  725. This indicates that another process is trying to use the same
  726. temporary object file, and libtool could not work around it because
  727. your compiler does not support `-c' and `-o' together.  If you
  728. repeat this compilation, it may succeed, by chance, but you had better
  729. avoid parallel builds (make -j) in this platform, or get a better
  730. compiler."
  731. $run $rm $removelist
  732. exit $EXIT_FAILURE
  733.       fi
  734.       $echo $srcfile > "$lockfile"
  735.     fi
  736.     if test -n "$fix_srcfile_path"; then
  737.       eval srcfile="$fix_srcfile_path"
  738.     fi
  739.     $run $rm "$libobj" "${libobj}T"
  740.     # Create a libtool object file (analogous to a ".la" file),
  741.     # but don't create it if we're doing a dry run.
  742.     test -z "$run" && cat > ${libobj}T <<EOF
  743. # $libobj - a libtool object file
  744. # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  745. #
  746. # Please DO NOT delete this file!
  747. # It is necessary for linking the library.
  748. # Name of the PIC object.
  749. EOF
  750.     # Only build a PIC object if we are building libtool libraries.
  751.     if test "$build_libtool_libs" = yes; then
  752.       # Without this assignment, base_compile gets emptied.
  753.       fbsd_hideous_sh_bug=$base_compile
  754.       if test "$pic_mode" != no; then
  755. command="$base_compile $srcfile $pic_flag"
  756.       else
  757. # Don't build PIC code
  758. command="$base_compile $srcfile"
  759.       fi
  760.       if test ! -d "${xdir}$objdir"; then
  761. $show "$mkdir ${xdir}$objdir"
  762. $run $mkdir ${xdir}$objdir
  763. status=$?
  764. if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
  765.   exit $status
  766. fi
  767.       fi
  768.       if test -z "$output_obj"; then
  769. # Place PIC objects in $objdir
  770. command="$command -o $lobj"
  771.       fi
  772.       $run $rm "$lobj" "$output_obj"
  773.       $show "$command"
  774.       if $run eval "$command"; then :
  775.       else
  776. test -n "$output_obj" && $run $rm $removelist
  777. exit $EXIT_FAILURE
  778.       fi
  779.       if test "$need_locks" = warn &&
  780.  test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  781. $echo "
  782. *** ERROR, $lockfile contains:
  783. `cat $lockfile 2>/dev/null`
  784. but it should contain:
  785. $srcfile
  786. This indicates that another process is trying to use the same
  787. temporary object file, and libtool could not work around it because
  788. your compiler does not support `-c' and `-o' together.  If you
  789. repeat this compilation, it may succeed, by chance, but you had better
  790. avoid parallel builds (make -j) in this platform, or get a better
  791. compiler."
  792. $run $rm $removelist
  793. exit $EXIT_FAILURE
  794.       fi
  795.       # Just move the object if needed, then go on to compile the next one
  796.       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  797. $show "$mv $output_obj $lobj"
  798. if $run $mv $output_obj $lobj; then :
  799. else
  800.   error=$?
  801.   $run $rm $removelist
  802.   exit $error
  803. fi
  804.       fi
  805.       # Append the name of the PIC object to the libtool object file.
  806.       test -z "$run" && cat >> ${libobj}T <<EOF
  807. pic_object='$objdir/$objname'
  808. EOF
  809.       # Allow error messages only from the first compilation.
  810.       if test "$suppress_opt" = yes; then
  811.         suppress_output=' >/dev/null 2>&1'
  812.       fi
  813.     else
  814.       # No PIC object so indicate it doesn't exist in the libtool
  815.       # object file.
  816.       test -z "$run" && cat >> ${libobj}T <<EOF
  817. pic_object=none
  818. EOF
  819.     fi
  820.     # Only build a position-dependent object if we build old libraries.
  821.     if test "$build_old_libs" = yes; then
  822.       if test "$pic_mode" != yes; then
  823. # Don't build PIC code
  824. command="$base_compile $srcfile"
  825.       else
  826. command="$base_compile $srcfile $pic_flag"
  827.       fi
  828.       if test "$compiler_c_o" = yes; then
  829. command="$command -o $obj"
  830.       fi
  831.       # Suppress compiler output if we already did a PIC compilation.
  832.       command="$command$suppress_output"
  833.       $run $rm "$obj" "$output_obj"
  834.       $show "$command"
  835.       if $run eval "$command"; then :
  836.       else
  837. $run $rm $removelist
  838. exit $EXIT_FAILURE
  839.       fi
  840.       if test "$need_locks" = warn &&
  841.  test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  842. $echo "
  843. *** ERROR, $lockfile contains:
  844. `cat $lockfile 2>/dev/null`
  845. but it should contain:
  846. $srcfile
  847. This indicates that another process is trying to use the same
  848. temporary object file, and libtool could not work around it because
  849. your compiler does not support `-c' and `-o' together.  If you
  850. repeat this compilation, it may succeed, by chance, but you had better
  851. avoid parallel builds (make -j) in this platform, or get a better
  852. compiler."
  853. $run $rm $removelist
  854. exit $EXIT_FAILURE
  855.       fi
  856.       # Just move the object if needed
  857.       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  858. $show "$mv $output_obj $obj"
  859. if $run $mv $output_obj $obj; then :
  860. else
  861.   error=$?
  862.   $run $rm $removelist
  863.   exit $error
  864. fi
  865.       fi
  866.       # Append the name of the non-PIC object the libtool object file.
  867.       # Only append if the libtool object file exists.
  868.       test -z "$run" && cat >> ${libobj}T <<EOF
  869. # Name of the non-PIC object.
  870. non_pic_object='$objname'
  871. EOF
  872.     else
  873.       # Append the name of the non-PIC object the libtool object file.
  874.       # Only append if the libtool object file exists.
  875.       test -z "$run" && cat >> ${libobj}T <<EOF
  876. # Name of the non-PIC object.
  877. non_pic_object=none
  878. EOF
  879.     fi
  880.     $run $mv "${libobj}T" "${libobj}"
  881.     # Unlock the critical section if it was locked
  882.     if test "$need_locks" != no; then
  883.       $run $rm "$lockfile"
  884.     fi
  885.     exit $EXIT_SUCCESS
  886.     ;;
  887.   # libtool link mode
  888.   link | relink)
  889.     modename="$modename: link"
  890.     case $host in
  891.     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  892.       # It is impossible to link a dll without this setting, and
  893.       # we shouldn't force the makefile maintainer to figure out
  894.       # which system we are compiling for in order to pass an extra
  895.       # flag for every libtool invocation.
  896.       # allow_undefined=no
  897.       # FIXME: Unfortunately, there are problems with the above when trying
  898.       # to make a dll which has undefined symbols, in which case not
  899.       # even a static library is built.  For now, we need to specify
  900.       # -no-undefined on the libtool link line when we can be certain
  901.       # that all symbols are satisfied, otherwise we get a static library.
  902.       allow_undefined=yes
  903.       ;;
  904.     *)
  905.       allow_undefined=yes
  906.       ;;
  907.     esac
  908.     libtool_args="$nonopt"
  909.     base_compile="$nonopt $@"
  910.     compile_command="$nonopt"
  911.     finalize_command="$nonopt"
  912.     compile_rpath=
  913.     finalize_rpath=
  914.     compile_shlibpath=
  915.     finalize_shlibpath=
  916.     convenience=
  917.     old_convenience=
  918.     deplibs=
  919.     old_deplibs=
  920.     compiler_flags=
  921.     linker_flags=
  922.     dllsearchpath=
  923.     lib_search_path=`pwd`
  924.     inst_prefix_dir=
  925.     avoid_version=no
  926.     dlfiles=
  927.     dlprefiles=
  928.     dlself=no
  929.     export_dynamic=no
  930.     export_symbols=
  931.     export_symbols_regex=
  932.     generated=
  933.     libobjs=
  934.     ltlibs=
  935.     module=no
  936.     no_install=no
  937.     objs=
  938.     non_pic_objects=
  939.     precious_files_regex=
  940.     prefer_static_libs=no
  941.     preload=no
  942.     prev=
  943.     prevarg=
  944.     release=
  945.     rpath=
  946.     xrpath=
  947.     perm_rpath=
  948.     temp_rpath=
  949.     thread_safe=no
  950.     vinfo=
  951.     vinfo_number=no
  952.     func_infer_tag $base_compile
  953.     # We need to know -static, to get the right output filenames.
  954.     for arg
  955.     do
  956.       case $arg in
  957.       -all-static | -static)
  958. if test "X$arg" = "X-all-static"; then
  959.   if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  960.     $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  961.   fi
  962.   if test -n "$link_static_flag"; then
  963.     dlopen_self=$dlopen_self_static
  964.   fi
  965. else
  966.   if test -z "$pic_flag" && test -n "$link_static_flag"; then
  967.     dlopen_self=$dlopen_self_static
  968.   fi
  969. fi
  970. build_libtool_libs=no
  971. build_old_libs=yes
  972. prefer_static_libs=yes
  973. break
  974. ;;
  975.       esac
  976.     done
  977.     # See if our shared archives depend on static archives.
  978.     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
  979.     # Go through the arguments, transforming them on the way.
  980.     while test "$#" -gt 0; do
  981.       arg="$1"
  982.       shift
  983.       case $arg in
  984.       *[[~#^&*(){}|;<>?'  ]*|*]*|"")
  985. qarg="`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`" ### testsuite: skip nested quoting test
  986. ;;
  987.       *) qarg=$arg ;;
  988.       esac
  989.       libtool_args="$libtool_args $qarg"
  990.       # If the previous option needs an argument, assign it.
  991.       if test -n "$prev"; then
  992. case $prev in
  993. output)
  994.   compile_command="$compile_command @OUTPUT@"
  995.   finalize_command="$finalize_command @OUTPUT@"
  996.   ;;
  997. esac
  998. case $prev in
  999. dlfiles|dlprefiles)
  1000.   if test "$preload" = no; then
  1001.     # Add the symbol object into the linking commands.
  1002.     compile_command="$compile_command @SYMFILE@"
  1003.     finalize_command="$finalize_command @SYMFILE@"
  1004.     preload=yes
  1005.   fi
  1006.   case $arg in
  1007.   *.la | *.lo) ;;  # We handle these cases below.
  1008.   force)
  1009.     if test "$dlself" = no; then
  1010.       dlself=needless
  1011.       export_dynamic=yes
  1012.     fi
  1013.     prev=
  1014.     continue
  1015.     ;;
  1016.   self)
  1017.     if test "$prev" = dlprefiles; then
  1018.       dlself=yes
  1019.     elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
  1020.       dlself=yes
  1021.     else
  1022.       dlself=needless
  1023.       export_dynamic=yes
  1024.     fi
  1025.     prev=
  1026.     continue
  1027.     ;;
  1028.   *)
  1029.     if test "$prev" = dlfiles; then
  1030.       dlfiles="$dlfiles $arg"
  1031.     else
  1032.       dlprefiles="$dlprefiles $arg"
  1033.     fi
  1034.     prev=
  1035.     continue
  1036.     ;;
  1037.   esac
  1038.   ;;
  1039. expsyms)
  1040.   export_symbols="$arg"
  1041.   if test ! -f "$arg"; then
  1042.     $echo "$modename: symbol file `$arg' does not exist"
  1043.     exit $EXIT_FAILURE
  1044.   fi
  1045.   prev=
  1046.   continue
  1047.   ;;
  1048. expsyms_regex)
  1049.   export_symbols_regex="$arg"
  1050.   prev=
  1051.   continue
  1052.   ;;
  1053. inst_prefix)
  1054.   inst_prefix_dir="$arg"
  1055.   prev=
  1056.   continue
  1057.   ;;
  1058. precious_regex)
  1059.   precious_files_regex="$arg"
  1060.   prev=
  1061.   continue
  1062.   ;;
  1063. release)
  1064.   release="-$arg"
  1065.   prev=
  1066.   continue
  1067.   ;;
  1068. objectlist)
  1069.   if test -f "$arg"; then
  1070.     save_arg=$arg
  1071.     moreargs=
  1072.     for fil in `cat $save_arg`
  1073.     do
  1074. #       moreargs="$moreargs $fil"
  1075.       arg=$fil
  1076.       # A libtool-controlled object.
  1077.       # Check to see that this really is a libtool object.
  1078.       if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1079. pic_object=
  1080. non_pic_object=
  1081. # Read the .lo file
  1082. # If there is no directory component, then add one.
  1083. case $arg in
  1084. */* | *\*) . $arg ;;
  1085. *) . ./$arg ;;
  1086. esac
  1087. if test -z "$pic_object" || 
  1088.    test -z "$non_pic_object" ||
  1089.    test "$pic_object" = none && 
  1090.    test "$non_pic_object" = none; then
  1091.   $echo "$modename: cannot find name of object for `$arg'" 1>&2
  1092.   exit $EXIT_FAILURE
  1093. fi
  1094. # Extract subdirectory from the argument.
  1095. xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1096. if test "X$xdir" = "X$arg"; then
  1097.   xdir=
  1098. else
  1099.   xdir="$xdir/"
  1100. fi
  1101. if test "$pic_object" != none; then
  1102.   # Prepend the subdirectory the object is found in.
  1103.   pic_object="$xdir$pic_object"
  1104.   if test "$prev" = dlfiles; then
  1105.     if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1106.       dlfiles="$dlfiles $pic_object"
  1107.       prev=
  1108.       continue
  1109.     else
  1110.       # If libtool objects are unsupported, then we need to preload.
  1111.       prev=dlprefiles
  1112.     fi
  1113.   fi
  1114.   # CHECK ME:  I think I busted this.  -Ossama
  1115.   if test "$prev" = dlprefiles; then
  1116.     # Preload the old-style object.
  1117.     dlprefiles="$dlprefiles $pic_object"
  1118.     prev=
  1119.   fi
  1120.   # A PIC object.
  1121.   libobjs="$libobjs $pic_object"
  1122.   arg="$pic_object"
  1123. fi
  1124. # Non-PIC object.
  1125. if test "$non_pic_object" != none; then
  1126.   # Prepend the subdirectory the object is found in.
  1127.   non_pic_object="$xdir$non_pic_object"
  1128.   # A standard non-PIC object
  1129.   non_pic_objects="$non_pic_objects $non_pic_object"
  1130.   if test -z "$pic_object" || test "$pic_object" = none ; then
  1131.     arg="$non_pic_object"
  1132.   fi
  1133. fi
  1134.       else
  1135. # Only an error if not doing a dry-run.
  1136. if test -z "$run"; then
  1137.   $echo "$modename: `$arg' is not a valid libtool object" 1>&2
  1138.   exit $EXIT_FAILURE
  1139. else
  1140.   # Dry-run case.
  1141.   # Extract subdirectory from the argument.
  1142.   xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1143.   if test "X$xdir" = "X$arg"; then
  1144.     xdir=
  1145.   else
  1146.     xdir="$xdir/"
  1147.   fi
  1148.   pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1149.   non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1150.   libobjs="$libobjs $pic_object"
  1151.   non_pic_objects="$non_pic_objects $non_pic_object"
  1152. fi
  1153.       fi
  1154.     done
  1155.   else
  1156.     $echo "$modename: link input file `$save_arg' does not exist"
  1157.     exit $EXIT_FAILURE
  1158.   fi
  1159.   arg=$save_arg
  1160.   prev=
  1161.   continue
  1162.   ;;
  1163. rpath | xrpath)
  1164.   # We need an absolute path.
  1165.   case $arg in
  1166.   [\/]* | [A-Za-z]:[\/]*) ;;
  1167.   *)
  1168.     $echo "$modename: only absolute run-paths are allowed" 1>&2
  1169.     exit $EXIT_FAILURE
  1170.     ;;
  1171.   esac
  1172.   if test "$prev" = rpath; then
  1173.     case "$rpath " in
  1174.     *" $arg "*) ;;
  1175.     *) rpath="$rpath $arg" ;;
  1176.     esac
  1177.   else
  1178.     case "$xrpath " in
  1179.     *" $arg "*) ;;
  1180.     *) xrpath="$xrpath $arg" ;;
  1181.     esac
  1182.   fi
  1183.   prev=
  1184.   continue
  1185.   ;;
  1186. xcompiler)
  1187.   compiler_flags="$compiler_flags $qarg"
  1188.   prev=
  1189.   compile_command="$compile_command $qarg"
  1190.   finalize_command="$finalize_command $qarg"
  1191.   continue
  1192.   ;;
  1193. xlinker)
  1194.   linker_flags="$linker_flags $qarg"
  1195.   compiler_flags="$compiler_flags $wl$qarg"
  1196.   prev=
  1197.   compile_command="$compile_command $wl$qarg"
  1198.   finalize_command="$finalize_command $wl$qarg"
  1199.   continue
  1200.   ;;
  1201. xcclinker)
  1202.   linker_flags="$linker_flags $qarg"
  1203.   compiler_flags="$compiler_flags $qarg"
  1204.   prev=
  1205.   compile_command="$compile_command $qarg"
  1206.   finalize_command="$finalize_command $qarg"
  1207.   continue
  1208.   ;;
  1209. shrext)
  1210.      shrext_cmds="$arg"
  1211.   prev=
  1212.   continue
  1213.   ;;
  1214. *)
  1215.   eval "$prev="$arg""
  1216.   prev=
  1217.   continue
  1218.   ;;
  1219. esac
  1220.       fi # test -n "$prev"
  1221.       prevarg="$arg"
  1222.       case $arg in
  1223.       -all-static)
  1224. if test -n "$link_static_flag"; then
  1225.   compile_command="$compile_command $link_static_flag"
  1226.   finalize_command="$finalize_command $link_static_flag"
  1227. fi
  1228. continue
  1229. ;;
  1230.       -allow-undefined)
  1231. # FIXME: remove this flag sometime in the future.
  1232. $echo "$modename: `-allow-undefined' is deprecated because it is the default" 1>&2
  1233. continue
  1234. ;;
  1235.       -avoid-version)
  1236. avoid_version=yes
  1237. continue
  1238. ;;
  1239.       -dlopen)
  1240. prev=dlfiles
  1241. continue
  1242. ;;
  1243.       -dlpreopen)
  1244. prev=dlprefiles
  1245. continue
  1246. ;;
  1247.       -export-dynamic)
  1248. export_dynamic=yes
  1249. continue
  1250. ;;
  1251.       -export-symbols | -export-symbols-regex)
  1252. if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1253.   $echo "$modename: more than one -exported-symbols argument is not allowed"
  1254.   exit $EXIT_FAILURE
  1255. fi
  1256. if test "X$arg" = "X-export-symbols"; then
  1257.   prev=expsyms
  1258. else
  1259.   prev=expsyms_regex
  1260. fi
  1261. continue
  1262. ;;
  1263.       -inst-prefix-dir)
  1264. prev=inst_prefix
  1265. continue
  1266. ;;
  1267.       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
  1268.       # so, if we see these flags be careful not to treat them like -L
  1269.       -L[A-Z][A-Z]*:*)
  1270. case $with_gcc/$host in
  1271. no/*-*-irix* | /*-*-irix*)
  1272.   compile_command="$compile_command $arg"
  1273.   finalize_command="$finalize_command $arg"
  1274.   ;;
  1275. esac
  1276. continue
  1277. ;;
  1278.       -L*)
  1279. dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1280. # We need an absolute path.
  1281. case $dir in
  1282. [\/]* | [A-Za-z]:[\/]*) ;;
  1283. *)
  1284.   absdir=`cd "$dir" && pwd`
  1285.   if test -z "$absdir"; then
  1286.     $echo "$modename: cannot determine absolute directory name of `$dir'" 1>&2
  1287.     exit $EXIT_FAILURE
  1288.   fi
  1289.   dir="$absdir"
  1290.   ;;
  1291. esac
  1292. case "$deplibs " in
  1293. *" -L$dir "*) ;;
  1294. *)
  1295.   deplibs="$deplibs -L$dir"
  1296.   lib_search_path="$lib_search_path $dir"
  1297.   ;;
  1298. esac
  1299. case $host in
  1300. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1301.   case :$dllsearchpath: in
  1302.   *":$dir:"*) ;;
  1303.   *) dllsearchpath="$dllsearchpath:$dir";;
  1304.   esac
  1305.   ;;
  1306. esac
  1307. continue
  1308. ;;
  1309.       -l*)
  1310. if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  1311.   case $host in
  1312.   *-*-cygwin* | *-*-pw32* | *-*-beos*)
  1313.     # These systems don't actually have a C or math library (as such)
  1314.     continue
  1315.     ;;
  1316.   *-*-mingw* | *-*-os2*)
  1317.     # These systems don't actually have a C library (as such)
  1318.     test "X$arg" = "X-lc" && continue
  1319.     ;;
  1320.   *-*-openbsd* | *-*-freebsd*)
  1321.     # Do not include libc due to us having libc/libc_r.
  1322.     test "X$arg" = "X-lc" && continue
  1323.     ;;
  1324.   *-*-rhapsody* | *-*-darwin1.[012])
  1325.     # Rhapsody C and math libraries are in the System framework
  1326.     deplibs="$deplibs -framework System"
  1327.     continue
  1328.   esac
  1329. elif test "X$arg" = "X-lc_r"; then
  1330.  case $host in
  1331.  *-*-openbsd* | *-*-freebsd*)
  1332.    # Do not include libc_r directly, use -pthread flag.
  1333.    continue
  1334.    ;;
  1335.  esac
  1336. fi
  1337. deplibs="$deplibs $arg"
  1338. continue
  1339. ;;
  1340.      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1341. deplibs="$deplibs $arg"
  1342. continue
  1343. ;;
  1344.       -module)
  1345. module=yes
  1346. continue
  1347. ;;
  1348.       # gcc -m* arguments should be passed to the linker via $compiler_flags
  1349.       # in order to pass architecture information to the linker
  1350.       # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
  1351.       # but this is not reliable with gcc because gcc may use -mfoo to
  1352.       # select a different linker, different libraries, etc, while
  1353.       # -Wl,-mfoo simply passes -mfoo to the linker.
  1354.       -m*)
  1355. # Unknown arguments in both finalize_command and compile_command need
  1356. # to be aesthetically quoted because they are evaled later.
  1357. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1358. case $arg in
  1359. *[[~#^&*(){}|;<>?'  ]*|*]*|"")
  1360.   arg=""$arg""
  1361.   ;;
  1362. esac
  1363.         compile_command="$compile_command $arg"
  1364.         finalize_command="$finalize_command $arg"
  1365.         if test "$with_gcc" = "yes" ; then
  1366.           compiler_flags="$compiler_flags $arg"
  1367.         fi
  1368.         continue
  1369.         ;;
  1370.       -shrext)
  1371. prev=shrext
  1372. continue
  1373. ;;
  1374.       -no-fast-install)
  1375. fast_install=no
  1376. continue
  1377. ;;
  1378.       -no-install)
  1379. case $host in
  1380. *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1381.   # The PATH hackery in wrapper scripts is required on Windows
  1382.   # in order for the loader to find any dlls it needs.
  1383.   $echo "$modename: warning: `-no-install' is ignored for $host" 1>&2
  1384.   $echo "$modename: warning: assuming `-no-fast-install' instead" 1>&2
  1385.   fast_install=no
  1386.   ;;
  1387. *) no_install=yes ;;
  1388. esac
  1389. continue
  1390. ;;
  1391.       -no-undefined)
  1392. allow_undefined=no
  1393. continue
  1394. ;;
  1395.       -objectlist)
  1396. prev=objectlist
  1397. continue
  1398. ;;
  1399.       -o) prev=output ;;
  1400.       -precious-files-regex)
  1401. prev=precious_regex
  1402. continue
  1403. ;;
  1404.       -release)
  1405. prev=release
  1406. continue
  1407. ;;
  1408.       -rpath)
  1409. prev=rpath
  1410. continue
  1411. ;;
  1412.       -R)
  1413. prev=xrpath
  1414. continue
  1415. ;;
  1416.       -R*)
  1417. dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1418. # We need an absolute path.
  1419. case $dir in
  1420. [\/]* | [A-Za-z]:[\/]*) ;;
  1421. *)
  1422.   $echo "$modename: only absolute run-paths are allowed" 1>&2
  1423.   exit $EXIT_FAILURE
  1424.   ;;
  1425. esac
  1426. case "$xrpath " in
  1427. *" $dir "*) ;;
  1428. *) xrpath="$xrpath $dir" ;;
  1429. esac
  1430. continue
  1431. ;;
  1432.       -static)
  1433. # The effects of -static are defined in a previous loop.
  1434. # We used to do the same as -all-static on platforms that
  1435. # didn't have a PIC flag, but the assumption that the effects
  1436. # would be equivalent was wrong.  It would break on at least
  1437. # Digital Unix and AIX.
  1438. continue
  1439. ;;
  1440.       -thread-safe)
  1441. thread_safe=yes
  1442. continue
  1443. ;;
  1444.       -version-info)
  1445. prev=vinfo
  1446. continue
  1447. ;;
  1448.       -version-number)
  1449. prev=vinfo
  1450. vinfo_number=yes
  1451. continue
  1452. ;;
  1453.       -Wc,*)
  1454. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1455. arg=
  1456. save_ifs="$IFS"; IFS=','
  1457. for flag in $args; do
  1458.   IFS="$save_ifs"
  1459.   case $flag in
  1460.     *[[~#^&*(){}|;<>?'  ]*|*]*|"")
  1461.     flag=""$flag""
  1462.     ;;
  1463.   esac
  1464.   arg="$arg $wl$flag"
  1465.   compiler_flags="$compiler_flags $flag"
  1466. done
  1467. IFS="$save_ifs"
  1468. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1469. ;;
  1470.       -Wl,*)
  1471. args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1472. arg=
  1473. save_ifs="$IFS"; IFS=','
  1474. for flag in $args; do
  1475.   IFS="$save_ifs"
  1476.   case $flag in
  1477.     *[[~#^&*(){}|;<>?'  ]*|*]*|"")
  1478.     flag=""$flag""
  1479.     ;;
  1480.   esac
  1481.   arg="$arg $wl$flag"
  1482.   compiler_flags="$compiler_flags $wl$flag"
  1483.   linker_flags="$linker_flags $flag"
  1484. done
  1485. IFS="$save_ifs"
  1486. arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1487. ;;
  1488.       -Xcompiler)
  1489. prev=xcompiler
  1490. continue
  1491. ;;
  1492.       -Xlinker)
  1493. prev=xlinker
  1494. continue
  1495. ;;
  1496.       -XCClinker)
  1497. prev=xcclinker
  1498. continue
  1499. ;;
  1500.       # Some other compiler flag.
  1501.       -* | +*)
  1502. # Unknown arguments in both finalize_command and compile_command need
  1503. # to be aesthetically quoted because they are evaled later.
  1504. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1505. case $arg in
  1506. *[[~#^&*(){}|;<>?'  ]*|*]*|"")
  1507.   arg=""$arg""
  1508.   ;;
  1509. esac
  1510. ;;
  1511.       *.$objext)
  1512. # A standard object.
  1513. objs="$objs $arg"
  1514. ;;
  1515.       *.lo)
  1516. # A libtool-controlled object.
  1517. # Check to see that this really is a libtool object.
  1518. if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1519.   pic_object=
  1520.   non_pic_object=
  1521.   # Read the .lo file
  1522.   # If there is no directory component, then add one.
  1523.   case $arg in
  1524.   */* | *\*) . $arg ;;
  1525.   *) . ./$arg ;;
  1526.   esac
  1527.   if test -z "$pic_object" || 
  1528.      test -z "$non_pic_object" ||
  1529.      test "$pic_object" = none && 
  1530.      test "$non_pic_object" = none; then
  1531.     $echo "$modename: cannot find name of object for `$arg'" 1>&2
  1532.     exit $EXIT_FAILURE
  1533.   fi
  1534.   # Extract subdirectory from the argument.
  1535.   xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1536.   if test "X$xdir" = "X$arg"; then
  1537.     xdir=
  1538.     else
  1539.     xdir="$xdir/"
  1540.   fi
  1541.   if test "$pic_object" != none; then
  1542.     # Prepend the subdirectory the object is found in.
  1543.     pic_object="$xdir$pic_object"
  1544.     if test "$prev" = dlfiles; then
  1545.       if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
  1546. dlfiles="$dlfiles $pic_object"
  1547. prev=
  1548. continue
  1549.       else
  1550. # If libtool objects are unsupported, then we need to preload.
  1551. prev=dlprefiles
  1552.       fi
  1553.     fi
  1554.     # CHECK ME:  I think I busted this.  -Ossama
  1555.     if test "$prev" = dlprefiles; then
  1556.       # Preload the old-style object.
  1557.       dlprefiles="$dlprefiles $pic_object"
  1558.       prev=
  1559.     fi
  1560.     # A PIC object.
  1561.     libobjs="$libobjs $pic_object"
  1562.     arg="$pic_object"
  1563.   fi
  1564.   # Non-PIC object.
  1565.   if test "$non_pic_object" != none; then
  1566.     # Prepend the subdirectory the object is found in.
  1567.     non_pic_object="$xdir$non_pic_object"
  1568.     # A standard non-PIC object
  1569.     non_pic_objects="$non_pic_objects $non_pic_object"
  1570.     if test -z "$pic_object" || test "$pic_object" = none ; then
  1571.       arg="$non_pic_object"
  1572.     fi
  1573.   fi
  1574. else
  1575.   # Only an error if not doing a dry-run.
  1576.   if test -z "$run"; then
  1577.     $echo "$modename: `$arg' is not a valid libtool object" 1>&2
  1578.     exit $EXIT_FAILURE
  1579.   else
  1580.     # Dry-run case.
  1581.     # Extract subdirectory from the argument.
  1582.     xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1583.     if test "X$xdir" = "X$arg"; then
  1584.       xdir=
  1585.     else
  1586.       xdir="$xdir/"
  1587.     fi
  1588.     pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1589.     non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1590.     libobjs="$libobjs $pic_object"
  1591.     non_pic_objects="$non_pic_objects $non_pic_object"
  1592.   fi
  1593. fi
  1594. ;;
  1595.       *.$libext)
  1596. # An archive.
  1597. deplibs="$deplibs $arg"
  1598. old_deplibs="$old_deplibs $arg"
  1599. continue
  1600. ;;
  1601.       *.la)
  1602. # A libtool-controlled library.
  1603. if test "$prev" = dlfiles; then
  1604.   # This library was specified with -dlopen.
  1605.   dlfiles="$dlfiles $arg"
  1606.   prev=
  1607. elif test "$prev" = dlprefiles; then
  1608.   # The library was specified with -dlpreopen.
  1609.   dlprefiles="$dlprefiles $arg"
  1610.   prev=
  1611. else
  1612.   deplibs="$deplibs $arg"
  1613. fi
  1614. continue
  1615. ;;
  1616.       # Some other compiler argument.
  1617.       *)
  1618. # Unknown arguments in both finalize_command and compile_command need
  1619. # to be aesthetically quoted because they are evaled later.
  1620. arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1621. case $arg in
  1622. *[[~#^&*(){}|;<>?'  ]*|*]*|"")
  1623.   arg=""$arg""
  1624.   ;;
  1625. esac
  1626. ;;
  1627.       esac # arg
  1628.       # Now actually substitute the argument into the commands.
  1629.       if test -n "$arg"; then
  1630. compile_command="$compile_command $arg"
  1631. finalize_command="$finalize_command $arg"
  1632.       fi
  1633.     done # argument parsing loop
  1634.     if test -n "$prev"; then
  1635.       $echo "$modename: the `$prevarg' option requires an argument" 1>&2
  1636.       $echo "$help" 1>&2
  1637.       exit $EXIT_FAILURE
  1638.     fi
  1639.     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1640.       eval arg="$export_dynamic_flag_spec"
  1641.       compile_command="$compile_command $arg"
  1642.       finalize_command="$finalize_command $arg"
  1643.     fi
  1644.     oldlibs=
  1645.     # calculate the name of the file, without its directory
  1646.     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1647.     libobjs_save="$libobjs"
  1648.     if test -n "$shlibpath_var"; then
  1649.       # get the directories listed in $shlibpath_var
  1650.       eval shlib_search_path=`$echo "X${$shlibpath_var}" | $Xsed -e 's/:/ /g'`
  1651.     else
  1652.       shlib_search_path=
  1653.     fi
  1654.     eval sys_lib_search_path="$sys_lib_search_path_spec"
  1655.     eval sys_lib_dlsearch_path="$sys_lib_dlsearch_path_spec"
  1656.     output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1657.     if test "X$output_objdir" = "X$output"; then
  1658.       output_objdir="$objdir"
  1659.     else
  1660.       output_objdir="$output_objdir/$objdir"
  1661.     fi
  1662.     # Create the object directory.
  1663.     if test ! -d "$output_objdir"; then
  1664.       $show "$mkdir $output_objdir"
  1665.       $run $mkdir $output_objdir
  1666.       status=$?
  1667.       if test "$status" -ne 0 && test ! -d "$output_objdir"; then
  1668. exit $status
  1669.       fi
  1670.     fi
  1671.     # Determine the type of output
  1672.     case $output in
  1673.     "")
  1674.       $echo "$modename: you must specify an output file" 1>&2
  1675.       $echo "$help" 1>&2
  1676.       exit $EXIT_FAILURE
  1677.       ;;
  1678.     *.$libext) linkmode=oldlib ;;
  1679.     *.lo | *.$objext) linkmode=obj ;;
  1680.     *.la) linkmode=lib ;;
  1681.     *) linkmode=prog ;; # Anything else should be a program.
  1682.     esac
  1683.     case $host in
  1684.     *cygwin* | *mingw* | *pw32*)
  1685.       # don't eliminate duplications in $postdeps and $predeps
  1686.       duplicate_compiler_generated_deps=yes
  1687.       ;;
  1688.     *)
  1689.       duplicate_compiler_generated_deps=$duplicate_deps
  1690.       ;;
  1691.     esac
  1692.     specialdeplibs=
  1693.     libs=
  1694.     # Find all interdependent deplibs by searching for libraries
  1695.     # that are linked more than once (e.g. -la -lb -la)
  1696.     for deplib in $deplibs; do
  1697.       if test "X$duplicate_deps" = "Xyes" ; then
  1698. case "$libs " in
  1699. *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1700. esac
  1701.       fi
  1702.       libs="$libs $deplib"
  1703.     done
  1704.     if test "$linkmode" = lib; then
  1705.       libs="$predeps $libs $compiler_lib_search_path $postdeps"
  1706.       # Compute libraries that are listed more than once in $predeps
  1707.       # $postdeps and mark them as special (i.e., whose duplicates are
  1708.       # not to be eliminated).
  1709.       pre_post_deps=
  1710.       if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  1711. for pre_post_dep in $predeps $postdeps; do
  1712.   case "$pre_post_deps " in
  1713.   *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  1714.   esac
  1715.   pre_post_deps="$pre_post_deps $pre_post_dep"
  1716. done
  1717.       fi
  1718.       pre_post_deps=
  1719.     fi
  1720.     deplibs=
  1721.     newdependency_libs=
  1722.     newlib_search_path=
  1723.     need_relink=no # whether we're linking any uninstalled libtool libraries
  1724.     notinst_deplibs= # not-installed libtool libraries
  1725.     notinst_path= # paths that contain not-installed libtool libraries
  1726.     case $linkmode in
  1727.     lib)
  1728. passes="conv link"
  1729. for file in $dlfiles $dlprefiles; do
  1730.   case $file in
  1731.   *.la) ;;
  1732.   *)
  1733.     $echo "$modename: libraries can `-dlopen' only libtool libraries: $file" 1>&2
  1734.     exit $EXIT_FAILURE
  1735.     ;;
  1736.   esac
  1737. done
  1738. ;;
  1739.     prog)
  1740. compile_deplibs=
  1741. finalize_deplibs=
  1742. alldeplibs=no
  1743. newdlfiles=
  1744. newdlprefiles=
  1745. passes="conv scan dlopen dlpreopen link"
  1746. ;;
  1747.     *)  passes="conv"
  1748. ;;
  1749.     esac
  1750.     for pass in $passes; do
  1751.       if test "$linkmode,$pass" = "lib,link" ||
  1752.  test "$linkmode,$pass" = "prog,scan"; then
  1753. libs="$deplibs"
  1754. deplibs=
  1755.       fi
  1756.       if test "$linkmode" = prog; then
  1757. case $pass in
  1758. dlopen) libs="$dlfiles" ;;
  1759. dlpreopen) libs="$dlprefiles" ;;
  1760. link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1761. esac
  1762.       fi
  1763.       if test "$pass" = dlopen; then
  1764. # Collect dlpreopened libraries
  1765. save_deplibs="$deplibs"
  1766. deplibs=
  1767.       fi
  1768.       for deplib in $libs; do
  1769. lib=
  1770. found=no
  1771. case $deplib in
  1772. -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1773.   if test "$linkmode,$pass" = "prog,link"; then
  1774.     compile_deplibs="$deplib $compile_deplibs"
  1775.     finalize_deplibs="$deplib $finalize_deplibs"
  1776.   else
  1777.     deplibs="$deplib $deplibs"
  1778.   fi
  1779.   continue
  1780.   ;;
  1781. -l*)
  1782.   if test "$linkmode" != lib && test "$linkmode" != prog; then
  1783.     $echo "$modename: warning: `-l' is ignored for archives/objects" 1>&2
  1784.     continue
  1785.   fi
  1786.   if test "$pass" = conv; then
  1787.     deplibs="$deplib $deplibs"
  1788.     continue
  1789.   fi
  1790.   name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1791.   for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1792.     for search_ext in .la $std_shrext .so .a; do
  1793.       # Search the libtool library
  1794.       lib="$searchdir/lib${name}${search_ext}"
  1795.       if test -f "$lib"; then
  1796. if test "$search_ext" = ".la"; then
  1797.   found=yes
  1798. else
  1799.   found=no
  1800. fi
  1801. break 2
  1802.       fi
  1803.     done
  1804.   done
  1805.   if test "$found" != yes; then
  1806.     # deplib doesn't seem to be a libtool library
  1807.     if test "$linkmode,$pass" = "prog,link"; then
  1808.       compile_deplibs="$deplib $compile_deplibs"
  1809.       finalize_deplibs="$deplib $finalize_deplibs"
  1810.     else
  1811.       deplibs="$deplib $deplibs"
  1812.       test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1813.     fi
  1814.     continue
  1815.   else # deplib is a libtool library
  1816.     # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
  1817.     # We need to do some special things here, and not later.
  1818.     if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1819.       case " $predeps $postdeps " in
  1820.       *" $deplib "*)
  1821. if (${SED} -e '2q' $lib |
  1822.                     grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1823.   library_names=
  1824.   old_library=
  1825.   case $lib in
  1826.   */* | *\*) . $lib ;;
  1827.   *) . ./$lib ;;
  1828.   esac
  1829.   for l in $old_library $library_names; do
  1830.     ll="$l"
  1831.   done
  1832.   if test "X$ll" = "X$old_library" ; then # only static version available
  1833.     found=no
  1834.     ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1835.     test "X$ladir" = "X$lib" && ladir="."
  1836.     lib=$ladir/$old_library
  1837.     if test "$linkmode,$pass" = "prog,link"; then
  1838.       compile_deplibs="$deplib $compile_deplibs"
  1839.       finalize_deplibs="$deplib $finalize_deplibs"
  1840.     else
  1841.       deplibs="$deplib $deplibs"
  1842.       test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
  1843.     fi
  1844.     continue
  1845.   fi
  1846. fi
  1847.         ;;
  1848.       *) ;;
  1849.       esac
  1850.     fi
  1851.   fi
  1852.   ;; # -l
  1853. -L*)
  1854.   case $linkmode in
  1855.   lib)
  1856.     deplibs="$deplib $deplibs"
  1857.     test "$pass" = conv && continue
  1858.     newdependency_libs="$deplib $newdependency_libs"
  1859.     newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1860.     ;;
  1861.   prog)
  1862.     if test "$pass" = conv; then
  1863.       deplibs="$deplib $deplibs"
  1864.       continue
  1865.     fi
  1866.     if test "$pass" = scan; then
  1867.       deplibs="$deplib $deplibs"
  1868.     else
  1869.       compile_deplibs="$deplib $compile_deplibs"
  1870.       finalize_deplibs="$deplib $finalize_deplibs"
  1871.     fi
  1872.     newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1873.     ;;
  1874.   *)
  1875.     $echo "$modename: warning: `-L' is ignored for archives/objects" 1>&2
  1876.     ;;
  1877.   esac # linkmode
  1878.   continue
  1879.   ;; # -L
  1880. -R*)
  1881.   if test "$pass" = link; then
  1882.     dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1883.     # Make sure the xrpath contains only unique directories.
  1884.     case "$xrpath " in
  1885.     *" $dir "*) ;;
  1886.     *) xrpath="$xrpath $dir" ;;
  1887.     esac
  1888.   fi
  1889.   deplibs="$deplib $deplibs"
  1890.   continue
  1891.   ;;
  1892. *.la) lib="$deplib" ;;
  1893. *.$libext)
  1894.   if test "$pass" = conv; then
  1895.     deplibs="$deplib $deplibs"
  1896.     continue
  1897.   fi
  1898.   case $linkmode in
  1899.   lib)
  1900.     valid_a_lib=no
  1901.     case $deplibs_check_method in
  1902.       match_pattern*)
  1903. set dummy $deplibs_check_method
  1904.         match_pattern_regex=`expr "$deplibs_check_method" : "$2 (.*)"`
  1905. if eval $echo "$deplib" 2>/dev/null 
  1906.     | $SED 10q 
  1907.     | $EGREP "$match_pattern_regex" > /dev/null; then
  1908.   valid_a_lib=yes
  1909. fi
  1910. ;;
  1911.       pass_all)
  1912. valid_a_lib=yes
  1913. ;;
  1914.             esac
  1915.     if test "$valid_a_lib" != yes; then
  1916.       $echo
  1917.       $echo "*** Warning: Trying to link with static lib archive $deplib."
  1918.       $echo "*** I have the capability to make that library automatically link in when"
  1919.       $echo "*** you link to this library.  But I can only do this if you have a"
  1920.       $echo "*** shared version of the library, which you do not appear to have"
  1921.       $echo "*** because the file extensions .$libext of this argument makes me believe"
  1922.       $echo "*** that it is just a static archive that I should not used here."
  1923.     else
  1924.       $echo
  1925.       $echo "*** Warning: Linking the shared library $output against the"
  1926.       $echo "*** static library $deplib is not portable!"
  1927.       deplibs="$deplib $deplibs"
  1928.     fi
  1929.     continue
  1930.     ;;
  1931.   prog)
  1932.     if test "$pass" != link; then
  1933.       deplibs="$deplib $deplibs"
  1934.     else
  1935.       compile_deplibs="$deplib $compile_deplibs"
  1936.       finalize_deplibs="$deplib $finalize_deplibs"
  1937.     fi
  1938.     continue
  1939.     ;;
  1940.   esac # linkmode
  1941.   ;; # *.$libext
  1942. *.lo | *.$objext)
  1943.   if test "$pass" = conv; then
  1944.     deplibs="$deplib $deplibs"
  1945.   elif test "$linkmode" = prog; then
  1946.     if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
  1947.       # If there is no dlopen support or we're linking statically,
  1948.       # we need to preload.
  1949.       newdlprefiles="$newdlprefiles $deplib"
  1950.       compile_deplibs="$deplib $compile_deplibs"
  1951.       finalize_deplibs="$deplib $finalize_deplibs"
  1952.     else
  1953.       newdlfiles="$newdlfiles $deplib"
  1954.     fi
  1955.   fi
  1956.   continue
  1957.   ;;
  1958. %DEPLIBS%)
  1959.   alldeplibs=yes
  1960.   continue
  1961.   ;;
  1962. esac # case $deplib
  1963. if test "$found" = yes || test -f "$lib"; then :
  1964. else
  1965.   $echo "$modename: cannot find the library `$lib'" 1>&2
  1966.   exit $EXIT_FAILURE
  1967. fi
  1968. # Check to see that this really is a libtool archive.
  1969. if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1970. else
  1971.   $echo "$modename: `$lib' is not a valid libtool archive" 1>&2
  1972.   exit $EXIT_FAILURE
  1973. fi
  1974. ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1975. test "X$ladir" = "X$lib" && ladir="."
  1976. dlname=
  1977. dlopen=
  1978. dlpreopen=
  1979. libdir=
  1980. library_names=
  1981. old_library=
  1982. # If the library was installed with an old release of libtool,
  1983. # it will not redefine variables installed, or shouldnotlink
  1984. installed=yes
  1985. shouldnotlink=no
  1986. # Read the .la file
  1987. case $lib in
  1988. */* | *\*) . $lib ;;
  1989. *) . ./$lib ;;
  1990. esac
  1991. if test "$linkmode,$pass" = "lib,link" ||
  1992.    test "$linkmode,$pass" = "prog,scan" ||
  1993.    { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  1994.   test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
  1995.   test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
  1996. fi
  1997. if test "$pass" = conv; then
  1998.   # Only check for convenience libraries
  1999.   deplibs="$lib $deplibs"
  2000.   if test -z "$libdir"; then
  2001.     if test -z "$old_library"; then
  2002.       $echo "$modename: cannot find name of link library for `$lib'" 1>&2
  2003.       exit $EXIT_FAILURE
  2004.     fi
  2005.     # It is a libtool convenience library, so add in its objects.
  2006.     convenience="$convenience $ladir/$objdir/$old_library"
  2007.     old_convenience="$old_convenience $ladir/$objdir/$old_library"
  2008.     tmp_libs=
  2009.     for deplib in $dependency_libs; do
  2010.       deplibs="$deplib $deplibs"
  2011.               if test "X$duplicate_deps" = "Xyes" ; then
  2012.         case "$tmp_libs " in
  2013.         *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2014.         esac
  2015.               fi
  2016.       tmp_libs="$tmp_libs $deplib"
  2017.     done
  2018.   elif test "$linkmode" != prog && test "$linkmode" != lib; then
  2019.     $echo "$modename: `$lib' is not a convenience library" 1>&2
  2020.     exit $EXIT_FAILURE
  2021.   fi
  2022.   continue
  2023. fi # $pass = conv
  2024. # Get the name of the library we link against.
  2025. linklib=
  2026. for l in $old_library $library_names; do
  2027.   linklib="$l"
  2028. done
  2029. if test -z "$linklib"; then
  2030.   $echo "$modename: cannot find name of link library for `$lib'" 1>&2
  2031.   exit $EXIT_FAILURE
  2032. fi
  2033. # This library was specified with -dlopen.
  2034. if test "$pass" = dlopen; then
  2035.   if test -z "$libdir"; then
  2036.     $echo "$modename: cannot -dlopen a convenience library: `$lib'" 1>&2
  2037.     exit $EXIT_FAILURE
  2038.   fi
  2039.   if test -z "$dlname" ||
  2040.      test "$dlopen_support" != yes ||
  2041.      test "$build_libtool_libs" = no; then
  2042.     # If there is no dlname, no dlopen support or we're linking
  2043.     # statically, we need to preload.  We also need to preload any
  2044.     # dependent libraries so libltdl's deplib preloader doesn't
  2045.     # bomb out in the load deplibs phase.
  2046.     dlprefiles="$dlprefiles $lib $dependency_libs"
  2047.   else
  2048.     newdlfiles="$newdlfiles $lib"
  2049.   fi
  2050.   continue
  2051. fi # $pass = dlopen
  2052. # We need an absolute path.
  2053. case $ladir in
  2054. [\/]* | [A-Za-z]:[\/]*) abs_ladir="$ladir" ;;
  2055. *)
  2056.   abs_ladir=`cd "$ladir" && pwd`
  2057.   if test -z "$abs_ladir"; then
  2058.     $echo "$modename: warning: cannot determine absolute directory name of `$ladir'" 1>&2
  2059.     $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  2060.     abs_ladir="$ladir"
  2061.   fi
  2062.   ;;
  2063. esac
  2064. laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  2065. # Find the relevant object directory and library name.
  2066. if test "X$installed" = Xyes; then
  2067.   if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  2068.     $echo "$modename: warning: library `$lib' was moved." 1>&2
  2069.     dir="$ladir"
  2070.     absdir="$abs_ladir"
  2071.     libdir="$abs_ladir"
  2072.   else
  2073.     dir="$libdir"
  2074.     absdir="$libdir"
  2075.   fi
  2076. else
  2077.   if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  2078.     dir="$ladir"
  2079.     absdir="$abs_ladir"
  2080.     # Remove this search path later
  2081.     notinst_path="$notinst_path $abs_ladir"
  2082.   else
  2083.     dir="$ladir/$objdir"
  2084.     absdir="$abs_ladir/$objdir"
  2085.     # Remove this search path later
  2086.     notinst_path="$notinst_path $abs_ladir"
  2087.   fi
  2088. fi # $installed = yes
  2089. name=`$echo "X$laname" | $Xsed -e 's/.la$//' -e 's/^lib//'`
  2090. # This library was specified with -dlpreopen.
  2091. if test "$pass" = dlpreopen; then
  2092.   if test -z "$libdir"; then
  2093.     $echo "$modename: cannot -dlpreopen a convenience library: `$lib'" 1>&2
  2094.     exit $EXIT_FAILURE
  2095.   fi
  2096.   # Prefer using a static library (so that no silly _DYNAMIC symbols
  2097.   # are required to link).
  2098.   if test -n "$old_library"; then
  2099.     newdlprefiles="$newdlprefiles $dir/$old_library"
  2100.   # Otherwise, use the dlname, so that lt_dlopen finds it.
  2101.   elif test -n "$dlname"; then
  2102.     newdlprefiles="$newdlprefiles $dir/$dlname"
  2103.   else
  2104.     newdlprefiles="$newdlprefiles $dir/$linklib"
  2105.   fi
  2106. fi # $pass = dlpreopen
  2107. if test -z "$libdir"; then
  2108.   # Link the convenience library
  2109.   if test "$linkmode" = lib; then
  2110.     deplibs="$dir/$old_library $deplibs"
  2111.   elif test "$linkmode,$pass" = "prog,link"; then
  2112.     compile_deplibs="$dir/$old_library $compile_deplibs"
  2113.     finalize_deplibs="$dir/$old_library $finalize_deplibs"
  2114.   else
  2115.     deplibs="$lib $deplibs" # used for prog,scan pass
  2116.   fi
  2117.   continue
  2118. fi
  2119. if test "$linkmode" = prog && test "$pass" != link; then
  2120.   newlib_search_path="$newlib_search_path $ladir"
  2121.   deplibs="$lib $deplibs"
  2122.   linkalldeplibs=no
  2123.   if test "$link_all_deplibs" != no || test -z "$library_names" ||
  2124.      test "$build_libtool_libs" = no; then
  2125.     linkalldeplibs=yes
  2126.   fi
  2127.   tmp_libs=
  2128.   for deplib in $dependency_libs; do
  2129.     case $deplib in
  2130.     -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  2131.     esac
  2132.     # Need to link against all dependency_libs?
  2133.     if test "$linkalldeplibs" = yes; then
  2134.       deplibs="$deplib $deplibs"
  2135.     else
  2136.       # Need to hardcode shared library paths
  2137.       # or/and link against static libraries
  2138.       newdependency_libs="$deplib $newdependency_libs"
  2139.     fi
  2140.     if test "X$duplicate_deps" = "Xyes" ; then
  2141.       case "$tmp_libs " in
  2142.       *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2143.       esac
  2144.     fi
  2145.     tmp_libs="$tmp_libs $deplib"
  2146.   done # for deplib
  2147.   continue
  2148. fi # $linkmode = prog...
  2149. if test "$linkmode,$pass" = "prog,link"; then
  2150.   if test -n "$library_names" &&
  2151.      { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2152.     # We need to hardcode the library path
  2153.     if test -n "$shlibpath_var"; then
  2154.       # Make sure the rpath contains only unique directories.
  2155.       case "$temp_rpath " in
  2156.       *" $dir "*) ;;
  2157.       *" $absdir "*) ;;
  2158.       *) temp_rpath="$temp_rpath $dir" ;;
  2159.       esac
  2160.     fi
  2161.     # Hardcode the library path.
  2162.     # Skip directories that are in the system default run-time
  2163.     # search path.
  2164.     case " $sys_lib_dlsearch_path " in
  2165.     *" $absdir "*) ;;
  2166.     *)
  2167.       case "$compile_rpath " in
  2168.       *" $absdir "*) ;;
  2169.       *) compile_rpath="$compile_rpath $absdir"
  2170.       esac
  2171.       ;;
  2172.     esac
  2173.     case " $sys_lib_dlsearch_path " in
  2174.     *" $libdir "*) ;;
  2175.     *)
  2176.       case "$finalize_rpath " in
  2177.       *" $libdir "*) ;;
  2178.       *) finalize_rpath="$finalize_rpath $libdir"
  2179.       esac
  2180.       ;;
  2181.     esac
  2182.   fi # $linkmode,$pass = prog,link...
  2183.   if test "$alldeplibs" = yes &&
  2184.      { test "$deplibs_check_method" = pass_all ||
  2185.        { test "$build_libtool_libs" = yes &&
  2186.  test -n "$library_names"; }; }; then
  2187.     # We only need to search for static libraries
  2188.     continue
  2189.   fi
  2190. fi
  2191. link_static=no # Whether the deplib will be linked statically
  2192. if test -n "$library_names" &&
  2193.    { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  2194.   if test "$installed" = no; then
  2195.     notinst_deplibs="$notinst_deplibs $lib"
  2196.     need_relink=yes
  2197.   fi
  2198.   # This is a shared library
  2199.   # Warn about portability, can't link against -module's on
  2200.   # some systems (darwin)
  2201.   if test "$shouldnotlink" = yes && test "$pass" = link ; then
  2202.     $echo
  2203.     if test "$linkmode" = prog; then
  2204.       $echo "*** Warning: Linking the executable $output against the loadable module"
  2205.     else
  2206.       $echo "*** Warning: Linking the shared library $output against the loadable module"
  2207.     fi
  2208.     $echo "*** $linklib is not portable!"
  2209.   fi
  2210.   if test "$linkmode" = lib &&
  2211.      test "$hardcode_into_libs" = yes; then
  2212.     # Hardcode the library path.
  2213.     # Skip directories that are in the system default run-time
  2214.     # search path.
  2215.     case " $sys_lib_dlsearch_path " in
  2216.     *" $absdir "*) ;;
  2217.     *)
  2218.       case "$compile_rpath " in
  2219.       *" $absdir "*) ;;
  2220.       *) compile_rpath="$compile_rpath $absdir"
  2221.       esac
  2222.       ;;
  2223.     esac
  2224.     case " $sys_lib_dlsearch_path " in
  2225.     *" $libdir "*) ;;
  2226.     *)
  2227.       case "$finalize_rpath " in
  2228.       *" $libdir "*) ;;
  2229.       *) finalize_rpath="$finalize_rpath $libdir"
  2230.       esac
  2231.       ;;
  2232.     esac
  2233.   fi
  2234.   if test -n "$old_archive_from_expsyms_cmds"; then
  2235.     # figure out the soname
  2236.     set dummy $library_names
  2237.     realname="$2"
  2238.     shift; shift
  2239.     libname=`eval \$echo "$libname_spec"`
  2240.     # use dlname if we got it. it's perfectly good, no?
  2241.     if test -n "$dlname"; then
  2242.       soname="$dlname"
  2243.     elif test -n "$soname_spec"; then
  2244.       # bleh windows
  2245.       case $host in
  2246.       *cygwin* | mingw*)
  2247. major=`expr $current - $age`
  2248. versuffix="-$major"
  2249. ;;
  2250.       esac
  2251.       eval soname="$soname_spec"
  2252.     else
  2253.       soname="$realname"
  2254.     fi
  2255.     # Make a new name for the extract_expsyms_cmds to use
  2256.     soroot="$soname"
  2257.     soname=`$echo $soroot | ${SED} -e 's/^.*///'`
  2258.     newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/.dll$//'`.a"
  2259.     # If the library has no export list, then create one now
  2260.     if test -f "$output_objdir/$soname-def"; then :
  2261.     else
  2262.       $show "extracting exported symbol list from `$soname'"
  2263.       save_ifs="$IFS"; IFS='~'
  2264.       cmds=$extract_expsyms_cmds
  2265.       for cmd in $cmds; do
  2266. IFS="$save_ifs"
  2267. eval cmd="$cmd"
  2268. $show "$cmd"
  2269. $run eval "$cmd" || exit $?
  2270.       done
  2271.       IFS="$save_ifs"
  2272.     fi
  2273.     # Create $newlib
  2274.     if test -f "$output_objdir/$newlib"; then :; else
  2275.       $show "generating import library for `$soname'"
  2276.       save_ifs="$IFS"; IFS='~'
  2277.       cmds=$old_archive_from_expsyms_cmds
  2278.       for cmd in $cmds; do
  2279. IFS="$save_ifs"
  2280. eval cmd="$cmd"
  2281. $show "$cmd"
  2282. $run eval "$cmd" || exit $?
  2283.       done
  2284.       IFS="$save_ifs"
  2285.     fi
  2286.     # make sure the library variables are pointing to the new library
  2287.     dir=$output_objdir
  2288.     linklib=$newlib
  2289.   fi # test -n "$old_archive_from_expsyms_cmds"
  2290.   if test "$linkmode" = prog || test "$mode" != relink; then
  2291.     add_shlibpath=
  2292.     add_dir=
  2293.     add=
  2294.     lib_linked=yes
  2295.     case $hardcode_action in
  2296.     immediate | unsupported)
  2297.       if test "$hardcode_direct" = no; then
  2298. add="$dir/$linklib"
  2299. case $host in
  2300.   *-*-sco3.2v5* ) add_dir="-L$dir" ;;
  2301.   *-*-darwin* )
  2302.     # if the lib is a module then we can not link against
  2303.     # it, someone is ignoring the new warnings I added
  2304.     if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
  2305.       $echo "** Warning, lib $linklib is a module, not a shared library"
  2306.       if test -z "$old_library" ; then
  2307.         $echo
  2308.         $echo "** And there doesn't seem to be a static archive available"
  2309.         $echo "** The link will probably fail, sorry"
  2310.       else
  2311.         add="$dir/$old_library"
  2312.       fi
  2313.     fi
  2314. esac
  2315.       elif test "$hardcode_minus_L" = no; then
  2316. case $host in
  2317. *-*-sunos*) add_shlibpath="$dir" ;;
  2318. esac
  2319. add_dir="-L$dir"
  2320. add="-l$name"
  2321.       elif test "$hardcode_shlibpath_var" = no; then
  2322. add_shlibpath="$dir"
  2323. add="-l$name"
  2324.       else
  2325. lib_linked=no
  2326.       fi
  2327.       ;;
  2328.     relink)
  2329.       if test "$hardcode_direct" = yes; then
  2330. add="$dir/$linklib"
  2331.       elif test "$hardcode_minus_L" = yes; then
  2332. add_dir="-L$dir"
  2333. # Try looking first in the location we're being installed to.
  2334. if test -n "$inst_prefix_dir"; then
  2335.   case "$libdir" in
  2336.     [\/]*)
  2337.       add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2338.       ;;
  2339.   esac
  2340. fi
  2341. add="-l$name"
  2342.       elif test "$hardcode_shlibpath_var" = yes; then
  2343. add_shlibpath="$dir"
  2344. add="-l$name"
  2345.       else
  2346. lib_linked=no
  2347.       fi
  2348.       ;;
  2349.     *) lib_linked=no ;;
  2350.     esac
  2351.     if test "$lib_linked" != yes; then
  2352.       $echo "$modename: configuration error: unsupported hardcode properties"
  2353.       exit $EXIT_FAILURE
  2354.     fi
  2355.     if test -n "$add_shlibpath"; then
  2356.       case :$compile_shlibpath: in
  2357.       *":$add_shlibpath:"*) ;;
  2358.       *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
  2359.       esac
  2360.     fi
  2361.     if test "$linkmode" = prog; then
  2362.       test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
  2363.       test -n "$add" && compile_deplibs="$add $compile_deplibs"
  2364.     else
  2365.       test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2366.       test -n "$add" && deplibs="$add $deplibs"
  2367.       if test "$hardcode_direct" != yes && 
  2368.  test "$hardcode_minus_L" != yes && 
  2369.  test "$hardcode_shlibpath_var" = yes; then
  2370. case :$finalize_shlibpath: in
  2371. *":$libdir:"*) ;;
  2372. *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2373. esac
  2374.       fi
  2375.     fi
  2376.   fi
  2377.   if test "$linkmode" = prog || test "$mode" = relink; then
  2378.     add_shlibpath=
  2379.     add_dir=
  2380.     add=
  2381.     # Finalize command for both is simple: just hardcode it.
  2382.     if test "$hardcode_direct" = yes; then
  2383.       add="$libdir/$linklib"
  2384.     elif test "$hardcode_minus_L" = yes; then
  2385.       add_dir="-L$libdir"
  2386.       add="-l$name"
  2387.     elif test "$hardcode_shlibpath_var" = yes; then
  2388.       case :$finalize_shlibpath: in
  2389.       *":$libdir:"*) ;;
  2390.       *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
  2391.       esac
  2392.       add="-l$name"
  2393.     elif test "$hardcode_automatic" = yes; then
  2394.       if test -n "$inst_prefix_dir" &&
  2395.  test -f "$inst_prefix_dir$libdir/$linklib" ; then
  2396.         add="$inst_prefix_dir$libdir/$linklib"
  2397.       else
  2398.         add="$libdir/$linklib"
  2399.       fi
  2400.     else
  2401.       # We cannot seem to hardcode it, guess we'll fake it.
  2402.       add_dir="-L$libdir"
  2403.       # Try looking first in the location we're being installed to.
  2404.       if test -n "$inst_prefix_dir"; then
  2405. case "$libdir" in
  2406.   [\/]*)
  2407.     add_dir="$add_dir -L$inst_prefix_dir$libdir"
  2408.     ;;
  2409. esac
  2410.       fi
  2411.       add="-l$name"
  2412.     fi
  2413.     if test "$linkmode" = prog; then
  2414.       test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
  2415.       test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
  2416.     else
  2417.       test -n "$add_dir" && deplibs="$add_dir $deplibs"
  2418.       test -n "$add" && deplibs="$add $deplibs"
  2419.     fi
  2420.   fi
  2421. elif test "$linkmode" = prog; then
  2422.   # Here we assume that one of hardcode_direct or hardcode_minus_L
  2423.   # is not unsupported.  This is valid on all known static and
  2424.   # shared platforms.
  2425.   if test "$hardcode_direct" != unsupported; then
  2426.     test -n "$old_library" && linklib="$old_library"
  2427.     compile_deplibs="$dir/$linklib $compile_deplibs"
  2428.     finalize_deplibs="$dir/$linklib $finalize_deplibs"
  2429.   else
  2430.     compile_deplibs="-l$name -L$dir $compile_deplibs"
  2431.     finalize_deplibs="-l$name -L$dir $finalize_deplibs"
  2432.   fi
  2433. elif test "$build_libtool_libs" = yes; then
  2434.   # Not a shared library
  2435.   if test "$deplibs_check_method" != pass_all; then
  2436.     # We're trying link a shared library against a static one
  2437.     # but the system doesn't support it.
  2438.     # Just print a warning and add the library to dependency_libs so
  2439.     # that the program can be linked against the static library.
  2440.     $echo
  2441.     $echo "*** Warning: This system can not link to static lib archive $lib."
  2442.     $echo "*** I have the capability to make that library automatically link in when"
  2443.     $echo "*** you link to this library.  But I can only do this if you have a"
  2444.     $echo "*** shared version of the library, which you do not appear to have."
  2445.     if test "$module" = yes; then
  2446.       $echo "*** But as you try to build a module library, libtool will still create "
  2447.       $echo "*** a static module, that should work as long as the dlopening application"
  2448.       $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  2449.       if test -z "$global_symbol_pipe"; then
  2450. $echo
  2451. $echo "*** However, this would only work if libtool was able to extract symbol"
  2452. $echo "*** lists from a program, using `nm' or equivalent, but libtool could"
  2453. $echo "*** not find such a program.  So, this module is probably useless."
  2454. $echo "*** `nm' from GNU binutils and a full rebuild may help."
  2455.       fi
  2456.       if test "$build_old_libs" = no; then
  2457. build_libtool_libs=module
  2458. build_old_libs=yes
  2459.       else
  2460. build_libtool_libs=no
  2461.       fi
  2462.     fi
  2463.   else
  2464.     convenience="$convenience $dir/$old_library"
  2465.     old_convenience="$old_convenience $dir/$old_library"
  2466.     deplibs="$dir/$old_library $deplibs"
  2467.     link_static=yes
  2468.   fi
  2469. fi # link shared/static library?
  2470. if test "$linkmode" = lib; then
  2471.   if test -n "$dependency_libs" &&
  2472.      { test "$hardcode_into_libs" != yes ||
  2473.        test "$build_old_libs" = yes ||
  2474.        test "$link_static" = yes; }; then
  2475.     # Extract -R from dependency_libs
  2476.     temp_deplibs=
  2477.     for libdir in $dependency_libs; do
  2478.       case $libdir in
  2479.       -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  2480.    case " $xrpath " in
  2481.    *" $temp_xrpath "*) ;;
  2482.    *) xrpath="$xrpath $temp_xrpath";;
  2483.    esac;;
  2484.       *) temp_deplibs="$temp_deplibs $libdir";;
  2485.       esac
  2486.     done
  2487.     dependency_libs="$temp_deplibs"
  2488.   fi
  2489.   newlib_search_path="$newlib_search_path $absdir"
  2490.   # Link against this library
  2491.   test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
  2492.   # ... and its dependency_libs
  2493.   tmp_libs=
  2494.   for deplib in $dependency_libs; do
  2495.     newdependency_libs="$deplib $newdependency_libs"
  2496.     if test "X$duplicate_deps" = "Xyes" ; then
  2497.       case "$tmp_libs " in
  2498.       *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  2499.       esac
  2500.     fi
  2501.     tmp_libs="$tmp_libs $deplib"
  2502.   done
  2503.   if test "$link_all_deplibs" != no; then
  2504.     # Add the search paths of all dependency libraries
  2505.     for deplib in $dependency_libs; do
  2506.       case $deplib in
  2507.       -L*) path="$deplib" ;;
  2508.       *.la)
  2509. dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  2510. test "X$dir" = "X$deplib" && dir="."
  2511. # We need an absolute path.
  2512. case $dir in
  2513. [\/]* | [A-Za-z]:[\/]*) absdir="$dir" ;;
  2514. *)
  2515.   absdir=`cd "$dir" && pwd`
  2516.   if test -z "$absdir"; then
  2517.     $echo "$modename: warning: cannot determine absolute directory name of `$dir'" 1>&2
  2518.     absdir="$dir"
  2519.   fi
  2520.   ;;
  2521. esac
  2522. if grep "^installed=no" $deplib > /dev/null; then
  2523.   path="$absdir/$objdir"
  2524. else
  2525.   eval libdir=`${SED} -n -e 's/^libdir=(.*)$/1/p' $deplib`
  2526.   if test -z "$libdir"; then
  2527.     $echo "$modename: `$deplib' is not a valid libtool archive" 1>&2
  2528.     exit $EXIT_FAILURE
  2529.   fi
  2530.   if test "$absdir" != "$libdir"; then
  2531.     $echo "$modename: warning: `$deplib' seems to be moved" 1>&2
  2532.   fi
  2533.   path="$absdir"
  2534. fi
  2535. depdepl=
  2536. case $host in
  2537. *-*-darwin*)
  2538.   # we do not want to link against static libs,
  2539.   # but need to link against shared
  2540.   eval deplibrary_names=`${SED} -n -e 's/^library_names=(.*)$/1/p' $deplib`
  2541.   if test -n "$deplibrary_names" ; then
  2542.     for tmp in $deplibrary_names ; do
  2543.       depdepl=$tmp
  2544.     done
  2545.     if test -f "$path/$depdepl" ; then
  2546.       depdepl="$path/$depdepl"
  2547.     fi
  2548.     # do not add paths which are already there
  2549.     case " $newlib_search_path " in
  2550.     *" $path "*) ;;
  2551.     *) newlib_search_path="$newlib_search_path $path";;
  2552.     esac
  2553.   fi
  2554.   path=""
  2555.   ;;
  2556. *)
  2557.   path="-L$path"
  2558.   ;;
  2559. esac
  2560. ;;
  2561.       -l*)
  2562. case $host in
  2563. *-*-darwin*)
  2564.   # Again, we only want to link against shared libraries
  2565.   eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^-l,,"`
  2566.   for tmp in $newlib_search_path ; do
  2567.     if test -f "$tmp/lib$tmp_libs.dylib" ; then
  2568.       eval depdepl="$tmp/lib$tmp_libs.dylib"
  2569.       break
  2570.     fi
  2571.   done
  2572.   path=""
  2573.   ;;
  2574. *) continue ;;
  2575. esac
  2576. ;;
  2577.       *) continue ;;
  2578.       esac
  2579.       case " $deplibs " in
  2580.       *" $depdepl "*) ;;
  2581.       *) deplibs="$depdepl $deplibs" ;;
  2582.       esac
  2583.       case " $deplibs " in
  2584.       *" $path "*) ;;
  2585.       *) deplibs="$deplibs $path" ;;
  2586.       esac
  2587.     done
  2588.   fi # link_all_deplibs != no
  2589. fi # linkmode = lib
  2590.       done # for deplib in $libs
  2591.       dependency_libs="$newdependency_libs"
  2592.       if test "$pass" = dlpreopen; then
  2593. # Link the dlpreopened libraries before other libraries
  2594. for deplib in $save_deplibs; do
  2595.   deplibs="$deplib $deplibs"
  2596. done
  2597.       fi
  2598.       if test "$pass" != dlopen; then
  2599. if test "$pass" != conv; then
  2600.   # Make sure lib_search_path contains only unique directories.
  2601.   lib_search_path=
  2602.   for dir in $newlib_search_path; do
  2603.     case "$lib_search_path " in
  2604.     *" $dir "*) ;;
  2605.     *) lib_search_path="$lib_search_path $dir" ;;
  2606.     esac
  2607.   done
  2608.   newlib_search_path=
  2609. fi
  2610. if test "$linkmode,$pass" != "prog,link"; then
  2611.   vars="deplibs"
  2612. else
  2613.   vars="compile_deplibs finalize_deplibs"
  2614. fi
  2615. for var in $vars dependency_libs; do
  2616.   # Add libraries to $var in reverse order
  2617.   eval tmp_libs="$$var"
  2618.   new_libs=
  2619.   for deplib in $tmp_libs; do
  2620.     # FIXME: Pedantically, this is the right thing to do, so
  2621.     #        that some nasty dependency loop isn't accidentally
  2622.     #        broken:
  2623.     #new_libs="$deplib $new_libs"
  2624.     # Pragmatically, this seems to cause very few problems in
  2625.     # practice:
  2626.     case $deplib in
  2627.     -L*) new_libs="$deplib $new_libs" ;;
  2628.     -R*) ;;
  2629.     *)
  2630.       # And here is the reason: when a library appears more
  2631.       # than once as an explicit dependence of a library, or
  2632.       # is implicitly linked in more than once by the
  2633.       # compiler, it is considered special, and multiple
  2634.       # occurrences thereof are not removed.  Compare this
  2635.       # with having the same library being listed as a
  2636.       # dependency of multiple other libraries: in this case,
  2637.       # we know (pedantically, we assume) the library does not
  2638.       # need to be listed more than once, so we keep only the
  2639.       # last copy.  This is not always right, but it is rare
  2640.       # enough that we require users that really mean to play
  2641.       # such unportable linking tricks to link the library
  2642.       # using -Wl,-lname, so that libtool does not consider it
  2643.       # for duplicate removal.
  2644.       case " $specialdeplibs " in
  2645.       *" $deplib "*) new_libs="$deplib $new_libs" ;;
  2646.       *)
  2647. case " $new_libs " in
  2648. *" $deplib "*) ;;
  2649. *) new_libs="$deplib $new_libs" ;;
  2650. esac
  2651. ;;
  2652.       esac
  2653.       ;;
  2654.     esac
  2655.   done
  2656.   tmp_libs=
  2657.   for deplib in $new_libs; do
  2658.     case $deplib in
  2659.     -L*)
  2660.       case " $tmp_libs " in
  2661.       *" $deplib "*) ;;
  2662.       *) tmp_libs="$tmp_libs $deplib" ;;
  2663.       esac
  2664.       ;;
  2665.     *) tmp_libs="$tmp_libs $deplib" ;;
  2666.     esac
  2667.   done
  2668.   eval $var="$tmp_libs"
  2669. done # for var
  2670.       fi
  2671.       # Last step: remove runtime libs from dependency_libs
  2672.       # (they stay in deplibs)
  2673.       tmp_libs=
  2674.       for i in $dependency_libs ; do
  2675. case " $predeps $postdeps $compiler_lib_search_path " in
  2676. *" $i "*)
  2677.   i=""
  2678.   ;;
  2679. esac
  2680. if test -n "$i" ; then
  2681.   tmp_libs="$tmp_libs $i"
  2682. fi
  2683.       done
  2684.       dependency_libs=$tmp_libs
  2685.     done # for pass
  2686.     if test "$linkmode" = prog; then
  2687.       dlfiles="$newdlfiles"
  2688.       dlprefiles="$newdlprefiles"
  2689.     fi
  2690.     case $linkmode in
  2691.     oldlib)
  2692.       if test -n "$deplibs"; then
  2693. $echo "$modename: warning: `-l' and `-L' are ignored for archives" 1>&2
  2694.       fi
  2695.       if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  2696. $echo "$modename: warning: `-dlopen' is ignored for archives" 1>&2
  2697.       fi
  2698.       if test -n "$rpath"; then
  2699. $echo "$modename: warning: `-rpath' is ignored for archives" 1>&2
  2700.       fi
  2701.       if test -n "$xrpath"; then
  2702. $echo "$modename: warning: `-R' is ignored for archives" 1>&2
  2703.       fi
  2704.       if test -n "$vinfo"; then
  2705. $echo "$modename: warning: `-version-info/-version-number' is ignored for archives" 1>&2
  2706.       fi
  2707.       if test -n "$release"; then
  2708. $echo "$modename: warning: `-release' is ignored for archives" 1>&2
  2709.       fi
  2710.       if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  2711. $echo "$modename: warning: `-export-symbols' is ignored for archives" 1>&2
  2712.       fi
  2713.       # Now set the variables for building old libraries.
  2714.       build_libtool_libs=no
  2715.       oldlibs="$output"
  2716.       objs="$objs$old_deplibs"
  2717.       ;;
  2718.     lib)
  2719.       # Make sure we only generate libraries of the form `libNAME.la'.
  2720.       case $outputname in
  2721.       lib*)
  2722. name=`$echo "X$outputname" | $Xsed -e 's/.la$//' -e 's/^lib//'`
  2723. eval shared_ext="$shrext_cmds"
  2724. eval libname="$libname_spec"
  2725. ;;
  2726.       *)
  2727. if test "$module" = no; then
  2728.   $echo "$modename: libtool library `$output' must begin with `lib'" 1>&2
  2729.   $echo "$help" 1>&2
  2730.   exit $EXIT_FAILURE
  2731. fi
  2732. if test "$need_lib_prefix" != no; then
  2733.   # Add the "lib" prefix for modules if required
  2734.   name=`$echo "X$outputname" | $Xsed -e 's/.la$//'`
  2735.   eval shared_ext="$shrext_cmds"
  2736.   eval libname="$libname_spec"
  2737. else
  2738.   libname=`$echo "X$outputname" | $Xsed -e 's/.la$//'`
  2739. fi
  2740. ;;
  2741.       esac
  2742.       if test -n "$objs"; then
  2743. if test "$deplibs_check_method" != pass_all; then
  2744.   $echo "$modename: cannot build libtool library `$output' from non-libtool objects on this host:$objs" 2>&1
  2745.   exit $EXIT_FAILURE
  2746. else
  2747.   $echo
  2748.   $echo "*** Warning: Linking the shared library $output against the non-libtool"
  2749.   $echo "*** objects $objs is not portable!"
  2750.   libobjs="$libobjs $objs"
  2751. fi
  2752.       fi
  2753.       if test "$dlself" != no; then
  2754. $echo "$modename: warning: `-dlopen self' is ignored for libtool libraries" 1>&2
  2755.       fi
  2756.       set dummy $rpath
  2757.       if test "$#" -gt 2; then
  2758. $echo "$modename: warning: ignoring multiple `-rpath's for a libtool library" 1>&2
  2759.       fi
  2760.       install_libdir="$2"
  2761.       oldlibs=
  2762.       if test -z "$rpath"; then
  2763. if test "$build_libtool_libs" = yes; then
  2764.   # Building a libtool convenience library.
  2765.   # Some compilers have problems with a `.al' extension so
  2766.   # convenience libraries should have the same extension an
  2767.   # archive normally would.
  2768.   oldlibs="$output_objdir/$libname.$libext $oldlibs"
  2769.   build_libtool_libs=convenience
  2770.   build_old_libs=yes
  2771. fi
  2772. if test -n "$vinfo"; then
  2773.   $echo "$modename: warning: `-version-info/-version-number' is ignored for convenience libraries" 1>&2
  2774. fi
  2775. if test -n "$release"; then
  2776.   $echo "$modename: warning: `-release' is ignored for convenience libraries" 1>&2
  2777. fi
  2778.       else
  2779. # Parse the version information argument.
  2780. save_ifs="$IFS"; IFS=':'
  2781. set dummy $vinfo 0 0 0
  2782. IFS="$save_ifs"
  2783. if test -n "$8"; then
  2784.   $echo "$modename: too many parameters to `-version-info'" 1>&2
  2785.   $echo "$help" 1>&2
  2786.   exit $EXIT_FAILURE
  2787. fi
  2788. # convert absolute version numbers to libtool ages
  2789. # this retains compatibility with .la files and attempts
  2790. # to make the code below a bit more comprehensible
  2791. case $vinfo_number in
  2792. yes)
  2793.   number_major="$2"
  2794.   number_minor="$3"
  2795.   number_revision="$4"
  2796.   #
  2797.   # There are really only two kinds -- those that
  2798.   # use the current revision as the major version
  2799.   # and those that subtract age and use age as
  2800.   # a minor version.  But, then there is irix
  2801.   # which has an extra 1 added just for fun
  2802.   #
  2803.   case $version_type in
  2804.   darwin|linux|osf|windows)
  2805.     current=`expr $number_major + $number_minor`
  2806.     age="$number_minor"
  2807.     revision="$number_revision"
  2808.     ;;
  2809.   freebsd-aout|freebsd-elf|sunos)
  2810.     current="$number_major"
  2811.     revision="$number_minor"
  2812.     age="0"
  2813.     ;;
  2814.   irix|nonstopux)
  2815.     current=`expr $number_major + $number_minor - 1`
  2816.     age="$number_minor"
  2817.     revision="$number_minor"
  2818.     ;;
  2819.   esac
  2820.   ;;
  2821. no)
  2822.   current="$2"
  2823.   revision="$3"
  2824.   age="$4"
  2825.   ;;
  2826. esac
  2827. # Check that each of the things are valid numbers.
  2828. case $current in
  2829. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2830. *)
  2831.   $echo "$modename: CURRENT `$current' is not a nonnegative integer" 1>&2
  2832.   $echo "$modename: `$vinfo' is not valid version information" 1>&2
  2833.   exit $EXIT_FAILURE
  2834.   ;;
  2835. esac
  2836. case $revision in
  2837. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2838. *)
  2839.   $echo "$modename: REVISION `$revision' is not a nonnegative integer" 1>&2
  2840.   $echo "$modename: `$vinfo' is not valid version information" 1>&2
  2841.   exit $EXIT_FAILURE
  2842.   ;;
  2843. esac
  2844. case $age in
  2845. 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
  2846. *)
  2847.   $echo "$modename: AGE `$age' is not a nonnegative integer" 1>&2
  2848.   $echo "$modename: `$vinfo' is not valid version information" 1>&2
  2849.   exit $EXIT_FAILURE
  2850.   ;;
  2851. esac
  2852. if test "$age" -gt "$current"; then
  2853.   $echo "$modename: AGE `$age' is greater than the current interface number `$current'" 1>&2
  2854.   $echo "$modename: `$vinfo' is not valid version information" 1>&2
  2855.   exit $EXIT_FAILURE
  2856. fi
  2857. # Calculate the version variables.
  2858. major=
  2859. versuffix=
  2860. verstring=
  2861. case $version_type in
  2862. none) ;;
  2863. darwin)
  2864.   # Like Linux, but with the current version available in
  2865.   # verstring for coding it into the library header
  2866.   major=.`expr $current - $age`
  2867.   versuffix="$major.$age.$revision"
  2868.   # Darwin ld doesn't like 0 for these options...
  2869.   minor_current=`expr $current + 1`
  2870.   verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  2871.   ;;
  2872. freebsd-aout)
  2873.   major=".$current"
  2874.   versuffix=".$current.$revision";
  2875.   ;;
  2876. freebsd-elf)
  2877.   major=".$current"
  2878.   versuffix=".$current";
  2879.   ;;
  2880. irix | nonstopux)
  2881.   major=`expr $current - $age + 1`
  2882.   case $version_type in
  2883.     nonstopux) verstring_prefix=nonstopux ;;
  2884.     *)         verstring_prefix=sgi ;;
  2885.   esac
  2886.   verstring="$verstring_prefix$major.$revision"
  2887.   # Add in all the interfaces that we are compatible with.
  2888.   loop=$revision
  2889.   while test "$loop" -ne 0; do
  2890.     iface=`expr $revision - $loop`
  2891.     loop=`expr $loop - 1`
  2892.     verstring="$verstring_prefix$major.$iface:$verstring"
  2893.   done
  2894.   # Before this point, $major must not contain `.'.
  2895.   major=.$major
  2896.   versuffix="$major.$revision"
  2897.   ;;
  2898. linux)
  2899.   major=.`expr $current - $age`
  2900.   versuffix="$major.$age.$revision"
  2901.   ;;
  2902. osf)
  2903.   major=.`expr $current - $age`
  2904.   versuffix=".$current.$age.$revision"
  2905.   verstring="$current.$age.$revision"
  2906.   # Add in all the interfaces that we are compatible with.
  2907.   loop=$age
  2908.   while test "$loop" -ne 0; do
  2909.     iface=`expr $current - $loop`
  2910.     loop=`expr $loop - 1`
  2911.     verstring="$verstring:${iface}.0"
  2912.   done
  2913.   # Make executables depend on our current version.
  2914.   verstring="$verstring:${current}.0"
  2915.   ;;
  2916. sunos)
  2917.   major=".$current"
  2918.   versuffix=".$current.$revision"
  2919.   ;;
  2920. windows)
  2921.   # Use '-' rather than '.', since we only want one
  2922.   # extension on DOS 8.3 filesystems.
  2923.   major=`expr $current - $age`
  2924.   versuffix="-$major"
  2925.   ;;
  2926. *)