source: trunk/third/nautilus-cd-burner/ltmain.sh @ 21565

Revision 21565, 178.9 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21564, which included commits to RCS files with non-trunk default branches.
Line 
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
27basename="s,^.*/,,g"
28
29# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30# is ksh but when the shell is invoked as "sh" and the current value of
31# the _XPG environment variable is not equal to 1 (one), the special
32# positional parameter $0, within a function call, is the name of the
33# function.
34progpath="$0"
35
36# The name of this program:
37progname=`echo "$progpath" | $SED $basename`
38modename="$progname"
39
40# Global variables:
41EXIT_SUCCESS=0
42EXIT_FAILURE=1
43
44PROGRAM=ltmain.sh
45PACKAGE=libtool
46VERSION=1.5.10
47TIMESTAMP=" (1.1220.2.131 2004/09/19 12:46:56)"
48
49# See if we are running on zsh, and set the options which allow our
50# commands through without removal of \ escapes.
51if test -n "${ZSH_VERSION+set}" ; then
52  setopt NO_GLOB_SUBST
53fi
54
55# Check that we have a working $echo.
56if test "X$1" = X--no-reexec; then
57  # Discard the --no-reexec flag, and continue.
58  shift
59elif test "X$1" = X--fallback-echo; then
60  # Avoid inline document here, it may be left over
61  :
62elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
63  # Yippee, $echo works!
64  :
65else
66  # Restart under the correct shell, and then maybe $echo will work.
67  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
68fi
69
70if test "X$1" = X--fallback-echo; then
71  # used as fallback echo
72  shift
73  cat <<EOF
74$*
75EOF
76  exit $EXIT_SUCCESS
77fi
78
79default_mode=
80help="Try \`$progname --help' for more information."
81magic="%%%MAGIC variable%%%"
82mkdir="mkdir"
83mv="mv -f"
84rm="rm -f"
85
86# Sed substitution that helps us do robust quoting.  It backslashifies
87# metacharacters that are still active within double-quoted strings.
88Xsed="${SED}"' -e 1s/^X//'
89sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
90# test EBCDIC or ASCII
91case `echo A|tr A '\301'` in
92 A) # EBCDIC based system
93  SP2NL="tr '\100' '\n'"
94  NL2SP="tr '\r\n' '\100\100'"
95  ;;
96 *) # Assume ASCII based system
97  SP2NL="tr '\040' '\012'"
98  NL2SP="tr '\015\012' '\040\040'"
99  ;;
100esac
101
102# NLS nuisances.
103# Only set LANG and LC_ALL to C if already set.
104# These must not be set unconditionally because not all systems understand
105# e.g. LANG=C (notably SCO).
106# We save the old values to restore during execute mode.
107if test "${LC_ALL+set}" = set; then
108  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
109fi
110if test "${LANG+set}" = set; then
111  save_LANG="$LANG"; LANG=C; export LANG
112fi
113
114# Make sure IFS has a sensible default
115: ${IFS="       
116"}
117
118if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
119  $echo "$modename: not configured to build any kind of library" 1>&2
120  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
121  exit $EXIT_FAILURE
122fi
123
124# Global variables.
125mode=$default_mode
126nonopt=
127prev=
128prevopt=
129run=
130show="$echo"
131show_help=
132execute_dlfiles=
133lo2o="s/\\.lo\$/.${objext}/"
134o2lo="s/\\.${objext}\$/.lo/"
135
136#####################################
137# Shell function definitions:
138# This seems to be the best place for them
139
140# func_win32_libid arg
141# return the library type of file 'arg'
142#
143# Need a lot of goo to handle *both* DLLs and import libs
144# Has to be a shell function in order to 'eat' the argument
145# that is supplied when $file_magic_command is called.
146func_win32_libid () {
147  win32_libid_type="unknown"
148  win32_fileres=`file -L $1 2>/dev/null`
149  case $win32_fileres in
150  *ar\ archive\ import\ library*) # definitely import
151    win32_libid_type="x86 archive import"
152    ;;
153  *ar\ archive*) # could be an import, or static
154    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
155      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
156      win32_nmres=`eval $NM -f posix -A $1 | \
157        sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
158      if test "X$win32_nmres" = "Ximport" ; then
159        win32_libid_type="x86 archive import"
160      else
161        win32_libid_type="x86 archive static"
162      fi
163    fi
164    ;;
165  *DLL*)
166    win32_libid_type="x86 DLL"
167    ;;
168  *executable*) # but shell scripts are "executable" too...
169    case $win32_fileres in
170    *MS\ Windows\ PE\ Intel*)
171      win32_libid_type="x86 DLL"
172      ;;
173    esac
174    ;;
175  esac
176  $echo $win32_libid_type
177}
178
179
180# func_infer_tag arg
181# Infer tagged configuration to use if any are available and
182# if one wasn't chosen via the "--tag" command line option.
183# Only attempt this if the compiler in the base compile
184# command doesn't match the default compiler.
185# arg is usually of the form 'gcc ...'
186func_infer_tag () {
187    if test -n "$available_tags" && test -z "$tagname"; then
188      CC_quoted=
189      for arg in $CC; do
190        case $arg in
191          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
192          arg="\"$arg\""
193          ;;
194        esac
195        CC_quoted="$CC_quoted $arg"
196      done
197      case $@ in
198      # Blanks in the command may have been stripped by the calling shell,
199      # but not from the CC environment variable when configure was run.
200      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
201      # Blanks at the start of $base_compile will cause this to fail
202      # if we don't check for them as well.
203      *)
204        for z in $available_tags; do
205          if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
206            # Evaluate the configuration.
207            eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
208            CC_quoted=
209            for arg in $CC; do
210            # Double-quote args containing other shell metacharacters.
211            case $arg in
212              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
213              arg="\"$arg\""
214              ;;
215            esac
216            CC_quoted="$CC_quoted $arg"
217          done
218            case "$@ " in
219              " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
220              # The compiler in the base compile command matches
221              # the one in the tagged configuration.
222              # Assume this is the tagged configuration we want.
223              tagname=$z
224              break
225              ;;
226            esac
227          fi
228        done
229        # If $tagname still isn't set, then no tagged configuration
230        # was found and let the user know that the "--tag" command
231        # line option must be used.
232        if test -z "$tagname"; then
233          $echo "$modename: unable to infer tagged configuration"
234          $echo "$modename: specify a tag with \`--tag'" 1>&2
235          exit $EXIT_FAILURE
236#        else
237#          $echo "$modename: using $tagname tagged configuration"
238        fi
239        ;;
240      esac
241    fi
242}
243
244
245# func_extract_archives gentop oldlib ...
246func_extract_archives () {
247    my_gentop="$1"; shift
248    my_oldlibs=${1+"$@"}
249    my_oldobjs=""
250    my_xlib=""
251    my_xabs=""
252    my_xdir=""
253    my_status=""
254
255    $show "${rm}r $my_gentop"
256    $run ${rm}r "$my_gentop"
257    $show "$mkdir $my_gentop"
258    $run $mkdir "$my_gentop"
259    my_status=$?
260    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
261      exit $my_status
262    fi
263
264    for my_xlib in $my_oldlibs; do
265      # Extract the objects.
266      case $my_xlib in
267        [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
268        *) my_xabs=`pwd`"/$my_xlib" ;;
269      esac
270      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
271      my_xdir="$my_gentop/$my_xlib"
272
273      $show "${rm}r $my_xdir"
274      $run ${rm}r "$my_xdir"
275      $show "$mkdir $my_xdir"
276      $run $mkdir "$my_xdir"
277      status=$?
278      if test "$status" -ne 0 && test ! -d "$my_xdir"; then
279        exit $status
280      fi
281      case $host in
282      *-darwin*)
283        $show "Extracting $my_xabs"
284        # Do not bother doing anything if just a dry run
285        if test -z "$run"; then
286          darwin_orig_dir=`pwd`
287          cd $my_xdir || exit $?
288          darwin_archive=$my_xabs
289          darwin_curdir=`pwd`
290          darwin_base_archive=`basename $darwin_archive`
291          darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
292          if test -n "$darwin_arches"; then
293            darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
294            darwin_arch=
295            $show "$darwin_base_archive has multiple architectures $darwin_arches"
296            for darwin_arch in  $darwin_arches ; do
297              mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
298              lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
299              # Remove the table of contents from the thin files.
300              $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true
301              $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true
302              cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
303              $AR -xo "${darwin_base_archive}"
304              rm "${darwin_base_archive}"
305              cd "$darwin_curdir"
306            done # $darwin_arches
307      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
308            darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP`
309            darwin_file=
310            darwin_files=
311            for darwin_file in $darwin_filelist; do
312              darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
313              lipo -create -output "$darwin_file" $darwin_files
314            done # $darwin_filelist
315            rm -rf unfat-$$
316            cd "$darwin_orig_dir"
317          else
318            cd $darwin_orig_dir
319            (cd $my_xdir && $AR x $my_xabs) || exit $?
320          fi # $darwin_arches
321        fi # $run
322      ;;
323      *)
324        # We will extract separately just the conflicting names and we will
325        # no longer touch any unique names. It is faster to leave these
326        # extract automatically by $AR in one run.
327        $show "(cd $my_xdir && $AR x $my_xabs)"
328        $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $?
329        if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then
330          :
331        else
332          $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
333          $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
334          $AR t "$my_xabs" | sort | uniq -cd | while read -r count name
335          do
336            i=1
337            while test "$i" -le "$count"
338            do
339              # Put our $i before any first dot (extension)
340              # Never overwrite any file
341              name_to="$name"
342              while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to"
343              do
344                name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
345              done
346              $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')"
347              $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $?
348              i=`expr $i + 1`
349            done
350          done
351        fi
352        ;;
353      esac
354      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
355    done
356
357    func_extract_archives_result="$my_oldobjs"
358}
359# End of Shell function definitions
360#####################################
361
362# Darwin sucks
363eval std_shrext=\"$shrext_cmds\"
364
365# Parse our command line options once, thoroughly.
366while test "$#" -gt 0
367do
368  arg="$1"
369  shift
370
371  case $arg in
372  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
373  *) optarg= ;;
374  esac
375
376  # If the previous option needs an argument, assign it.
377  if test -n "$prev"; then
378    case $prev in
379    execute_dlfiles)
380      execute_dlfiles="$execute_dlfiles $arg"
381      ;;
382    tag)
383      tagname="$arg"
384      preserve_args="${preserve_args}=$arg"
385
386      # Check whether tagname contains only valid characters
387      case $tagname in
388      *[!-_A-Za-z0-9,/]*)
389        $echo "$progname: invalid tag name: $tagname" 1>&2
390        exit $EXIT_FAILURE
391        ;;
392      esac
393
394      case $tagname in
395      CC)
396        # Don't test for the "default" C tag, as we know, it's there, but
397        # not specially marked.
398        ;;
399      *)
400        if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
401          taglist="$taglist $tagname"
402          # Evaluate the configuration.
403          eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
404        else
405          $echo "$progname: ignoring unknown tag $tagname" 1>&2
406        fi
407        ;;
408      esac
409      ;;
410    *)
411      eval "$prev=\$arg"
412      ;;
413    esac
414
415    prev=
416    prevopt=
417    continue
418  fi
419
420  # Have we seen a non-optional argument yet?
421  case $arg in
422  --help)
423    show_help=yes
424    ;;
425
426  --version)
427    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
428    $echo
429    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
430    $echo "This is free software; see the source for copying conditions.  There is NO"
431    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
432    exit $EXIT_SUCCESS
433    ;;
434
435  --config)
436    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
437    # Now print the configurations for the tags.
438    for tagname in $taglist; do
439      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
440    done
441    exit $EXIT_SUCCESS
442    ;;
443
444  --debug)
445    $echo "$progname: enabling shell trace mode"
446    set -x
447    preserve_args="$preserve_args $arg"
448    ;;
449
450  --dry-run | -n)
451    run=:
452    ;;
453
454  --features)
455    $echo "host: $host"
456    if test "$build_libtool_libs" = yes; then
457      $echo "enable shared libraries"
458    else
459      $echo "disable shared libraries"
460    fi
461    if test "$build_old_libs" = yes; then
462      $echo "enable static libraries"
463    else
464      $echo "disable static libraries"
465    fi
466    exit $EXIT_SUCCESS
467    ;;
468
469  --finish) mode="finish" ;;
470
471  --mode) prevopt="--mode" prev=mode ;;
472  --mode=*) mode="$optarg" ;;
473
474  --preserve-dup-deps) duplicate_deps="yes" ;;
475
476  --quiet | --silent)
477    show=:
478    preserve_args="$preserve_args $arg"
479    ;;
480
481  --tag) prevopt="--tag" prev=tag ;;
482  --tag=*)
483    set tag "$optarg" ${1+"$@"}
484    shift
485    prev=tag
486    preserve_args="$preserve_args --tag"
487    ;;
488
489  -dlopen)
490    prevopt="-dlopen"
491    prev=execute_dlfiles
492    ;;
493
494  -*)
495    $echo "$modename: unrecognized option \`$arg'" 1>&2
496    $echo "$help" 1>&2
497    exit $EXIT_FAILURE
498    ;;
499
500  *)
501    nonopt="$arg"
502    break
503    ;;
504  esac
505done
506
507if test -n "$prevopt"; then
508  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
509  $echo "$help" 1>&2
510  exit $EXIT_FAILURE
511fi
512
513# If this variable is set in any of the actions, the command in it
514# will be execed at the end.  This prevents here-documents from being
515# left over by shells.
516exec_cmd=
517
518if test -z "$show_help"; then
519
520  # Infer the operation mode.
521  if test -z "$mode"; then
522    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
523    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
524    case $nonopt in
525    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
526      mode=link
527      for arg
528      do
529        case $arg in
530        -c)
531           mode=compile
532           break
533           ;;
534        esac
535      done
536      ;;
537    *db | *dbx | *strace | *truss)
538      mode=execute
539      ;;
540    *install*|cp|mv)
541      mode=install
542      ;;
543    *rm)
544      mode=uninstall
545      ;;
546    *)
547      # If we have no mode, but dlfiles were specified, then do execute mode.
548      test -n "$execute_dlfiles" && mode=execute
549
550      # Just use the default operation mode.
551      if test -z "$mode"; then
552        if test -n "$nonopt"; then
553          $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
554        else
555          $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
556        fi
557      fi
558      ;;
559    esac
560  fi
561
562  # Only execute mode is allowed to have -dlopen flags.
563  if test -n "$execute_dlfiles" && test "$mode" != execute; then
564    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
565    $echo "$help" 1>&2
566    exit $EXIT_FAILURE
567  fi
568
569  # Change the help message to a mode-specific one.
570  generic_help="$help"
571  help="Try \`$modename --help --mode=$mode' for more information."
572
573  # These modes are in order of execution frequency so that they run quickly.
574  case $mode in
575  # libtool compile mode
576  compile)
577    modename="$modename: compile"
578    # Get the compilation command and the source file.
579    base_compile=
580    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
581    suppress_opt=yes
582    suppress_output=
583    arg_mode=normal
584    libobj=
585    later=
586
587    for arg
588    do
589      case "$arg_mode" in
590      arg  )
591        # do not "continue".  Instead, add this to base_compile
592        lastarg="$arg"
593        arg_mode=normal
594        ;;
595
596      target )
597        libobj="$arg"
598        arg_mode=normal
599        continue
600        ;;
601
602      normal )
603        # Accept any command-line options.
604        case $arg in
605        -o)
606          if test -n "$libobj" ; then
607            $echo "$modename: you cannot specify \`-o' more than once" 1>&2
608            exit $EXIT_FAILURE
609          fi
610          arg_mode=target
611          continue
612          ;;
613
614        -static | -prefer-pic | -prefer-non-pic)
615          later="$later $arg"
616          continue
617          ;;
618
619        -no-suppress)
620          suppress_opt=no
621          continue
622          ;;
623
624        -Xcompiler)
625          arg_mode=arg  #  the next one goes into the "base_compile" arg list
626          continue      #  The current "srcfile" will either be retained or
627          ;;            #  replaced later.  I would guess that would be a bug.
628
629        -Wc,*)
630          args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
631          lastarg=
632          save_ifs="$IFS"; IFS=','
633          for arg in $args; do
634            IFS="$save_ifs"
635
636            # Double-quote args containing other shell metacharacters.
637            # Many Bourne shells cannot handle close brackets correctly
638            # in scan sets, so we specify it separately.
639            case $arg in
640              *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
641              arg="\"$arg\""
642              ;;
643            esac
644            lastarg="$lastarg $arg"
645          done
646          IFS="$save_ifs"
647          lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
648
649          # Add the arguments to base_compile.
650          base_compile="$base_compile $lastarg"
651          continue
652          ;;
653
654        * )
655          # Accept the current argument as the source file.
656          # The previous "srcfile" becomes the current argument.
657          #
658          lastarg="$srcfile"
659          srcfile="$arg"
660          ;;
661        esac  #  case $arg
662        ;;
663      esac    #  case $arg_mode
664
665      # Aesthetically quote the previous argument.
666      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
667
668      case $lastarg in
669      # Double-quote args containing other shell metacharacters.
670      # Many Bourne shells cannot handle close brackets correctly
671      # in scan sets, so we specify it separately.
672      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
673        lastarg="\"$lastarg\""
674        ;;
675      esac
676
677      base_compile="$base_compile $lastarg"
678    done # for arg
679
680    case $arg_mode in
681    arg)
682      $echo "$modename: you must specify an argument for -Xcompile"
683      exit $EXIT_FAILURE
684      ;;
685    target)
686      $echo "$modename: you must specify a target with \`-o'" 1>&2
687      exit $EXIT_FAILURE
688      ;;
689    *)
690      # Get the name of the library object.
691      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
692      ;;
693    esac
694
695    # Recognize several different file suffixes.
696    # If the user specifies -o file.o, it is replaced with file.lo
697    xform='[cCFSifmso]'
698    case $libobj in
699    *.ada) xform=ada ;;
700    *.adb) xform=adb ;;
701    *.ads) xform=ads ;;
702    *.asm) xform=asm ;;
703    *.c++) xform=c++ ;;
704    *.cc) xform=cc ;;
705    *.ii) xform=ii ;;
706    *.class) xform=class ;;
707    *.cpp) xform=cpp ;;
708    *.cxx) xform=cxx ;;
709    *.f90) xform=f90 ;;
710    *.for) xform=for ;;
711    *.java) xform=java ;;
712    esac
713
714    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
715
716    case $libobj in
717    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
718    *)
719      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
720      exit $EXIT_FAILURE
721      ;;
722    esac
723
724    func_infer_tag $base_compile
725
726    for arg in $later; do
727      case $arg in
728      -static)
729        build_old_libs=yes
730        continue
731        ;;
732
733      -prefer-pic)
734        pic_mode=yes
735        continue
736        ;;
737
738      -prefer-non-pic)
739        pic_mode=no
740        continue
741        ;;
742      esac
743    done
744
745    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
746    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
747    if test "X$xdir" = "X$obj"; then
748      xdir=
749    else
750      xdir=$xdir/
751    fi
752    lobj=${xdir}$objdir/$objname
753
754    if test -z "$base_compile"; then
755      $echo "$modename: you must specify a compilation command" 1>&2
756      $echo "$help" 1>&2
757      exit $EXIT_FAILURE
758    fi
759
760    # Delete any leftover library objects.
761    if test "$build_old_libs" = yes; then
762      removelist="$obj $lobj $libobj ${libobj}T"
763    else
764      removelist="$lobj $libobj ${libobj}T"
765    fi
766
767    $run $rm $removelist
768    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
769
770    # On Cygwin there's no "real" PIC flag so we must build both object types
771    case $host_os in
772    cygwin* | mingw* | pw32* | os2*)
773      pic_mode=default
774      ;;
775    esac
776    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
777      # non-PIC code in shared libraries is not supported
778      pic_mode=default
779    fi
780
781    # Calculate the filename of the output object if compiler does
782    # not support -o with -c
783    if test "$compiler_c_o" = no; then
784      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
785      lockfile="$output_obj.lock"
786      removelist="$removelist $output_obj $lockfile"
787      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
788    else
789      output_obj=
790      need_locks=no
791      lockfile=
792    fi
793
794    # Lock this critical section if it is needed
795    # We use this script file to make the link, it avoids creating a new file
796    if test "$need_locks" = yes; then
797      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
798        $show "Waiting for $lockfile to be removed"
799        sleep 2
800      done
801    elif test "$need_locks" = warn; then
802      if test -f "$lockfile"; then
803        $echo "\
804*** ERROR, $lockfile exists and contains:
805`cat $lockfile 2>/dev/null`
806
807This indicates that another process is trying to use the same
808temporary object file, and libtool could not work around it because
809your compiler does not support \`-c' and \`-o' together.  If you
810repeat this compilation, it may succeed, by chance, but you had better
811avoid parallel builds (make -j) in this platform, or get a better
812compiler."
813
814        $run $rm $removelist
815        exit $EXIT_FAILURE
816      fi
817      $echo $srcfile > "$lockfile"
818    fi
819
820    if test -n "$fix_srcfile_path"; then
821      eval srcfile=\"$fix_srcfile_path\"
822    fi
823
824    $run $rm "$libobj" "${libobj}T"
825
826    # Create a libtool object file (analogous to a ".la" file),
827    # but don't create it if we're doing a dry run.
828    test -z "$run" && cat > ${libobj}T <<EOF
829# $libobj - a libtool object file
830# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
831#
832# Please DO NOT delete this file!
833# It is necessary for linking the library.
834
835# Name of the PIC object.
836EOF
837
838    # Only build a PIC object if we are building libtool libraries.
839    if test "$build_libtool_libs" = yes; then
840      # Without this assignment, base_compile gets emptied.
841      fbsd_hideous_sh_bug=$base_compile
842
843      if test "$pic_mode" != no; then
844        command="$base_compile $srcfile $pic_flag"
845      else
846        # Don't build PIC code
847        command="$base_compile $srcfile"
848      fi
849
850      if test ! -d "${xdir}$objdir"; then
851        $show "$mkdir ${xdir}$objdir"
852        $run $mkdir ${xdir}$objdir
853        status=$?
854        if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
855          exit $status
856        fi
857      fi
858
859      if test -z "$output_obj"; then
860        # Place PIC objects in $objdir
861        command="$command -o $lobj"
862      fi
863
864      $run $rm "$lobj" "$output_obj"
865
866      $show "$command"
867      if $run eval "$command"; then :
868      else
869        test -n "$output_obj" && $run $rm $removelist
870        exit $EXIT_FAILURE
871      fi
872
873      if test "$need_locks" = warn &&
874         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
875        $echo "\
876*** ERROR, $lockfile contains:
877`cat $lockfile 2>/dev/null`
878
879but it should contain:
880$srcfile
881
882This indicates that another process is trying to use the same
883temporary object file, and libtool could not work around it because
884your compiler does not support \`-c' and \`-o' together.  If you
885repeat this compilation, it may succeed, by chance, but you had better
886avoid parallel builds (make -j) in this platform, or get a better
887compiler."
888
889        $run $rm $removelist
890        exit $EXIT_FAILURE
891      fi
892
893      # Just move the object if needed, then go on to compile the next one
894      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
895        $show "$mv $output_obj $lobj"
896        if $run $mv $output_obj $lobj; then :
897        else
898          error=$?
899          $run $rm $removelist
900          exit $error
901        fi
902      fi
903
904      # Append the name of the PIC object to the libtool object file.
905      test -z "$run" && cat >> ${libobj}T <<EOF
906pic_object='$objdir/$objname'
907
908EOF
909
910      # Allow error messages only from the first compilation.
911      if test "$suppress_opt" = yes; then
912        suppress_output=' >/dev/null 2>&1'
913      fi
914    else
915      # No PIC object so indicate it doesn't exist in the libtool
916      # object file.
917      test -z "$run" && cat >> ${libobj}T <<EOF
918pic_object=none
919
920EOF
921    fi
922
923    # Only build a position-dependent object if we build old libraries.
924    if test "$build_old_libs" = yes; then
925      if test "$pic_mode" != yes; then
926        # Don't build PIC code
927        command="$base_compile $srcfile"
928      else
929        command="$base_compile $srcfile $pic_flag"
930      fi
931      if test "$compiler_c_o" = yes; then
932        command="$command -o $obj"
933      fi
934
935      # Suppress compiler output if we already did a PIC compilation.
936      command="$command$suppress_output"
937      $run $rm "$obj" "$output_obj"
938      $show "$command"
939      if $run eval "$command"; then :
940      else
941        $run $rm $removelist
942        exit $EXIT_FAILURE
943      fi
944
945      if test "$need_locks" = warn &&
946         test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
947        $echo "\
948*** ERROR, $lockfile contains:
949`cat $lockfile 2>/dev/null`
950
951but it should contain:
952$srcfile
953
954This indicates that another process is trying to use the same
955temporary object file, and libtool could not work around it because
956your compiler does not support \`-c' and \`-o' together.  If you
957repeat this compilation, it may succeed, by chance, but you had better
958avoid parallel builds (make -j) in this platform, or get a better
959compiler."
960
961        $run $rm $removelist
962        exit $EXIT_FAILURE
963      fi
964
965      # Just move the object if needed
966      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
967        $show "$mv $output_obj $obj"
968        if $run $mv $output_obj $obj; then :
969        else
970          error=$?
971          $run $rm $removelist
972          exit $error
973        fi
974      fi
975
976      # Append the name of the non-PIC object the libtool object file.
977      # Only append if the libtool object file exists.
978      test -z "$run" && cat >> ${libobj}T <<EOF
979# Name of the non-PIC object.
980non_pic_object='$objname'
981
982EOF
983    else
984      # Append the name of the non-PIC object the libtool object file.
985      # Only append if the libtool object file exists.
986      test -z "$run" && cat >> ${libobj}T <<EOF
987# Name of the non-PIC object.
988non_pic_object=none
989
990EOF
991    fi
992
993    $run $mv "${libobj}T" "${libobj}"
994
995    # Unlock the critical section if it was locked
996    if test "$need_locks" != no; then
997      $run $rm "$lockfile"
998    fi
999
1000    exit $EXIT_SUCCESS
1001    ;;
1002
1003  # libtool link mode
1004  link | relink)
1005    modename="$modename: link"
1006    case $host in
1007    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1008      # It is impossible to link a dll without this setting, and
1009      # we shouldn't force the makefile maintainer to figure out
1010      # which system we are compiling for in order to pass an extra
1011      # flag for every libtool invocation.
1012      # allow_undefined=no
1013
1014      # FIXME: Unfortunately, there are problems with the above when trying
1015      # to make a dll which has undefined symbols, in which case not
1016      # even a static library is built.  For now, we need to specify
1017      # -no-undefined on the libtool link line when we can be certain
1018      # that all symbols are satisfied, otherwise we get a static library.
1019      allow_undefined=yes
1020      ;;
1021    *)
1022      allow_undefined=yes
1023      ;;
1024    esac
1025    libtool_args="$nonopt"
1026    base_compile="$nonopt $@"
1027    compile_command="$nonopt"
1028    finalize_command="$nonopt"
1029
1030    compile_rpath=
1031    finalize_rpath=
1032    compile_shlibpath=
1033    finalize_shlibpath=
1034    convenience=
1035    old_convenience=
1036    deplibs=
1037    old_deplibs=
1038    compiler_flags=
1039    linker_flags=
1040    dllsearchpath=
1041    lib_search_path=`pwd`
1042    inst_prefix_dir=
1043
1044    avoid_version=no
1045    dlfiles=
1046    dlprefiles=
1047    dlself=no
1048    export_dynamic=no
1049    export_symbols=
1050    export_symbols_regex=
1051    generated=
1052    libobjs=
1053    ltlibs=
1054    module=no
1055    no_install=no
1056    objs=
1057    non_pic_objects=
1058    precious_files_regex=
1059    prefer_static_libs=no
1060    preload=no
1061    prev=
1062    prevarg=
1063    release=
1064    rpath=
1065    xrpath=
1066    perm_rpath=
1067    temp_rpath=
1068    thread_safe=no
1069    vinfo=
1070    vinfo_number=no
1071
1072    func_infer_tag $base_compile
1073
1074    # We need to know -static, to get the right output filenames.
1075    for arg
1076    do
1077      case $arg in
1078      -all-static | -static)
1079        if test "X$arg" = "X-all-static"; then
1080          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1081            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1082          fi
1083          if test -n "$link_static_flag"; then
1084            dlopen_self=$dlopen_self_static
1085          fi
1086        else
1087          if test -z "$pic_flag" && test -n "$link_static_flag"; then
1088            dlopen_self=$dlopen_self_static
1089          fi
1090        fi
1091        build_libtool_libs=no
1092        build_old_libs=yes
1093        prefer_static_libs=yes
1094        break
1095        ;;
1096      esac
1097    done
1098
1099    # See if our shared archives depend on static archives.
1100    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1101
1102    # Go through the arguments, transforming them on the way.
1103    while test "$#" -gt 0; do
1104      arg="$1"
1105      shift
1106      case $arg in
1107      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
1108        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1109        ;;
1110      *) qarg=$arg ;;
1111      esac
1112      libtool_args="$libtool_args $qarg"
1113
1114      # If the previous option needs an argument, assign it.
1115      if test -n "$prev"; then
1116        case $prev in
1117        output)
1118          compile_command="$compile_command @OUTPUT@"
1119          finalize_command="$finalize_command @OUTPUT@"
1120          ;;
1121        esac
1122
1123        case $prev in
1124        dlfiles|dlprefiles)
1125          if test "$preload" = no; then
1126            # Add the symbol object into the linking commands.
1127            compile_command="$compile_command @SYMFILE@"
1128            finalize_command="$finalize_command @SYMFILE@"
1129            preload=yes
1130          fi
1131          case $arg in
1132          *.la | *.lo) ;;  # We handle these cases below.
1133          force)
1134            if test "$dlself" = no; then
1135              dlself=needless
1136              export_dynamic=yes
1137            fi
1138            prev=
1139            continue
1140            ;;
1141          self)
1142            if test "$prev" = dlprefiles; then
1143              dlself=yes
1144            elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1145              dlself=yes
1146            else
1147              dlself=needless
1148              export_dynamic=yes
1149            fi
1150            prev=
1151            continue
1152            ;;
1153          *)
1154            if test "$prev" = dlfiles; then
1155              dlfiles="$dlfiles $arg"
1156            else
1157              dlprefiles="$dlprefiles $arg"
1158            fi
1159            prev=
1160            continue
1161            ;;
1162          esac
1163          ;;
1164        expsyms)
1165          export_symbols="$arg"
1166          if test ! -f "$arg"; then
1167            $echo "$modename: symbol file \`$arg' does not exist"
1168            exit $EXIT_FAILURE
1169          fi
1170          prev=
1171          continue
1172          ;;
1173        expsyms_regex)
1174          export_symbols_regex="$arg"
1175          prev=
1176          continue
1177          ;;
1178        inst_prefix)
1179          inst_prefix_dir="$arg"
1180          prev=
1181          continue
1182          ;;
1183        precious_regex)
1184          precious_files_regex="$arg"
1185          prev=
1186          continue
1187          ;;
1188        release)
1189          release="-$arg"
1190          prev=
1191          continue
1192          ;;
1193        objectlist)
1194          if test -f "$arg"; then
1195            save_arg=$arg
1196            moreargs=
1197            for fil in `cat $save_arg`
1198            do
1199#             moreargs="$moreargs $fil"
1200              arg=$fil
1201              # A libtool-controlled object.
1202
1203              # Check to see that this really is a libtool object.
1204              if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1205                pic_object=
1206                non_pic_object=
1207
1208                # Read the .lo file
1209                # If there is no directory component, then add one.
1210                case $arg in
1211                */* | *\\*) . $arg ;;
1212                *) . ./$arg ;;
1213                esac
1214
1215                if test -z "$pic_object" || \
1216                   test -z "$non_pic_object" ||
1217                   test "$pic_object" = none && \
1218                   test "$non_pic_object" = none; then
1219                  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1220                  exit $EXIT_FAILURE
1221                fi
1222
1223                # Extract subdirectory from the argument.
1224                xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1225                if test "X$xdir" = "X$arg"; then
1226                  xdir=
1227                else
1228                  xdir="$xdir/"
1229                fi
1230
1231                if test "$pic_object" != none; then
1232                  # Prepend the subdirectory the object is found in.
1233                  pic_object="$xdir$pic_object"
1234
1235                  if test "$prev" = dlfiles; then
1236                    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1237                      dlfiles="$dlfiles $pic_object"
1238                      prev=
1239                      continue
1240                    else
1241                      # If libtool objects are unsupported, then we need to preload.
1242                      prev=dlprefiles
1243                    fi
1244                  fi
1245
1246                  # CHECK ME:  I think I busted this.  -Ossama
1247                  if test "$prev" = dlprefiles; then
1248                    # Preload the old-style object.
1249                    dlprefiles="$dlprefiles $pic_object"
1250                    prev=
1251                  fi
1252
1253                  # A PIC object.
1254                  libobjs="$libobjs $pic_object"
1255                  arg="$pic_object"
1256                fi
1257
1258                # Non-PIC object.
1259                if test "$non_pic_object" != none; then
1260                  # Prepend the subdirectory the object is found in.
1261                  non_pic_object="$xdir$non_pic_object"
1262
1263                  # A standard non-PIC object
1264                  non_pic_objects="$non_pic_objects $non_pic_object"
1265                  if test -z "$pic_object" || test "$pic_object" = none ; then
1266                    arg="$non_pic_object"
1267                  fi
1268                fi
1269              else
1270                # Only an error if not doing a dry-run.
1271                if test -z "$run"; then
1272                  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1273                  exit $EXIT_FAILURE
1274                else
1275                  # Dry-run case.
1276
1277                  # Extract subdirectory from the argument.
1278                  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1279                  if test "X$xdir" = "X$arg"; then
1280                    xdir=
1281                  else
1282                    xdir="$xdir/"
1283                  fi
1284
1285                  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1286                  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1287                  libobjs="$libobjs $pic_object"
1288                  non_pic_objects="$non_pic_objects $non_pic_object"
1289                fi
1290              fi
1291            done
1292          else
1293            $echo "$modename: link input file \`$save_arg' does not exist"
1294            exit $EXIT_FAILURE
1295          fi
1296          arg=$save_arg
1297          prev=
1298          continue
1299          ;;
1300        rpath | xrpath)
1301          # We need an absolute path.
1302          case $arg in
1303          [\\/]* | [A-Za-z]:[\\/]*) ;;
1304          *)
1305            $echo "$modename: only absolute run-paths are allowed" 1>&2
1306            exit $EXIT_FAILURE
1307            ;;
1308          esac
1309          if test "$prev" = rpath; then
1310            case "$rpath " in
1311            *" $arg "*) ;;
1312            *) rpath="$rpath $arg" ;;
1313            esac
1314          else
1315            case "$xrpath " in
1316            *" $arg "*) ;;
1317            *) xrpath="$xrpath $arg" ;;
1318            esac
1319          fi
1320          prev=
1321          continue
1322          ;;
1323        xcompiler)
1324          compiler_flags="$compiler_flags $qarg"
1325          prev=
1326          compile_command="$compile_command $qarg"
1327          finalize_command="$finalize_command $qarg"
1328          continue
1329          ;;
1330        xlinker)
1331          linker_flags="$linker_flags $qarg"
1332          compiler_flags="$compiler_flags $wl$qarg"
1333          prev=
1334          compile_command="$compile_command $wl$qarg"
1335          finalize_command="$finalize_command $wl$qarg"
1336          continue
1337          ;;
1338        xcclinker)
1339          linker_flags="$linker_flags $qarg"
1340          compiler_flags="$compiler_flags $qarg"
1341          prev=
1342          compile_command="$compile_command $qarg"
1343          finalize_command="$finalize_command $qarg"
1344          continue
1345          ;;
1346        shrext)
1347          shrext_cmds="$arg"
1348          prev=
1349          continue
1350          ;;
1351        *)
1352          eval "$prev=\"\$arg\""
1353          prev=
1354          continue
1355          ;;
1356        esac
1357      fi # test -n "$prev"
1358
1359      prevarg="$arg"
1360
1361      case $arg in
1362      -all-static)
1363        if test -n "$link_static_flag"; then
1364          compile_command="$compile_command $link_static_flag"
1365          finalize_command="$finalize_command $link_static_flag"
1366        fi
1367        continue
1368        ;;
1369
1370      -allow-undefined)
1371        # FIXME: remove this flag sometime in the future.
1372        $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1373        continue
1374        ;;
1375
1376      -avoid-version)
1377        avoid_version=yes
1378        continue
1379        ;;
1380
1381      -dlopen)
1382        prev=dlfiles
1383        continue
1384        ;;
1385
1386      -dlpreopen)
1387        prev=dlprefiles
1388        continue
1389        ;;
1390
1391      -export-dynamic)
1392        export_dynamic=yes
1393        continue
1394        ;;
1395
1396      -export-symbols | -export-symbols-regex)
1397        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1398          $echo "$modename: more than one -exported-symbols argument is not allowed"
1399          exit $EXIT_FAILURE
1400        fi
1401        if test "X$arg" = "X-export-symbols"; then
1402          prev=expsyms
1403        else
1404          prev=expsyms_regex
1405        fi
1406        continue
1407        ;;
1408
1409      -inst-prefix-dir)
1410        prev=inst_prefix
1411        continue
1412        ;;
1413
1414      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1415      # so, if we see these flags be careful not to treat them like -L
1416      -L[A-Z][A-Z]*:*)
1417        case $with_gcc/$host in
1418        no/*-*-irix* | /*-*-irix*)
1419          compile_command="$compile_command $arg"
1420          finalize_command="$finalize_command $arg"
1421          ;;
1422        esac
1423        continue
1424        ;;
1425
1426      -L*)
1427        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1428        # We need an absolute path.
1429        case $dir in
1430        [\\/]* | [A-Za-z]:[\\/]*) ;;
1431        *)
1432          absdir=`cd "$dir" && pwd`
1433          if test -z "$absdir"; then
1434            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1435            exit $EXIT_FAILURE
1436          fi
1437          dir="$absdir"
1438          ;;
1439        esac
1440        case "$deplibs " in
1441        *" -L$dir "*) ;;
1442        *)
1443          deplibs="$deplibs -L$dir"
1444          lib_search_path="$lib_search_path $dir"
1445          ;;
1446        esac
1447        case $host in
1448        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1449          case :$dllsearchpath: in
1450          *":$dir:"*) ;;
1451          *) dllsearchpath="$dllsearchpath:$dir";;
1452          esac
1453          ;;
1454        esac
1455        continue
1456        ;;
1457
1458      -l*)
1459        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1460          case $host in
1461          *-*-cygwin* | *-*-pw32* | *-*-beos*)
1462            # These systems don't actually have a C or math library (as such)
1463            continue
1464            ;;
1465          *-*-mingw* | *-*-os2*)
1466            # These systems don't actually have a C library (as such)
1467            test "X$arg" = "X-lc" && continue
1468            ;;
1469          *-*-openbsd* | *-*-freebsd*)
1470            # Do not include libc due to us having libc/libc_r.
1471            test "X$arg" = "X-lc" && continue
1472            ;;
1473          *-*-rhapsody* | *-*-darwin1.[012])
1474            # Rhapsody C and math libraries are in the System framework
1475            deplibs="$deplibs -framework System"
1476            continue
1477          esac
1478        elif test "X$arg" = "X-lc_r"; then
1479         case $host in
1480         *-*-openbsd* | *-*-freebsd*)
1481           # Do not include libc_r directly, use -pthread flag.
1482           continue
1483           ;;
1484         esac
1485        fi
1486        deplibs="$deplibs $arg"
1487        continue
1488        ;;
1489
1490     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1491        deplibs="$deplibs $arg"
1492        continue
1493        ;;
1494
1495      -module)
1496        module=yes
1497        continue
1498        ;;
1499
1500      # gcc -m* arguments should be passed to the linker via $compiler_flags
1501      # in order to pass architecture information to the linker
1502      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1503      # but this is not reliable with gcc because gcc may use -mfoo to
1504      # select a different linker, different libraries, etc, while
1505      # -Wl,-mfoo simply passes -mfoo to the linker.
1506      -m*)
1507        # Unknown arguments in both finalize_command and compile_command need
1508        # to be aesthetically quoted because they are evaled later.
1509        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1510        case $arg in
1511        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1512          arg="\"$arg\""
1513          ;;
1514        esac
1515        compile_command="$compile_command $arg"
1516        finalize_command="$finalize_command $arg"
1517        if test "$with_gcc" = "yes" ; then
1518          compiler_flags="$compiler_flags $arg"
1519        fi
1520        continue
1521        ;;
1522
1523      -shrext)
1524        prev=shrext
1525        continue
1526        ;;
1527
1528      -no-fast-install)
1529        fast_install=no
1530        continue
1531        ;;
1532
1533      -no-install)
1534        case $host in
1535        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1536          # The PATH hackery in wrapper scripts is required on Windows
1537          # in order for the loader to find any dlls it needs.
1538          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1539          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1540          fast_install=no
1541          ;;
1542        *) no_install=yes ;;
1543        esac
1544        continue
1545        ;;
1546
1547      -no-undefined)
1548        allow_undefined=no
1549        continue
1550        ;;
1551
1552      -objectlist)
1553        prev=objectlist
1554        continue
1555        ;;
1556
1557      -o) prev=output ;;
1558
1559      -precious-files-regex)
1560        prev=precious_regex
1561        continue
1562        ;;
1563
1564      -release)
1565        prev=release
1566        continue
1567        ;;
1568
1569      -rpath)
1570        prev=rpath
1571        continue
1572        ;;
1573
1574      -R)
1575        prev=xrpath
1576        continue
1577        ;;
1578
1579      -R*)
1580        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1581        # We need an absolute path.
1582        case $dir in
1583        [\\/]* | [A-Za-z]:[\\/]*) ;;
1584        *)
1585          $echo "$modename: only absolute run-paths are allowed" 1>&2
1586          exit $EXIT_FAILURE
1587          ;;
1588        esac
1589        case "$xrpath " in
1590        *" $dir "*) ;;
1591        *) xrpath="$xrpath $dir" ;;
1592        esac
1593        continue
1594        ;;
1595
1596      -static)
1597        # The effects of -static are defined in a previous loop.
1598        # We used to do the same as -all-static on platforms that
1599        # didn't have a PIC flag, but the assumption that the effects
1600        # would be equivalent was wrong.  It would break on at least
1601        # Digital Unix and AIX.
1602        continue
1603        ;;
1604
1605      -thread-safe)
1606        thread_safe=yes
1607        continue
1608        ;;
1609
1610      -version-info)
1611        prev=vinfo
1612        continue
1613        ;;
1614      -version-number)
1615        prev=vinfo
1616        vinfo_number=yes
1617        continue
1618        ;;
1619
1620      -Wc,*)
1621        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1622        arg=
1623        save_ifs="$IFS"; IFS=','
1624        for flag in $args; do
1625          IFS="$save_ifs"
1626          case $flag in
1627            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1628            flag="\"$flag\""
1629            ;;
1630          esac
1631          arg="$arg $wl$flag"
1632          compiler_flags="$compiler_flags $flag"
1633        done
1634        IFS="$save_ifs"
1635        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1636        ;;
1637
1638      -Wl,*)
1639        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1640        arg=
1641        save_ifs="$IFS"; IFS=','
1642        for flag in $args; do
1643          IFS="$save_ifs"
1644          case $flag in
1645            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1646            flag="\"$flag\""
1647            ;;
1648          esac
1649          arg="$arg $wl$flag"
1650          compiler_flags="$compiler_flags $wl$flag"
1651          linker_flags="$linker_flags $flag"
1652        done
1653        IFS="$save_ifs"
1654        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1655        ;;
1656
1657      -Xcompiler)
1658        prev=xcompiler
1659        continue
1660        ;;
1661
1662      -Xlinker)
1663        prev=xlinker
1664        continue
1665        ;;
1666
1667      -XCClinker)
1668        prev=xcclinker
1669        continue
1670        ;;
1671
1672      # Some other compiler flag.
1673      -* | +*)
1674        # Unknown arguments in both finalize_command and compile_command need
1675        # to be aesthetically quoted because they are evaled later.
1676        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1677        case $arg in
1678        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1679          arg="\"$arg\""
1680          ;;
1681        esac
1682        ;;
1683
1684      *.$objext)
1685        # A standard object.
1686        objs="$objs $arg"
1687        ;;
1688
1689      *.lo)
1690        # A libtool-controlled object.
1691
1692        # Check to see that this really is a libtool object.
1693        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1694          pic_object=
1695          non_pic_object=
1696
1697          # Read the .lo file
1698          # If there is no directory component, then add one.
1699          case $arg in
1700          */* | *\\*) . $arg ;;
1701          *) . ./$arg ;;
1702          esac
1703
1704          if test -z "$pic_object" || \
1705             test -z "$non_pic_object" ||
1706             test "$pic_object" = none && \
1707             test "$non_pic_object" = none; then
1708            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1709            exit $EXIT_FAILURE
1710          fi
1711
1712          # Extract subdirectory from the argument.
1713          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1714          if test "X$xdir" = "X$arg"; then
1715            xdir=
1716          else
1717            xdir="$xdir/"
1718          fi
1719
1720          if test "$pic_object" != none; then
1721            # Prepend the subdirectory the object is found in.
1722            pic_object="$xdir$pic_object"
1723
1724            if test "$prev" = dlfiles; then
1725              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1726                dlfiles="$dlfiles $pic_object"
1727                prev=
1728                continue
1729              else
1730                # If libtool objects are unsupported, then we need to preload.
1731                prev=dlprefiles
1732              fi
1733            fi
1734
1735            # CHECK ME:  I think I busted this.  -Ossama
1736            if test "$prev" = dlprefiles; then
1737              # Preload the old-style object.
1738              dlprefiles="$dlprefiles $pic_object"
1739              prev=
1740            fi
1741
1742            # A PIC object.
1743            libobjs="$libobjs $pic_object"
1744            arg="$pic_object"
1745          fi
1746
1747          # Non-PIC object.
1748          if test "$non_pic_object" != none; then
1749            # Prepend the subdirectory the object is found in.
1750            non_pic_object="$xdir$non_pic_object"
1751
1752            # A standard non-PIC object
1753            non_pic_objects="$non_pic_objects $non_pic_object"
1754            if test -z "$pic_object" || test "$pic_object" = none ; then
1755              arg="$non_pic_object"
1756            fi
1757          fi
1758        else
1759          # Only an error if not doing a dry-run.
1760          if test -z "$run"; then
1761            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1762            exit $EXIT_FAILURE
1763          else
1764            # Dry-run case.
1765
1766            # Extract subdirectory from the argument.
1767            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1768            if test "X$xdir" = "X$arg"; then
1769              xdir=
1770            else
1771              xdir="$xdir/"
1772            fi
1773
1774            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1775            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1776            libobjs="$libobjs $pic_object"
1777            non_pic_objects="$non_pic_objects $non_pic_object"
1778          fi
1779        fi
1780        ;;
1781
1782      *.$libext)
1783        # An archive.
1784        deplibs="$deplibs $arg"
1785        old_deplibs="$old_deplibs $arg"
1786        continue
1787        ;;
1788
1789      *.la)
1790        # A libtool-controlled library.
1791
1792        if test "$prev" = dlfiles; then
1793          # This library was specified with -dlopen.
1794          dlfiles="$dlfiles $arg"
1795          prev=
1796        elif test "$prev" = dlprefiles; then
1797          # The library was specified with -dlpreopen.
1798          dlprefiles="$dlprefiles $arg"
1799          prev=
1800        else
1801          deplibs="$deplibs $arg"
1802        fi
1803        continue
1804        ;;
1805
1806      # Some other compiler argument.
1807      *)
1808        # Unknown arguments in both finalize_command and compile_command need
1809        # to be aesthetically quoted because they are evaled later.
1810        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1811        case $arg in
1812        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1813          arg="\"$arg\""
1814          ;;
1815        esac
1816        ;;
1817      esac # arg
1818
1819      # Now actually substitute the argument into the commands.
1820      if test -n "$arg"; then
1821        compile_command="$compile_command $arg"
1822        finalize_command="$finalize_command $arg"
1823      fi
1824    done # argument parsing loop
1825
1826    if test -n "$prev"; then
1827      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1828      $echo "$help" 1>&2
1829      exit $EXIT_FAILURE
1830    fi
1831
1832    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1833      eval arg=\"$export_dynamic_flag_spec\"
1834      compile_command="$compile_command $arg"
1835      finalize_command="$finalize_command $arg"
1836    fi
1837
1838    oldlibs=
1839    # calculate the name of the file, without its directory
1840    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1841    libobjs_save="$libobjs"
1842
1843    if test -n "$shlibpath_var"; then
1844      # get the directories listed in $shlibpath_var
1845      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1846    else
1847      shlib_search_path=
1848    fi
1849    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1850    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1851
1852    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1853    if test "X$output_objdir" = "X$output"; then
1854      output_objdir="$objdir"
1855    else
1856      output_objdir="$output_objdir/$objdir"
1857    fi
1858    # Create the object directory.
1859    if test ! -d "$output_objdir"; then
1860      $show "$mkdir $output_objdir"
1861      $run $mkdir $output_objdir
1862      status=$?
1863      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1864        exit $status
1865      fi
1866    fi
1867
1868    # Determine the type of output
1869    case $output in
1870    "")
1871      $echo "$modename: you must specify an output file" 1>&2
1872      $echo "$help" 1>&2
1873      exit $EXIT_FAILURE
1874      ;;
1875    *.$libext) linkmode=oldlib ;;
1876    *.lo | *.$objext) linkmode=obj ;;
1877    *.la) linkmode=lib ;;
1878    *) linkmode=prog ;; # Anything else should be a program.
1879    esac
1880
1881    case $host in
1882    *cygwin* | *mingw* | *pw32*)
1883      # don't eliminate duplications in $postdeps and $predeps
1884      duplicate_compiler_generated_deps=yes
1885      ;;
1886    *)
1887      duplicate_compiler_generated_deps=$duplicate_deps
1888      ;;
1889    esac
1890    specialdeplibs=
1891
1892    libs=
1893    # Find all interdependent deplibs by searching for libraries
1894    # that are linked more than once (e.g. -la -lb -la)
1895    for deplib in $deplibs; do
1896      if test "X$duplicate_deps" = "Xyes" ; then
1897        case "$libs " in
1898        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1899        esac
1900      fi
1901      libs="$libs $deplib"
1902    done
1903
1904    if test "$linkmode" = lib; then
1905      libs="$predeps $libs $compiler_lib_search_path $postdeps"
1906
1907      # Compute libraries that are listed more than once in $predeps
1908      # $postdeps and mark them as special (i.e., whose duplicates are
1909      # not to be eliminated).
1910      pre_post_deps=
1911      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1912        for pre_post_dep in $predeps $postdeps; do
1913          case "$pre_post_deps " in
1914          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1915          esac
1916          pre_post_deps="$pre_post_deps $pre_post_dep"
1917        done
1918      fi
1919      pre_post_deps=
1920    fi
1921
1922    deplibs=
1923    newdependency_libs=
1924    newlib_search_path=
1925    need_relink=no # whether we're linking any uninstalled libtool libraries
1926    notinst_deplibs= # not-installed libtool libraries
1927    notinst_path= # paths that contain not-installed libtool libraries
1928    case $linkmode in
1929    lib)
1930        passes="conv link"
1931        for file in $dlfiles $dlprefiles; do
1932          case $file in
1933          *.la) ;;
1934          *)
1935            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1936            exit $EXIT_FAILURE
1937            ;;
1938          esac
1939        done
1940        ;;
1941    prog)
1942        compile_deplibs=
1943        finalize_deplibs=
1944        alldeplibs=no
1945        newdlfiles=
1946        newdlprefiles=
1947        passes="conv scan dlopen dlpreopen link"
1948        ;;
1949    *)  passes="conv"
1950        ;;
1951    esac
1952    for pass in $passes; do
1953      if test "$linkmode,$pass" = "lib,link" ||
1954         test "$linkmode,$pass" = "prog,scan"; then
1955        libs="$deplibs"
1956        deplibs=
1957      fi
1958      if test "$linkmode" = prog; then
1959        case $pass in
1960        dlopen) libs="$dlfiles" ;;
1961        dlpreopen) libs="$dlprefiles" ;;
1962        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1963        esac
1964      fi
1965      if test "$pass" = dlopen; then
1966        # Collect dlpreopened libraries
1967        save_deplibs="$deplibs"
1968        deplibs=
1969      fi
1970      for deplib in $libs; do
1971        lib=
1972        found=no
1973        case $deplib in
1974        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1975          if test "$linkmode,$pass" = "prog,link"; then
1976            compile_deplibs="$deplib $compile_deplibs"
1977            finalize_deplibs="$deplib $finalize_deplibs"
1978          else
1979            deplibs="$deplib $deplibs"
1980          fi
1981          continue
1982          ;;
1983        -l*)
1984          if test "$linkmode" != lib && test "$linkmode" != prog; then
1985            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1986            continue
1987          fi
1988          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1989          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1990            for search_ext in .la $std_shrext .so .a; do
1991              # Search the libtool library
1992              lib="$searchdir/lib${name}${search_ext}"
1993              if test -f "$lib"; then
1994                if test "$search_ext" = ".la"; then
1995                  found=yes
1996                else
1997                  found=no
1998                fi
1999                break 2
2000              fi
2001            done
2002          done
2003          if test "$found" != yes; then
2004            # deplib doesn't seem to be a libtool library
2005            if test "$linkmode,$pass" = "prog,link"; then
2006              compile_deplibs="$deplib $compile_deplibs"
2007              finalize_deplibs="$deplib $finalize_deplibs"
2008            else
2009              deplibs="$deplib $deplibs"
2010              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2011            fi
2012            continue
2013          else # deplib is a libtool library
2014            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2015            # We need to do some special things here, and not later.
2016            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2017              case " $predeps $postdeps " in
2018              *" $deplib "*)
2019                if (${SED} -e '2q' $lib |
2020                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2021                  library_names=
2022                  old_library=
2023                  case $lib in
2024                  */* | *\\*) . $lib ;;
2025                  *) . ./$lib ;;
2026                  esac
2027                  for l in $old_library $library_names; do
2028                    ll="$l"
2029                  done
2030                  if test "X$ll" = "X$old_library" ; then # only static version available
2031                    found=no
2032                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2033                    test "X$ladir" = "X$lib" && ladir="."
2034                    lib=$ladir/$old_library
2035                    if test "$linkmode,$pass" = "prog,link"; then
2036                      compile_deplibs="$deplib $compile_deplibs"
2037                      finalize_deplibs="$deplib $finalize_deplibs"
2038                    else
2039                      deplibs="$deplib $deplibs"
2040                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2041                    fi
2042                    continue
2043                  fi
2044                fi
2045                ;;
2046              *) ;;
2047              esac
2048            fi
2049          fi
2050          ;; # -l
2051        -L*)
2052          case $linkmode in
2053          lib)
2054            deplibs="$deplib $deplibs"
2055            test "$pass" = conv && continue
2056            newdependency_libs="$deplib $newdependency_libs"
2057            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2058            ;;
2059          prog)
2060            if test "$pass" = conv; then
2061              deplibs="$deplib $deplibs"
2062              continue
2063            fi
2064            if test "$pass" = scan; then
2065              deplibs="$deplib $deplibs"
2066            else
2067              compile_deplibs="$deplib $compile_deplibs"
2068              finalize_deplibs="$deplib $finalize_deplibs"
2069            fi
2070            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2071            ;;
2072          *)
2073            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2074            ;;
2075          esac # linkmode
2076          continue
2077          ;; # -L
2078        -R*)
2079          if test "$pass" = link; then
2080            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2081            # Make sure the xrpath contains only unique directories.
2082            case "$xrpath " in
2083            *" $dir "*) ;;
2084            *) xrpath="$xrpath $dir" ;;
2085            esac
2086          fi
2087          deplibs="$deplib $deplibs"
2088          continue
2089          ;;
2090        *.la) lib="$deplib" ;;
2091        *.$libext)
2092          if test "$pass" = conv; then
2093            deplibs="$deplib $deplibs"
2094            continue
2095          fi
2096          case $linkmode in
2097          lib)
2098            valid_a_lib=no
2099            case $deplibs_check_method in
2100              match_pattern*)
2101                set dummy $deplibs_check_method
2102                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2103                if eval $echo \"$deplib\" 2>/dev/null \
2104                    | $SED 10q \
2105                    | $EGREP "$match_pattern_regex" > /dev/null; then
2106                  valid_a_lib=yes
2107                fi
2108                ;;
2109              pass_all)
2110                valid_a_lib=yes
2111                ;;
2112            esac
2113            if test "$valid_a_lib" != yes; then
2114              $echo
2115              $echo "*** Warning: Trying to link with static lib archive $deplib."
2116              $echo "*** I have the capability to make that library automatically link in when"
2117              $echo "*** you link to this library.  But I can only do this if you have a"
2118              $echo "*** shared version of the library, which you do not appear to have"
2119              $echo "*** because the file extensions .$libext of this argument makes me believe"
2120              $echo "*** that it is just a static archive that I should not used here."
2121            else
2122              $echo
2123              $echo "*** Warning: Linking the shared library $output against the"
2124              $echo "*** static library $deplib is not portable!"
2125              deplibs="$deplib $deplibs"
2126            fi
2127            continue
2128            ;;
2129          prog)
2130            if test "$pass" != link; then
2131              deplibs="$deplib $deplibs"
2132            else
2133              compile_deplibs="$deplib $compile_deplibs"
2134              finalize_deplibs="$deplib $finalize_deplibs"
2135            fi
2136            continue
2137            ;;
2138          esac # linkmode
2139          ;; # *.$libext
2140        *.lo | *.$objext)
2141          if test "$pass" = conv; then
2142            deplibs="$deplib $deplibs"
2143          elif test "$linkmode" = prog; then
2144            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2145              # If there is no dlopen support or we're linking statically,
2146              # we need to preload.
2147              newdlprefiles="$newdlprefiles $deplib"
2148              compile_deplibs="$deplib $compile_deplibs"
2149              finalize_deplibs="$deplib $finalize_deplibs"
2150            else
2151              newdlfiles="$newdlfiles $deplib"
2152            fi
2153          fi
2154          continue
2155          ;;
2156        %DEPLIBS%)
2157          alldeplibs=yes
2158          continue
2159          ;;
2160        esac # case $deplib
2161        if test "$found" = yes || test -f "$lib"; then :
2162        else
2163          $echo "$modename: cannot find the library \`$lib'" 1>&2
2164          exit $EXIT_FAILURE
2165        fi
2166
2167        # Check to see that this really is a libtool archive.
2168        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2169        else
2170          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2171          exit $EXIT_FAILURE
2172        fi
2173
2174        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2175        test "X$ladir" = "X$lib" && ladir="."
2176
2177        dlname=
2178        dlopen=
2179        dlpreopen=
2180        libdir=
2181        library_names=
2182        old_library=
2183        # If the library was installed with an old release of libtool,
2184        # it will not redefine variables installed, or shouldnotlink
2185        installed=yes
2186        shouldnotlink=no
2187
2188        # Read the .la file
2189        case $lib in
2190        */* | *\\*) . $lib ;;
2191        *) . ./$lib ;;
2192        esac
2193
2194        if test "$linkmode,$pass" = "lib,link" ||
2195           test "$linkmode,$pass" = "prog,scan" ||
2196           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2197          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2198          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2199        fi
2200
2201        if test "$pass" = conv; then
2202          # Only check for convenience libraries
2203          deplibs="$lib $deplibs"
2204          if test -z "$libdir"; then
2205            if test -z "$old_library"; then
2206              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2207              exit $EXIT_FAILURE
2208            fi
2209            # It is a libtool convenience library, so add in its objects.
2210            convenience="$convenience $ladir/$objdir/$old_library"
2211            old_convenience="$old_convenience $ladir/$objdir/$old_library"
2212            tmp_libs=
2213            for deplib in $dependency_libs; do
2214              deplibs="$deplib $deplibs"
2215              if test "X$duplicate_deps" = "Xyes" ; then
2216                case "$tmp_libs " in
2217                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2218                esac
2219              fi
2220              tmp_libs="$tmp_libs $deplib"
2221            done
2222          elif test "$linkmode" != prog && test "$linkmode" != lib; then
2223            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2224            exit $EXIT_FAILURE
2225          fi
2226          continue
2227        fi # $pass = conv
2228
2229
2230        # Get the name of the library we link against.
2231        linklib=
2232        for l in $old_library $library_names; do
2233          linklib="$l"
2234        done
2235        if test -z "$linklib"; then
2236          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2237          exit $EXIT_FAILURE
2238        fi
2239
2240        # This library was specified with -dlopen.
2241        if test "$pass" = dlopen; then
2242          if test -z "$libdir"; then
2243            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2244            exit $EXIT_FAILURE
2245          fi
2246          if test -z "$dlname" ||
2247             test "$dlopen_support" != yes ||
2248             test "$build_libtool_libs" = no; then
2249            # If there is no dlname, no dlopen support or we're linking
2250            # statically, we need to preload.  We also need to preload any
2251            # dependent libraries so libltdl's deplib preloader doesn't
2252            # bomb out in the load deplibs phase.
2253            dlprefiles="$dlprefiles $lib $dependency_libs"
2254          else
2255            newdlfiles="$newdlfiles $lib"
2256          fi
2257          continue
2258        fi # $pass = dlopen
2259
2260        # We need an absolute path.
2261        case $ladir in
2262        [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2263        *)
2264          abs_ladir=`cd "$ladir" && pwd`
2265          if test -z "$abs_ladir"; then
2266            $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2267            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2268            abs_ladir="$ladir"
2269          fi
2270          ;;
2271        esac
2272        laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2273
2274        # Find the relevant object directory and library name.
2275        if test "X$installed" = Xyes; then
2276          if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2277            $echo "$modename: warning: library \`$lib' was moved." 1>&2
2278            dir="$ladir"
2279            absdir="$abs_ladir"
2280            libdir="$abs_ladir"
2281          else
2282            dir="$libdir"
2283            absdir="$libdir"
2284          fi
2285        else
2286          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2287            dir="$ladir"
2288            absdir="$abs_ladir"
2289            # Remove this search path later
2290            notinst_path="$notinst_path $abs_ladir"
2291          else
2292            dir="$ladir/$objdir"
2293            absdir="$abs_ladir/$objdir"
2294            # Remove this search path later
2295            notinst_path="$notinst_path $abs_ladir"
2296          fi
2297        fi # $installed = yes
2298        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2299
2300        # This library was specified with -dlpreopen.
2301        if test "$pass" = dlpreopen; then
2302          if test -z "$libdir"; then
2303            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2304            exit $EXIT_FAILURE
2305          fi
2306          # Prefer using a static library (so that no silly _DYNAMIC symbols
2307          # are required to link).
2308          if test -n "$old_library"; then
2309            newdlprefiles="$newdlprefiles $dir/$old_library"
2310          # Otherwise, use the dlname, so that lt_dlopen finds it.
2311          elif test -n "$dlname"; then
2312            newdlprefiles="$newdlprefiles $dir/$dlname"
2313          else
2314            newdlprefiles="$newdlprefiles $dir/$linklib"
2315          fi
2316        fi # $pass = dlpreopen
2317
2318        if test -z "$libdir"; then
2319          # Link the convenience library
2320          if test "$linkmode" = lib; then
2321            deplibs="$dir/$old_library $deplibs"
2322          elif test "$linkmode,$pass" = "prog,link"; then
2323            compile_deplibs="$dir/$old_library $compile_deplibs"
2324            finalize_deplibs="$dir/$old_library $finalize_deplibs"
2325          else
2326            deplibs="$lib $deplibs" # used for prog,scan pass
2327          fi
2328          continue
2329        fi
2330
2331
2332        if test "$linkmode" = prog && test "$pass" != link; then
2333          newlib_search_path="$newlib_search_path $ladir"
2334          deplibs="$lib $deplibs"
2335
2336          linkalldeplibs=no
2337          if test "$link_all_deplibs" != no || test -z "$library_names" ||
2338             test "$build_libtool_libs" = no; then
2339            linkalldeplibs=yes
2340          fi
2341
2342          tmp_libs=
2343          for deplib in $dependency_libs; do
2344            case $deplib in
2345            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2346            esac
2347            # Need to link against all dependency_libs?
2348            if test "$linkalldeplibs" = yes; then
2349              deplibs="$deplib $deplibs"
2350            else
2351              # Need to hardcode shared library paths
2352              # or/and link against static libraries
2353              newdependency_libs="$deplib $newdependency_libs"
2354            fi
2355            if test "X$duplicate_deps" = "Xyes" ; then
2356              case "$tmp_libs " in
2357              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2358              esac
2359            fi
2360            tmp_libs="$tmp_libs $deplib"
2361          done # for deplib
2362          continue
2363        fi # $linkmode = prog...
2364
2365        if test "$linkmode,$pass" = "prog,link"; then
2366          if test -n "$library_names" &&
2367             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2368            # We need to hardcode the library path
2369            if test -n "$shlibpath_var"; then
2370              # Make sure the rpath contains only unique directories.
2371              case "$temp_rpath " in
2372              *" $dir "*) ;;
2373              *" $absdir "*) ;;
2374              *) temp_rpath="$temp_rpath $dir" ;;
2375              esac
2376            fi
2377
2378            # Hardcode the library path.
2379            # Skip directories that are in the system default run-time
2380            # search path.
2381            case " $sys_lib_dlsearch_path " in
2382            *" $absdir "*) ;;
2383            *)
2384              case "$compile_rpath " in
2385              *" $absdir "*) ;;
2386              *) compile_rpath="$compile_rpath $absdir"
2387              esac
2388              ;;
2389            esac
2390            case " $sys_lib_dlsearch_path " in
2391            *" $libdir "*) ;;
2392            *)
2393              case "$finalize_rpath " in
2394              *" $libdir "*) ;;
2395              *) finalize_rpath="$finalize_rpath $libdir"
2396              esac
2397              ;;
2398            esac
2399          fi # $linkmode,$pass = prog,link...
2400
2401          if test "$alldeplibs" = yes &&
2402             { test "$deplibs_check_method" = pass_all ||
2403               { test "$build_libtool_libs" = yes &&
2404                 test -n "$library_names"; }; }; then
2405            # We only need to search for static libraries
2406            continue
2407          fi
2408        fi
2409
2410        link_static=no # Whether the deplib will be linked statically
2411        if test -n "$library_names" &&
2412           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2413          if test "$installed" = no; then
2414            notinst_deplibs="$notinst_deplibs $lib"
2415            need_relink=yes
2416          fi
2417          # This is a shared library
2418
2419          # Warn about portability, can't link against -module's on
2420          # some systems (darwin)
2421          if test "$shouldnotlink" = yes && test "$pass" = link ; then
2422            $echo
2423            if test "$linkmode" = prog; then
2424              $echo "*** Warning: Linking the executable $output against the loadable module"
2425            else
2426              $echo "*** Warning: Linking the shared library $output against the loadable module"
2427            fi
2428            $echo "*** $linklib is not portable!"
2429          fi
2430          if test "$linkmode" = lib &&
2431             test "$hardcode_into_libs" = yes; then
2432            # Hardcode the library path.
2433            # Skip directories that are in the system default run-time
2434            # search path.
2435            case " $sys_lib_dlsearch_path " in
2436            *" $absdir "*) ;;
2437            *)
2438              case "$compile_rpath " in
2439              *" $absdir "*) ;;
2440              *) compile_rpath="$compile_rpath $absdir"
2441              esac
2442              ;;
2443            esac
2444            case " $sys_lib_dlsearch_path " in
2445            *" $libdir "*) ;;
2446            *)
2447              case "$finalize_rpath " in
2448              *" $libdir "*) ;;
2449              *) finalize_rpath="$finalize_rpath $libdir"
2450              esac
2451              ;;
2452            esac
2453          fi
2454
2455          if test -n "$old_archive_from_expsyms_cmds"; then
2456            # figure out the soname
2457            set dummy $library_names
2458            realname="$2"
2459            shift; shift
2460            libname=`eval \\$echo \"$libname_spec\"`
2461            # use dlname if we got it. it's perfectly good, no?
2462            if test -n "$dlname"; then
2463              soname="$dlname"
2464            elif test -n "$soname_spec"; then
2465              # bleh windows
2466              case $host in
2467              *cygwin* | mingw*)
2468                major=`expr $current - $age`
2469                versuffix="-$major"
2470                ;;
2471              esac
2472              eval soname=\"$soname_spec\"
2473            else
2474              soname="$realname"
2475            fi
2476
2477            # Make a new name for the extract_expsyms_cmds to use
2478            soroot="$soname"
2479            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2480            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2481
2482            # If the library has no export list, then create one now
2483            if test -f "$output_objdir/$soname-def"; then :
2484            else
2485              $show "extracting exported symbol list from \`$soname'"
2486              save_ifs="$IFS"; IFS='~'
2487              cmds=$extract_expsyms_cmds
2488              for cmd in $cmds; do
2489                IFS="$save_ifs"
2490                eval cmd=\"$cmd\"
2491                $show "$cmd"
2492                $run eval "$cmd" || exit $?
2493              done
2494              IFS="$save_ifs"
2495            fi
2496
2497            # Create $newlib
2498            if test -f "$output_objdir/$newlib"; then :; else
2499              $show "generating import library for \`$soname'"
2500              save_ifs="$IFS"; IFS='~'
2501              cmds=$old_archive_from_expsyms_cmds
2502              for cmd in $cmds; do
2503                IFS="$save_ifs"
2504                eval cmd=\"$cmd\"
2505                $show "$cmd"
2506                $run eval "$cmd" || exit $?
2507              done
2508              IFS="$save_ifs"
2509            fi
2510            # make sure the library variables are pointing to the new library
2511            dir=$output_objdir
2512            linklib=$newlib
2513          fi # test -n "$old_archive_from_expsyms_cmds"
2514
2515          if test "$linkmode" = prog || test "$mode" != relink; then
2516            add_shlibpath=
2517            add_dir=
2518            add=
2519            lib_linked=yes
2520            case $hardcode_action in
2521            immediate | unsupported)
2522              if test "$hardcode_direct" = no; then
2523                add="$dir/$linklib"
2524                case $host in
2525                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2526                  *-*-darwin* )
2527                    # if the lib is a module then we can not link against
2528                    # it, someone is ignoring the new warnings I added
2529                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
2530                      $echo "** Warning, lib $linklib is a module, not a shared library"
2531                      if test -z "$old_library" ; then
2532                        $echo
2533                        $echo "** And there doesn't seem to be a static archive available"
2534                        $echo "** The link will probably fail, sorry"
2535                      else
2536                        add="$dir/$old_library"
2537                      fi
2538                    fi
2539                esac
2540              elif test "$hardcode_minus_L" = no; then
2541                case $host in
2542                *-*-sunos*) add_shlibpath="$dir" ;;
2543                esac
2544                add_dir="-L$dir"
2545                add="-l$name"
2546              elif test "$hardcode_shlibpath_var" = no; then
2547                add_shlibpath="$dir"
2548                add="-l$name"
2549              else
2550                lib_linked=no
2551              fi
2552              ;;
2553            relink)
2554              if test "$hardcode_direct" = yes; then
2555                add="$dir/$linklib"
2556              elif test "$hardcode_minus_L" = yes; then
2557                add_dir="-L$dir"
2558                # Try looking first in the location we're being installed to.
2559                if test -n "$inst_prefix_dir"; then
2560                  case "$libdir" in
2561                    [\\/]*)
2562                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2563                      ;;
2564                  esac
2565                fi
2566                add="-l$name"
2567              elif test "$hardcode_shlibpath_var" = yes; then
2568                add_shlibpath="$dir"
2569                add="-l$name"
2570              else
2571                lib_linked=no
2572              fi
2573              ;;
2574            *) lib_linked=no ;;
2575            esac
2576
2577            if test "$lib_linked" != yes; then
2578              $echo "$modename: configuration error: unsupported hardcode properties"
2579              exit $EXIT_FAILURE
2580            fi
2581
2582            if test -n "$add_shlibpath"; then
2583              case :$compile_shlibpath: in
2584              *":$add_shlibpath:"*) ;;
2585              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2586              esac
2587            fi
2588            if test "$linkmode" = prog; then
2589              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2590              test -n "$add" && compile_deplibs="$add $compile_deplibs"
2591            else
2592              test -n "$add_dir" && deplibs="$add_dir $deplibs"
2593              test -n "$add" && deplibs="$add $deplibs"
2594              if test "$hardcode_direct" != yes && \
2595                 test "$hardcode_minus_L" != yes && \
2596                 test "$hardcode_shlibpath_var" = yes; then
2597                case :$finalize_shlibpath: in
2598                *":$libdir:"*) ;;
2599                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2600                esac
2601              fi
2602            fi
2603          fi
2604
2605          if test "$linkmode" = prog || test "$mode" = relink; then
2606            add_shlibpath=
2607            add_dir=
2608            add=
2609            # Finalize command for both is simple: just hardcode it.
2610            if test "$hardcode_direct" = yes; then
2611              add="$libdir/$linklib"
2612            elif test "$hardcode_minus_L" = yes; then
2613              add_dir="-L$libdir"
2614              add="-l$name"
2615            elif test "$hardcode_shlibpath_var" = yes; then
2616              case :$finalize_shlibpath: in
2617              *":$libdir:"*) ;;
2618              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2619              esac
2620              add="-l$name"
2621            elif test "$hardcode_automatic" = yes; then
2622              if test -n "$inst_prefix_dir" &&
2623                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2624                add="$inst_prefix_dir$libdir/$linklib"
2625              else
2626                add="$libdir/$linklib"
2627              fi
2628            else
2629              # We cannot seem to hardcode it, guess we'll fake it.
2630              add_dir="-L$libdir"
2631              # Try looking first in the location we're being installed to.
2632              if test -n "$inst_prefix_dir"; then
2633                case "$libdir" in
2634                  [\\/]*)
2635                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2636                    ;;
2637                esac
2638              fi
2639              add="-l$name"
2640            fi
2641
2642            if test "$linkmode" = prog; then
2643              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2644              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2645            else
2646              test -n "$add_dir" && deplibs="$add_dir $deplibs"
2647              test -n "$add" && deplibs="$add $deplibs"
2648            fi
2649          fi
2650        elif test "$linkmode" = prog; then
2651          # Here we assume that one of hardcode_direct or hardcode_minus_L
2652          # is not unsupported.  This is valid on all known static and
2653          # shared platforms.
2654          if test "$hardcode_direct" != unsupported; then
2655            test -n "$old_library" && linklib="$old_library"
2656            compile_deplibs="$dir/$linklib $compile_deplibs"
2657            finalize_deplibs="$dir/$linklib $finalize_deplibs"
2658          else
2659            compile_deplibs="-l$name -L$dir $compile_deplibs"
2660            finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2661          fi
2662        elif test "$build_libtool_libs" = yes; then
2663          # Not a shared library
2664          if test "$deplibs_check_method" != pass_all; then
2665            # We're trying link a shared library against a static one
2666            # but the system doesn't support it.
2667
2668            # Just print a warning and add the library to dependency_libs so
2669            # that the program can be linked against the static library.
2670            $echo
2671            $echo "*** Warning: This system can not link to static lib archive $lib."
2672            $echo "*** I have the capability to make that library automatically link in when"
2673            $echo "*** you link to this library.  But I can only do this if you have a"
2674            $echo "*** shared version of the library, which you do not appear to have."
2675            if test "$module" = yes; then
2676              $echo "*** But as you try to build a module library, libtool will still create "
2677              $echo "*** a static module, that should work as long as the dlopening application"
2678              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2679              if test -z "$global_symbol_pipe"; then
2680                $echo
2681                $echo "*** However, this would only work if libtool was able to extract symbol"
2682                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2683                $echo "*** not find such a program.  So, this module is probably useless."
2684                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2685              fi
2686              if test "$build_old_libs" = no; then
2687                build_libtool_libs=module
2688                build_old_libs=yes
2689              else
2690                build_libtool_libs=no
2691              fi
2692            fi
2693          else
2694            convenience="$convenience $dir/$old_library"
2695            old_convenience="$old_convenience $dir/$old_library"
2696            deplibs="$dir/$old_library $deplibs"
2697            link_static=yes
2698          fi
2699        fi # link shared/static library?
2700
2701        if test "$linkmode" = lib; then
2702          if test -n "$dependency_libs" &&
2703             { test "$hardcode_into_libs" != yes ||
2704               test "$build_old_libs" = yes ||
2705               test "$link_static" = yes; }; then
2706            # Extract -R from dependency_libs
2707            temp_deplibs=
2708            for libdir in $dependency_libs; do
2709              case $libdir in
2710              -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2711                   case " $xrpath " in
2712                   *" $temp_xrpath "*) ;;
2713                   *) xrpath="$xrpath $temp_xrpath";;
2714                   esac;;
2715              *) temp_deplibs="$temp_deplibs $libdir";;
2716              esac
2717            done
2718            dependency_libs="$temp_deplibs"
2719          fi
2720
2721          newlib_search_path="$newlib_search_path $absdir"
2722          # Link against this library
2723          test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2724          # ... and its dependency_libs
2725          tmp_libs=
2726          for deplib in $dependency_libs; do
2727            newdependency_libs="$deplib $newdependency_libs"
2728            if test "X$duplicate_deps" = "Xyes" ; then
2729              case "$tmp_libs " in
2730              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2731              esac
2732            fi
2733            tmp_libs="$tmp_libs $deplib"
2734          done
2735
2736          if test "$link_all_deplibs" != no; then
2737            # Add the search paths of all dependency libraries
2738            for deplib in $dependency_libs; do
2739              case $deplib in
2740              -L*) path="$deplib" ;;
2741              *.la)
2742                dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2743                test "X$dir" = "X$deplib" && dir="."
2744                # We need an absolute path.
2745                case $dir in
2746                [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2747                *)
2748                  absdir=`cd "$dir" && pwd`
2749                  if test -z "$absdir"; then
2750                    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2751                    absdir="$dir"
2752                  fi
2753                  ;;
2754                esac
2755                if grep "^installed=no" $deplib > /dev/null; then
2756                  path="$absdir/$objdir"
2757                else
2758                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2759                  if test -z "$libdir"; then
2760                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2761                    exit $EXIT_FAILURE
2762                  fi
2763                  if test "$absdir" != "$libdir"; then
2764                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2765                  fi
2766                  path="$absdir"
2767                fi
2768                depdepl=
2769                case $host in
2770                *-*-darwin*)
2771                  # we do not want to link against static libs,
2772                  # but need to link against shared
2773                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2774                  if test -n "$deplibrary_names" ; then
2775                    for tmp in $deplibrary_names ; do
2776                      depdepl=$tmp
2777                    done
2778                    if test -f "$path/$depdepl" ; then
2779                      depdepl="$path/$depdepl"
2780                    fi
2781                    # do not add paths which are already there
2782                    case " $newlib_search_path " in
2783                    *" $path "*) ;;
2784                    *) newlib_search_path="$newlib_search_path $path";;
2785                    esac
2786                  fi
2787                  path=""
2788                  ;;
2789                *)
2790                  path="-L$path"
2791                  ;;
2792                esac
2793                ;;
2794              -l*)
2795                case $host in
2796                *-*-darwin*)
2797                  # Again, we only want to link against shared libraries
2798                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2799                  for tmp in $newlib_search_path ; do
2800                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
2801                      eval depdepl="$tmp/lib$tmp_libs.dylib"
2802                      break
2803                    fi
2804                  done
2805                  path=""
2806                  ;;
2807                *) continue ;;
2808                esac
2809                ;;
2810              *) continue ;;
2811              esac
2812              case " $deplibs " in
2813              *" $depdepl "*) ;;
2814              *) deplibs="$depdepl $deplibs" ;;
2815              esac
2816              case " $deplibs " in
2817              *" $path "*) ;;
2818              *) deplibs="$deplibs $path" ;;
2819              esac
2820            done
2821          fi # link_all_deplibs != no
2822        fi # linkmode = lib
2823      done # for deplib in $libs
2824      dependency_libs="$newdependency_libs"
2825      if test "$pass" = dlpreopen; then
2826        # Link the dlpreopened libraries before other libraries
2827        for deplib in $save_deplibs; do
2828          deplibs="$deplib $deplibs"
2829        done
2830      fi
2831      if test "$pass" != dlopen; then
2832        if test "$pass" != conv; then
2833          # Make sure lib_search_path contains only unique directories.
2834          lib_search_path=
2835          for dir in $newlib_search_path; do
2836            case "$lib_search_path " in
2837            *" $dir "*) ;;
2838            *) lib_search_path="$lib_search_path $dir" ;;
2839            esac
2840          done
2841          newlib_search_path=
2842        fi
2843
2844        if test "$linkmode,$pass" != "prog,link"; then
2845          vars="deplibs"
2846        else
2847          vars="compile_deplibs finalize_deplibs"
2848        fi
2849        for var in $vars dependency_libs; do
2850          # Add libraries to $var in reverse order
2851          eval tmp_libs=\"\$$var\"
2852          new_libs=
2853          for deplib in $tmp_libs; do
2854            # FIXME: Pedantically, this is the right thing to do, so
2855            #        that some nasty dependency loop isn't accidentally
2856            #        broken:
2857            #new_libs="$deplib $new_libs"
2858            # Pragmatically, this seems to cause very few problems in
2859            # practice:
2860            case $deplib in
2861            -L*) new_libs="$deplib $new_libs" ;;
2862            -R*) ;;
2863            *)
2864              # And here is the reason: when a library appears more
2865              # than once as an explicit dependence of a library, or
2866              # is implicitly linked in more than once by the
2867              # compiler, it is considered special, and multiple
2868              # occurrences thereof are not removed.  Compare this
2869              # with having the same library being listed as a
2870              # dependency of multiple other libraries: in this case,
2871              # we know (pedantically, we assume) the library does not
2872              # need to be listed more than once, so we keep only the
2873              # last copy.  This is not always right, but it is rare
2874              # enough that we require users that really mean to play
2875              # such unportable linking tricks to link the library
2876              # using -Wl,-lname, so that libtool does not consider it
2877              # for duplicate removal.
2878              case " $specialdeplibs " in
2879              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2880              *)
2881                case " $new_libs " in
2882                *" $deplib "*) ;;
2883                *) new_libs="$deplib $new_libs" ;;
2884                esac
2885                ;;
2886              esac
2887              ;;
2888            esac
2889          done
2890          tmp_libs=
2891          for deplib in $new_libs; do
2892            case $deplib in
2893            -L*)
2894              case " $tmp_libs " in
2895              *" $deplib "*) ;;
2896              *) tmp_libs="$tmp_libs $deplib" ;;
2897              esac
2898              ;;
2899            *) tmp_libs="$tmp_libs $deplib" ;;
2900            esac
2901          done
2902          eval $var=\"$tmp_libs\"
2903        done # for var
2904      fi
2905      # Last step: remove runtime libs from dependency_libs
2906      # (they stay in deplibs)
2907      tmp_libs=
2908      for i in $dependency_libs ; do
2909        case " $predeps $postdeps $compiler_lib_search_path " in
2910        *" $i "*)
2911          i=""
2912          ;;
2913        esac
2914        if test -n "$i" ; then
2915          tmp_libs="$tmp_libs $i"
2916        fi
2917      done
2918      dependency_libs=$tmp_libs
2919    done # for pass
2920    if test "$linkmode" = prog; then
2921      dlfiles="$newdlfiles"
2922      dlprefiles="$newdlprefiles"
2923    fi
2924
2925    case $linkmode in
2926    oldlib)
2927      if test -n "$deplibs"; then
2928        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2929      fi
2930
2931      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2932        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2933      fi
2934
2935      if test -n "$rpath"; then
2936        $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2937      fi
2938
2939      if test -n "$xrpath"; then
2940        $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2941      fi
2942
2943      if test -n "$vinfo"; then
2944        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2945      fi
2946
2947      if test -n "$release"; then
2948        $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2949      fi
2950
2951      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2952        $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2953      fi
2954
2955      # Now set the variables for building old libraries.
2956      build_libtool_libs=no
2957      oldlibs="$output"
2958      objs="$objs$old_deplibs"
2959      ;;
2960
2961    lib)
2962      # Make sure we only generate libraries of the form `libNAME.la'.
2963      case $outputname in
2964      lib*)
2965        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2966        eval shared_ext=\"$shrext_cmds\"
2967        eval libname=\"$libname_spec\"
2968        ;;
2969      *)
2970        if test "$module" = no; then
2971          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2972          $echo "$help" 1>&2
2973          exit $EXIT_FAILURE
2974        fi
2975        if test "$need_lib_prefix" != no; then
2976          # Add the "lib" prefix for modules if required
2977          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2978          eval shared_ext=\"$shrext_cmds\"
2979          eval libname=\"$libname_spec\"
2980        else
2981          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2982        fi
2983        ;;
2984      esac
2985
2986      if test -n "$objs"; then
2987        if test "$deplibs_check_method" != pass_all; then
2988          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2989          exit $EXIT_FAILURE
2990        else
2991          $echo
2992          $echo "*** Warning: Linking the shared library $output against the non-libtool"
2993          $echo "*** objects $objs is not portable!"
2994          libobjs="$libobjs $objs"
2995        fi
2996      fi
2997
2998      if test "$dlself" != no; then
2999        $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3000      fi
3001
3002      set dummy $rpath
3003      if test "$#" -gt 2; then
3004        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3005      fi
3006      install_libdir="$2"
3007
3008      oldlibs=
3009      if test -z "$rpath"; then
3010        if test "$build_libtool_libs" = yes; then
3011          # Building a libtool convenience library.
3012          # Some compilers have problems with a `.al' extension so
3013          # convenience libraries should have the same extension an
3014          # archive normally would.
3015          oldlibs="$output_objdir/$libname.$libext $oldlibs"
3016          build_libtool_libs=convenience
3017          build_old_libs=yes
3018        fi
3019
3020        if test -n "$vinfo"; then
3021          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3022        fi
3023
3024        if test -n "$release"; then
3025          $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3026        fi
3027      else
3028
3029        # Parse the version information argument.
3030        save_ifs="$IFS"; IFS=':'
3031        set dummy $vinfo 0 0 0
3032        IFS="$save_ifs"
3033
3034        if test -n "$8"; then
3035          $echo "$modename: too many parameters to \`-version-info'" 1>&2
3036          $echo "$help" 1>&2
3037          exit $EXIT_FAILURE
3038        fi
3039
3040        # convert absolute version numbers to libtool ages
3041        # this retains compatibility with .la files and attempts
3042        # to make the code below a bit more comprehensible
3043
3044        case $vinfo_number in
3045        yes)
3046          number_major="$2"
3047          number_minor="$3"
3048          number_revision="$4"
3049          #
3050          # There are really only two kinds -- those that
3051          # use the current revision as the major version
3052          # and those that subtract age and use age as
3053          # a minor version.  But, then there is irix
3054          # which has an extra 1 added just for fun
3055          #
3056          case $version_type in
3057          darwin|linux|osf|windows)
3058            current=`expr $number_major + $number_minor`
3059            age="$number_minor"
3060            revision="$number_revision"
3061            ;;
3062          freebsd-aout|freebsd-elf|sunos)
3063            current="$number_major"
3064            revision="$number_minor"
3065            age="0"
3066            ;;
3067          irix|nonstopux)
3068            current=`expr $number_major + $number_minor - 1`
3069            age="$number_minor"
3070            revision="$number_minor"
3071            ;;
3072          esac
3073          ;;
3074        no)
3075          current="$2"
3076          revision="$3"
3077          age="$4"
3078          ;;
3079        esac
3080
3081        # Check that each of the things are valid numbers.
3082        case $current in
3083        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3084        *)
3085          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3086          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3087          exit $EXIT_FAILURE
3088          ;;
3089        esac
3090
3091        case $revision in
3092        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3093        *)
3094          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3095          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3096          exit $EXIT_FAILURE
3097          ;;
3098        esac
3099
3100        case $age in
3101        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3102        *)
3103          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3104          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3105          exit $EXIT_FAILURE
3106          ;;
3107        esac
3108
3109        if test "$age" -gt "$current"; then
3110          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3111          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3112          exit $EXIT_FAILURE
3113        fi
3114
3115        # Calculate the version variables.
3116        major=
3117        versuffix=
3118        verstring=
3119        case $version_type in
3120        none) ;;
3121
3122        darwin)
3123          # Like Linux, but with the current version available in
3124          # verstring for coding it into the library header
3125          major=.`expr $current - $age`
3126          versuffix="$major.$age.$revision"
3127          # Darwin ld doesn't like 0 for these options...
3128          minor_current=`expr $current + 1`
3129          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3130          ;;
3131
3132        freebsd-aout)
3133          major=".$current"
3134          versuffix=".$current.$revision";
3135          ;;
3136
3137        freebsd-elf)
3138          major=".$current"
3139          versuffix=".$current";
3140          ;;
3141
3142        irix | nonstopux)
3143          major=`expr $current - $age + 1`
3144
3145          case $version_type in
3146            nonstopux) verstring_prefix=nonstopux ;;
3147            *)         verstring_prefix=sgi ;;
3148          esac
3149          verstring="$verstring_prefix$major.$revision"
3150
3151          # Add in all the interfaces that we are compatible with.
3152          loop=$revision
3153          while test "$loop" -ne 0; do
3154            iface=`expr $revision - $loop`
3155            loop=`expr $loop - 1`
3156            verstring="$verstring_prefix$major.$iface:$verstring"
3157          done
3158
3159          # Before this point, $major must not contain `.'.
3160          major=.$major
3161          versuffix="$major.$revision"
3162          ;;
3163
3164        linux)
3165          major=.`expr $current - $age`
3166          versuffix="$major.$age.$revision"
3167          ;;
3168
3169        osf)
3170          major=.`expr $current - $age`
3171          versuffix=".$current.$age.$revision"
3172          verstring="$current.$age.$revision"
3173
3174          # Add in all the interfaces that we are compatible with.
3175          loop=$age
3176          while test "$loop" -ne 0; do
3177            iface=`expr $current - $loop`
3178            loop=`expr $loop - 1`
3179            verstring="$verstring:${iface}.0"
3180          done
3181
3182          # Make executables depend on our current version.
3183          verstring="$verstring:${current}.0"
3184          ;;
3185
3186        sunos)
3187          major=".$current"
3188          versuffix=".$current.$revision"
3189          ;;
3190
3191        windows)
3192          # Use '-' rather than '.', since we only want one
3193          # extension on DOS 8.3 filesystems.
3194          major=`expr $current - $age`
3195          versuffix="-$major"
3196          ;;
3197
3198        *)
3199          $echo "$modename: unknown library version type \`$version_type'" 1>&2
3200          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3201          exit $EXIT_FAILURE
3202          ;;
3203        esac
3204
3205        # Clear the version info if we defaulted, and they specified a release.
3206        if test -z "$vinfo" && test -n "$release"; then
3207          major=
3208          case $version_type in
3209          darwin)
3210            # we can't check for "0.0" in archive_cmds due to quoting
3211            # problems, so we reset it completely
3212            verstring=
3213            ;;
3214          *)
3215            verstring="0.0"
3216            ;;
3217          esac
3218          if test "$need_version" = no; then
3219            versuffix=
3220          else
3221            versuffix=".0.0"
3222          fi
3223        fi
3224
3225        # Remove version info from name if versioning should be avoided
3226        if test "$avoid_version" = yes && test "$need_version" = no; then
3227          major=
3228          versuffix=
3229          verstring=""
3230        fi
3231
3232        # Check to see if the archive will have undefined symbols.
3233        if test "$allow_undefined" = yes; then
3234          if test "$allow_undefined_flag" = unsupported; then
3235            $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3236            build_libtool_libs=no
3237            build_old_libs=yes
3238          fi
3239        else
3240          # Don't allow undefined symbols.
3241          allow_undefined_flag="$no_undefined_flag"
3242        fi
3243      fi
3244
3245      if test "$mode" != relink; then
3246        # Remove our outputs, but don't remove object files since they
3247        # may have been created when compiling PIC objects.
3248        removelist=
3249        tempremovelist=`$echo "$output_objdir/*"`
3250        for p in $tempremovelist; do
3251          case $p in
3252            *.$objext)
3253               ;;
3254            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3255               if test "X$precious_files_regex" != "X"; then
3256                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3257                 then
3258                   continue
3259                 fi
3260               fi
3261               removelist="$removelist $p"
3262               ;;
3263            *) ;;
3264          esac
3265        done
3266        if test -n "$removelist"; then
3267          $show "${rm}r $removelist"
3268          $run ${rm}r $removelist
3269        fi
3270      fi
3271
3272      # Now set the variables for building old libraries.
3273      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3274        oldlibs="$oldlibs $output_objdir/$libname.$libext"
3275
3276        # Transform .lo files to .o files.
3277        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3278      fi
3279
3280      # Eliminate all temporary directories.
3281      for path in $notinst_path; do
3282        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3283        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3284        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3285      done
3286
3287      if test -n "$xrpath"; then
3288        # If the user specified any rpath flags, then add them.
3289        temp_xrpath=
3290        for libdir in $xrpath; do
3291          temp_xrpath="$temp_xrpath -R$libdir"
3292          case "$finalize_rpath " in
3293          *" $libdir "*) ;;
3294          *) finalize_rpath="$finalize_rpath $libdir" ;;
3295          esac
3296        done
3297        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3298          dependency_libs="$temp_xrpath $dependency_libs"
3299        fi
3300      fi
3301
3302      # Make sure dlfiles contains only unique files that won't be dlpreopened
3303      old_dlfiles="$dlfiles"
3304      dlfiles=
3305      for lib in $old_dlfiles; do
3306        case " $dlprefiles $dlfiles " in
3307        *" $lib "*) ;;
3308        *) dlfiles="$dlfiles $lib" ;;
3309        esac
3310      done
3311
3312      # Make sure dlprefiles contains only unique files
3313      old_dlprefiles="$dlprefiles"
3314      dlprefiles=
3315      for lib in $old_dlprefiles; do
3316        case "$dlprefiles " in
3317        *" $lib "*) ;;
3318        *) dlprefiles="$dlprefiles $lib" ;;
3319        esac
3320      done
3321
3322      if test "$build_libtool_libs" = yes; then
3323        if test -n "$rpath"; then
3324          case $host in
3325          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3326            # these systems don't actually have a c library (as such)!
3327            ;;
3328          *-*-rhapsody* | *-*-darwin1.[012])
3329            # Rhapsody C library is in the System framework
3330            deplibs="$deplibs -framework System"
3331            ;;
3332          *-*-netbsd*)
3333            # Don't link with libc until the a.out ld.so is fixed.
3334            ;;
3335          *-*-openbsd* | *-*-freebsd*)
3336            # Do not include libc due to us having libc/libc_r.
3337            test "X$arg" = "X-lc" && continue
3338            ;;
3339          *)
3340            # Add libc to deplibs on all other systems if necessary.
3341            if test "$build_libtool_need_lc" = "yes"; then
3342              deplibs="$deplibs -lc"
3343            fi
3344            ;;
3345          esac
3346        fi
3347
3348        # Transform deplibs into only deplibs that can be linked in shared.
3349        name_save=$name
3350        libname_save=$libname
3351        release_save=$release
3352        versuffix_save=$versuffix
3353        major_save=$major
3354        # I'm not sure if I'm treating the release correctly.  I think
3355        # release should show up in the -l (ie -lgmp5) so we don't want to
3356        # add it in twice.  Is that correct?
3357        release=""
3358        versuffix=""
3359        major=""
3360        newdeplibs=
3361        droppeddeps=no
3362        case $deplibs_check_method in
3363        pass_all)
3364          # Don't check for shared/static.  Everything works.
3365          # This might be a little naive.  We might want to check
3366          # whether the library exists or not.  But this is on
3367          # osf3 & osf4 and I'm not really sure... Just
3368          # implementing what was already the behavior.
3369          newdeplibs=$deplibs
3370          ;;
3371        test_compile)
3372          # This code stresses the "libraries are programs" paradigm to its
3373          # limits. Maybe even breaks it.  We compile a program, linking it
3374          # against the deplibs as a proxy for the library.  Then we can check
3375          # whether they linked in statically or dynamically with ldd.
3376          $rm conftest.c
3377          cat > conftest.c <<EOF
3378          int main() { return 0; }
3379EOF
3380          $rm conftest
3381          $LTCC -o conftest conftest.c $deplibs
3382          if test "$?" -eq 0 ; then
3383            ldd_output=`ldd conftest`
3384            for i in $deplibs; do
3385              name="`expr $i : '-l\(.*\)'`"
3386              # If $name is empty we are operating on a -L argument.
3387              if test "$name" != "" && test "$name" -ne "0"; then
3388                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3389                  case " $predeps $postdeps " in
3390                  *" $i "*)
3391                    newdeplibs="$newdeplibs $i"
3392                    i=""
3393                    ;;
3394                  esac
3395                fi
3396                if test -n "$i" ; then
3397                  libname=`eval \\$echo \"$libname_spec\"`
3398                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
3399                  set dummy $deplib_matches
3400                  deplib_match=$2
3401                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3402                    newdeplibs="$newdeplibs $i"
3403                  else
3404                    droppeddeps=yes
3405                    $echo
3406                    $echo "*** Warning: dynamic linker does not accept needed library $i."
3407                    $echo "*** I have the capability to make that library automatically link in when"
3408                    $echo "*** you link to this library.  But I can only do this if you have a"
3409                    $echo "*** shared version of the library, which I believe you do not have"
3410                    $echo "*** because a test_compile did reveal that the linker did not use it for"
3411                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3412                  fi
3413                fi
3414              else
3415                newdeplibs="$newdeplibs $i"
3416              fi
3417            done
3418          else
3419            # Error occurred in the first compile.  Let's try to salvage
3420            # the situation: Compile a separate program for each library.
3421            for i in $deplibs; do
3422              name="`expr $i : '-l\(.*\)'`"
3423              # If $name is empty we are operating on a -L argument.
3424              if test "$name" != "" && test "$name" != "0"; then
3425                $rm conftest
3426                $LTCC -o conftest conftest.c $i
3427                # Did it work?
3428                if test "$?" -eq 0 ; then
3429                  ldd_output=`ldd conftest`
3430                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3431                    case " $predeps $postdeps " in
3432                    *" $i "*)
3433                      newdeplibs="$newdeplibs $i"
3434                      i=""
3435                      ;;
3436                    esac
3437                  fi
3438                  if test -n "$i" ; then
3439                    libname=`eval \\$echo \"$libname_spec\"`
3440                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3441                    set dummy $deplib_matches
3442                    deplib_match=$2
3443                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3444                      newdeplibs="$newdeplibs $i"
3445                    else
3446                      droppeddeps=yes
3447                      $echo
3448                      $echo "*** Warning: dynamic linker does not accept needed library $i."
3449                      $echo "*** I have the capability to make that library automatically link in when"
3450                      $echo "*** you link to this library.  But I can only do this if you have a"
3451                      $echo "*** shared version of the library, which you do not appear to have"
3452                      $echo "*** because a test_compile did reveal that the linker did not use this one"
3453                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3454                    fi
3455                  fi
3456                else
3457                  droppeddeps=yes
3458                  $echo
3459                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3460                  $echo "***  make it link in!  You will probably need to install it or some"
3461                  $echo "*** library that it depends on before this library will be fully"
3462                  $echo "*** functional.  Installing it before continuing would be even better."
3463                fi
3464              else
3465                newdeplibs="$newdeplibs $i"
3466              fi
3467            done
3468          fi
3469          ;;
3470        file_magic*)
3471          set dummy $deplibs_check_method
3472          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3473          for a_deplib in $deplibs; do
3474            name="`expr $a_deplib : '-l\(.*\)'`"
3475            # If $name is empty we are operating on a -L argument.
3476            if test "$name" != "" && test  "$name" != "0"; then
3477              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3478                case " $predeps $postdeps " in
3479                *" $a_deplib "*)
3480                  newdeplibs="$newdeplibs $a_deplib"
3481                  a_deplib=""
3482                  ;;
3483                esac
3484              fi
3485              if test -n "$a_deplib" ; then
3486                libname=`eval \\$echo \"$libname_spec\"`
3487                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3488                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3489                  for potent_lib in $potential_libs; do
3490                      # Follow soft links.
3491                      if ls -lLd "$potent_lib" 2>/dev/null \
3492                         | grep " -> " >/dev/null; then
3493                        continue
3494                      fi
3495                      # The statement above tries to avoid entering an
3496                      # endless loop below, in case of cyclic links.
3497                      # We might still enter an endless loop, since a link
3498                      # loop can be closed while we follow links,
3499                      # but so what?
3500                      potlib="$potent_lib"
3501                      while test -h "$potlib" 2>/dev/null; do
3502                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3503                        case $potliblink in
3504                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3505                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3506                        esac
3507                      done
3508                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3509                         | ${SED} 10q \
3510                         | $EGREP "$file_magic_regex" > /dev/null; then
3511                        newdeplibs="$newdeplibs $a_deplib"
3512                        a_deplib=""
3513                        break 2
3514                      fi
3515                  done
3516                done
3517              fi
3518              if test -n "$a_deplib" ; then
3519                droppeddeps=yes
3520                $echo
3521                $echo "*** Warning: linker path does not have real file for library $a_deplib."
3522                $echo "*** I have the capability to make that library automatically link in when"
3523                $echo "*** you link to this library.  But I can only do this if you have a"
3524                $echo "*** shared version of the library, which you do not appear to have"
3525                $echo "*** because I did check the linker path looking for a file starting"
3526                if test -z "$potlib" ; then
3527                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
3528                else
3529                  $echo "*** with $libname and none of the candidates passed a file format test"
3530                  $echo "*** using a file magic. Last file checked: $potlib"
3531                fi
3532              fi
3533            else
3534              # Add a -L argument.
3535              newdeplibs="$newdeplibs $a_deplib"
3536            fi
3537          done # Gone through all deplibs.
3538          ;;
3539        match_pattern*)
3540          set dummy $deplibs_check_method
3541          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3542          for a_deplib in $deplibs; do
3543            name="`expr $a_deplib : '-l\(.*\)'`"
3544            # If $name is empty we are operating on a -L argument.
3545            if test -n "$name" && test "$name" != "0"; then
3546              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3547                case " $predeps $postdeps " in
3548                *" $a_deplib "*)
3549                  newdeplibs="$newdeplibs $a_deplib"
3550                  a_deplib=""
3551                  ;;
3552                esac
3553              fi
3554              if test -n "$a_deplib" ; then
3555                libname=`eval \\$echo \"$libname_spec\"`
3556                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3557                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3558                  for potent_lib in $potential_libs; do
3559                    potlib="$potent_lib" # see symlink-check above in file_magic test
3560                    if eval $echo \"$potent_lib\" 2>/dev/null \
3561                        | ${SED} 10q \
3562                        | $EGREP "$match_pattern_regex" > /dev/null; then
3563                      newdeplibs="$newdeplibs $a_deplib"
3564                      a_deplib=""
3565                      break 2
3566                    fi
3567                  done
3568                done
3569              fi
3570              if test -n "$a_deplib" ; then
3571                droppeddeps=yes
3572                $echo
3573                $echo "*** Warning: linker path does not have real file for library $a_deplib."
3574                $echo "*** I have the capability to make that library automatically link in when"
3575                $echo "*** you link to this library.  But I can only do this if you have a"
3576                $echo "*** shared version of the library, which you do not appear to have"
3577                $echo "*** because I did check the linker path looking for a file starting"
3578                if test -z "$potlib" ; then
3579                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3580                else
3581                  $echo "*** with $libname and none of the candidates passed a file format test"
3582                  $echo "*** using a regex pattern. Last file checked: $potlib"
3583                fi
3584              fi
3585            else
3586              # Add a -L argument.
3587              newdeplibs="$newdeplibs $a_deplib"
3588            fi
3589          done # Gone through all deplibs.
3590          ;;
3591        none | unknown | *)
3592          newdeplibs=""
3593          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3594            -e 's/ -[LR][^ ]*//g'`
3595          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3596            for i in $predeps $postdeps ; do
3597              # can't use Xsed below, because $i might contain '/'
3598              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3599            done
3600          fi
3601          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
3602            | grep . >/dev/null; then
3603            $echo
3604            if test "X$deplibs_check_method" = "Xnone"; then
3605              $echo "*** Warning: inter-library dependencies are not supported in this platform."
3606            else
3607              $echo "*** Warning: inter-library dependencies are not known to be supported."
3608            fi
3609            $echo "*** All declared inter-library dependencies are being dropped."
3610            droppeddeps=yes
3611          fi
3612          ;;
3613        esac
3614        versuffix=$versuffix_save
3615        major=$major_save
3616        release=$release_save
3617        libname=$libname_save
3618        name=$name_save
3619
3620        case $host in
3621        *-*-rhapsody* | *-*-darwin1.[012])
3622          # On Rhapsody replace the C library is the System framework
3623          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3624          ;;
3625        esac
3626
3627        if test "$droppeddeps" = yes; then
3628          if test "$module" = yes; then
3629            $echo
3630            $echo "*** Warning: libtool could not satisfy all declared inter-library"
3631            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3632            $echo "*** a static module, that should work as long as the dlopening"
3633            $echo "*** application is linked with the -dlopen flag."
3634            if test -z "$global_symbol_pipe"; then
3635              $echo
3636              $echo "*** However, this would only work if libtool was able to extract symbol"
3637              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3638              $echo "*** not find such a program.  So, this module is probably useless."
3639              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3640            fi
3641            if test "$build_old_libs" = no; then
3642              oldlibs="$output_objdir/$libname.$libext"
3643              build_libtool_libs=module
3644              build_old_libs=yes
3645            else
3646              build_libtool_libs=no
3647            fi
3648          else
3649            $echo "*** The inter-library dependencies that have been dropped here will be"
3650            $echo "*** automatically added whenever a program is linked with this library"
3651            $echo "*** or is declared to -dlopen it."
3652
3653            if test "$allow_undefined" = no; then
3654              $echo
3655              $echo "*** Since this library must not contain undefined symbols,"
3656              $echo "*** because either the platform does not support them or"
3657              $echo "*** it was explicitly requested with -no-undefined,"
3658              $echo "*** libtool will only create a static version of it."
3659              if test "$build_old_libs" = no; then
3660                oldlibs="$output_objdir/$libname.$libext"
3661                build_libtool_libs=module
3662                build_old_libs=yes
3663              else
3664                build_libtool_libs=no
3665              fi
3666            fi
3667          fi
3668        fi
3669        # Done checking deplibs!
3670        deplibs=$newdeplibs
3671      fi
3672
3673      # All the library-specific variables (install_libdir is set above).
3674      library_names=
3675      old_library=
3676      dlname=
3677
3678      # Test again, we may have decided not to build it any more
3679      if test "$build_libtool_libs" = yes; then
3680        if test "$hardcode_into_libs" = yes; then
3681          # Hardcode the library paths
3682          hardcode_libdirs=
3683          dep_rpath=
3684          rpath="$finalize_rpath"
3685          test "$mode" != relink && rpath="$compile_rpath$rpath"
3686          for libdir in $rpath; do
3687            if test -n "$hardcode_libdir_flag_spec"; then
3688              if test -n "$hardcode_libdir_separator"; then
3689                if test -z "$hardcode_libdirs"; then
3690                  hardcode_libdirs="$libdir"
3691                else
3692                  # Just accumulate the unique libdirs.
3693                  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3694                  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3695                    ;;
3696                  *)
3697                    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3698                    ;;
3699                  esac
3700                fi
3701              else
3702                eval flag=\"$hardcode_libdir_flag_spec\"
3703                dep_rpath="$dep_rpath $flag"
3704              fi
3705            elif test -n "$runpath_var"; then
3706              case "$perm_rpath " in
3707              *" $libdir "*) ;;
3708              *) perm_rpath="$perm_rpath $libdir" ;;
3709              esac
3710            fi
3711          done
3712          # Substitute the hardcoded libdirs into the rpath.
3713          if test -n "$hardcode_libdir_separator" &&
3714             test -n "$hardcode_libdirs"; then
3715            libdir="$hardcode_libdirs"
3716            if test -n "$hardcode_libdir_flag_spec_ld"; then
3717              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3718            else
3719              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3720            fi
3721          fi
3722          if test -n "$runpath_var" && test -n "$perm_rpath"; then
3723            # We should set the runpath_var.
3724            rpath=
3725            for dir in $perm_rpath; do
3726              rpath="$rpath$dir:"
3727            done
3728            eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3729          fi
3730          test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3731        fi
3732
3733        shlibpath="$finalize_shlibpath"
3734        test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3735        if test -n "$shlibpath"; then
3736          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3737        fi
3738
3739        # Get the real and link names of the library.
3740        eval shared_ext=\"$shrext_cmds\"
3741        eval library_names=\"$library_names_spec\"
3742        set dummy $library_names
3743        realname="$2"
3744        shift; shift
3745
3746        if test -n "$soname_spec"; then
3747          eval soname=\"$soname_spec\"
3748        else
3749          soname="$realname"
3750        fi
3751        if test -z "$dlname"; then
3752          dlname=$soname
3753        fi
3754
3755        lib="$output_objdir/$realname"
3756        for link
3757        do
3758          linknames="$linknames $link"
3759        done
3760
3761        # Use standard objects if they are pic
3762        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3763
3764        # Prepare the list of exported symbols
3765        if test -z "$export_symbols"; then
3766          if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3767            $show "generating symbol list for \`$libname.la'"
3768            export_symbols="$output_objdir/$libname.exp"
3769            $run $rm $export_symbols
3770            cmds=$export_symbols_cmds
3771            save_ifs="$IFS"; IFS='~'
3772            for cmd in $cmds; do
3773              IFS="$save_ifs"
3774              eval cmd=\"$cmd\"
3775              if len=`expr "X$cmd" : ".*"` &&
3776               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3777                $show "$cmd"
3778                $run eval "$cmd" || exit $?
3779                skipped_export=false
3780              else
3781                # The command line is too long to execute in one step.
3782                $show "using reloadable object file for export list..."
3783                skipped_export=:
3784              fi
3785            done
3786            IFS="$save_ifs"
3787            if test -n "$export_symbols_regex"; then
3788              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3789              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3790              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3791              $run eval '$mv "${export_symbols}T" "$export_symbols"'
3792            fi
3793          fi
3794        fi
3795
3796        if test -n "$export_symbols" && test -n "$include_expsyms"; then
3797          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3798        fi
3799
3800        tmp_deplibs=
3801        for test_deplib in $deplibs; do
3802                case " $convenience " in
3803                *" $test_deplib "*) ;;
3804                *)
3805                        tmp_deplibs="$tmp_deplibs $test_deplib"
3806                        ;;
3807                esac
3808        done
3809        deplibs="$tmp_deplibs"
3810
3811        if test -n "$convenience"; then
3812          if test -n "$whole_archive_flag_spec"; then
3813            save_libobjs=$libobjs
3814            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3815          else
3816            gentop="$output_objdir/${outputname}x"
3817            generated="$generated $gentop"
3818
3819            func_extract_archives $gentop $convenience
3820            libobjs="$libobjs $func_extract_archives_result"
3821          fi
3822        fi
3823       
3824        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3825          eval flag=\"$thread_safe_flag_spec\"
3826          linker_flags="$linker_flags $flag"
3827        fi
3828
3829        # Make a backup of the uninstalled library when relinking
3830        if test "$mode" = relink; then
3831          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3832        fi
3833
3834        # Do each of the archive commands.
3835        if test "$module" = yes && test -n "$module_cmds" ; then
3836          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3837            eval test_cmds=\"$module_expsym_cmds\"
3838            cmds=$module_expsym_cmds
3839          else
3840            eval test_cmds=\"$module_cmds\"
3841            cmds=$module_cmds
3842          fi
3843        else
3844        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3845          eval test_cmds=\"$archive_expsym_cmds\"
3846          cmds=$archive_expsym_cmds
3847        else
3848          eval test_cmds=\"$archive_cmds\"
3849          cmds=$archive_cmds
3850          fi
3851        fi
3852
3853        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
3854           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3855          :
3856        else
3857          # The command line is too long to link in one step, link piecewise.
3858          $echo "creating reloadable object files..."
3859
3860          # Save the value of $output and $libobjs because we want to
3861          # use them later.  If we have whole_archive_flag_spec, we
3862          # want to use save_libobjs as it was before
3863          # whole_archive_flag_spec was expanded, because we can't
3864          # assume the linker understands whole_archive_flag_spec.
3865          # This may have to be revisited, in case too many
3866          # convenience libraries get linked in and end up exceeding
3867          # the spec.
3868          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3869            save_libobjs=$libobjs
3870          fi
3871          save_output=$output
3872
3873          # Clear the reloadable object creation command queue and
3874          # initialize k to one.
3875          test_cmds=
3876          concat_cmds=
3877          objlist=
3878          delfiles=
3879          last_robj=
3880          k=1
3881          output=$output_objdir/$save_output-${k}.$objext
3882          # Loop over the list of objects to be linked.
3883          for obj in $save_libobjs
3884          do
3885            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3886            if test "X$objlist" = X ||
3887               { len=`expr "X$test_cmds" : ".*"` &&
3888                 test "$len" -le "$max_cmd_len"; }; then
3889              objlist="$objlist $obj"
3890            else
3891              # The command $test_cmds is almost too long, add a
3892              # command to the queue.
3893              if test "$k" -eq 1 ; then
3894                # The first file doesn't have a previous command to add.
3895                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3896              else
3897                # All subsequent reloadable object files will link in
3898                # the last one created.
3899                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3900              fi
3901              last_robj=$output_objdir/$save_output-${k}.$objext
3902              k=`expr $k + 1`
3903              output=$output_objdir/$save_output-${k}.$objext
3904              objlist=$obj
3905              len=1
3906            fi
3907          done
3908          # Handle the remaining objects by creating one last
3909          # reloadable object file.  All subsequent reloadable object
3910          # files will link in the last one created.
3911          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3912          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3913
3914          if ${skipped_export-false}; then
3915            $show "generating symbol list for \`$libname.la'"
3916            export_symbols="$output_objdir/$libname.exp"
3917            $run $rm $export_symbols
3918            libobjs=$output
3919            # Append the command to create the export file.
3920            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3921          fi
3922
3923          # Set up a command to remove the reloadale object files
3924          # after they are used.
3925          i=0
3926          while test "$i" -lt "$k"
3927          do
3928            i=`expr $i + 1`
3929            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3930          done
3931
3932          $echo "creating a temporary reloadable object file: $output"
3933
3934          # Loop through the commands generated above and execute them.
3935          save_ifs="$IFS"; IFS='~'
3936          for cmd in $concat_cmds; do
3937            IFS="$save_ifs"
3938            $show "$cmd"
3939            $run eval "$cmd" || exit $?
3940          done
3941          IFS="$save_ifs"
3942
3943          libobjs=$output
3944          # Restore the value of output.
3945          output=$save_output
3946
3947          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3948            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3949          fi
3950          # Expand the library linking commands again to reset the
3951          # value of $libobjs for piecewise linking.
3952
3953          # Do each of the archive commands.
3954          if test "$module" = yes && test -n "$module_cmds" ; then
3955            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3956              cmds=$module_expsym_cmds
3957            else
3958              cmds=$module_cmds
3959            fi
3960          else
3961          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3962            cmds=$archive_expsym_cmds
3963          else
3964            cmds=$archive_cmds
3965            fi
3966          fi
3967
3968          # Append the command to remove the reloadable object files
3969          # to the just-reset $cmds.
3970          eval cmds=\"\$cmds~\$rm $delfiles\"
3971        fi
3972        save_ifs="$IFS"; IFS='~'
3973        for cmd in $cmds; do
3974          IFS="$save_ifs"
3975          eval cmd=\"$cmd\"
3976          $show "$cmd"
3977          $run eval "$cmd" || exit $?
3978        done
3979        IFS="$save_ifs"
3980
3981        # Restore the uninstalled library and exit
3982        if test "$mode" = relink; then
3983          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3984          exit $EXIT_SUCCESS
3985        fi
3986
3987        # Create links to the real library.
3988        for linkname in $linknames; do
3989          if test "$realname" != "$linkname"; then
3990            $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3991            $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3992          fi
3993        done
3994
3995        # If -module or -export-dynamic was specified, set the dlname.
3996        if test "$module" = yes || test "$export_dynamic" = yes; then
3997          # On all known operating systems, these are identical.
3998          dlname="$soname"
3999        fi
4000      fi
4001      ;;
4002
4003    obj)
4004      if test -n "$deplibs"; then
4005        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4006      fi
4007
4008      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4009        $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4010      fi
4011
4012      if test -n "$rpath"; then
4013        $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4014      fi
4015
4016      if test -n "$xrpath"; then
4017        $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4018      fi
4019
4020      if test -n "$vinfo"; then
4021        $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4022      fi
4023
4024      if test -n "$release"; then
4025        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4026      fi
4027
4028      case $output in
4029      *.lo)
4030        if test -n "$objs$old_deplibs"; then
4031          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4032          exit $EXIT_FAILURE
4033        fi
4034        libobj="$output"
4035        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4036        ;;
4037      *)
4038        libobj=
4039        obj="$output"
4040        ;;
4041      esac
4042
4043      # Delete the old objects.
4044      $run $rm $obj $libobj
4045
4046      # Objects from convenience libraries.  This assumes
4047      # single-version convenience libraries.  Whenever we create
4048      # different ones for PIC/non-PIC, this we'll have to duplicate
4049      # the extraction.
4050      reload_conv_objs=
4051      gentop=
4052      # reload_cmds runs $LD directly, so let us get rid of
4053      # -Wl from whole_archive_flag_spec
4054      wl=
4055
4056      if test -n "$convenience"; then
4057        if test -n "$whole_archive_flag_spec"; then
4058          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4059        else
4060          gentop="$output_objdir/${obj}x"
4061          generated="$generated $gentop"
4062
4063          func_extract_archives $gentop $convenience
4064          reload_conv_objs="$reload_objs $func_extract_archives_result"
4065        fi
4066      fi
4067
4068      # Create the old-style object.
4069      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
4070
4071      output="$obj"
4072      cmds=$reload_cmds
4073      save_ifs="$IFS"; IFS='~'
4074      for cmd in $cmds; do
4075        IFS="$save_ifs"
4076        eval cmd=\"$cmd\"
4077        $show "$cmd"
4078        $run eval "$cmd" || exit $?
4079      done
4080      IFS="$save_ifs"
4081
4082      # Exit if we aren't doing a library object file.
4083      if test -z "$libobj"; then
4084        if test -n "$gentop"; then
4085          $show "${rm}r $gentop"
4086          $run ${rm}r $gentop
4087        fi
4088
4089        exit $EXIT_SUCCESS
4090      fi
4091
4092      if test "$build_libtool_libs" != yes; then
4093        if test -n "$gentop"; then
4094          $show "${rm}r $gentop"
4095          $run ${rm}r $gentop
4096        fi
4097
4098        # Create an invalid libtool object if no PIC, so that we don't
4099        # accidentally link it into a program.
4100        # $show "echo timestamp > $libobj"
4101        # $run eval "echo timestamp > $libobj" || exit $?
4102        exit $EXIT_SUCCESS
4103      fi
4104
4105      if test -n "$pic_flag" || test "$pic_mode" != default; then
4106        # Only do commands if we really have different PIC objects.
4107        reload_objs="$libobjs $reload_conv_objs"
4108        output="$libobj"
4109        cmds=$reload_cmds
4110        save_ifs="$IFS"; IFS='~'
4111        for cmd in $cmds; do
4112          IFS="$save_ifs"
4113          eval cmd=\"$cmd\"
4114          $show "$cmd"
4115          $run eval "$cmd" || exit $?
4116        done
4117        IFS="$save_ifs"
4118      fi
4119
4120      if test -n "$gentop"; then
4121        $show "${rm}r $gentop"
4122        $run ${rm}r $gentop
4123      fi
4124
4125      exit $EXIT_SUCCESS
4126      ;;
4127
4128    prog)
4129      case $host in
4130        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4131      esac
4132      if test -n "$vinfo"; then
4133        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4134      fi
4135
4136      if test -n "$release"; then
4137        $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4138      fi
4139
4140      if test "$preload" = yes; then
4141        if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4142           test "$dlopen_self_static" = unknown; then
4143          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4144        fi
4145      fi
4146
4147      case $host in
4148      *-*-rhapsody* | *-*-darwin1.[012])
4149        # On Rhapsody replace the C library is the System framework
4150        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4151        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4152        ;;
4153      esac
4154
4155      case $host in
4156      *darwin*)
4157        # Don't allow lazy linking, it breaks C++ global constructors
4158        if test "$tagname" = CXX ; then
4159        compile_command="$compile_command ${wl}-bind_at_load"
4160        finalize_command="$finalize_command ${wl}-bind_at_load"
4161        fi
4162        ;;
4163      esac
4164
4165      compile_command="$compile_command $compile_deplibs"
4166      finalize_command="$finalize_command $finalize_deplibs"
4167
4168      if test -n "$rpath$xrpath"; then
4169        # If the user specified any rpath flags, then add them.
4170        for libdir in $rpath $xrpath; do
4171          # This is the magic to use -rpath.
4172          case "$finalize_rpath " in
4173          *" $libdir "*) ;;
4174          *) finalize_rpath="$finalize_rpath $libdir" ;;
4175          esac
4176        done
4177      fi
4178
4179      # Now hardcode the library paths
4180      rpath=
4181      hardcode_libdirs=
4182      for libdir in $compile_rpath $finalize_rpath; do
4183        if test -n "$hardcode_libdir_flag_spec"; then
4184          if test -n "$hardcode_libdir_separator"; then
4185            if test -z "$hardcode_libdirs"; then
4186              hardcode_libdirs="$libdir"
4187            else
4188              # Just accumulate the unique libdirs.
4189              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4190              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4191                ;;
4192              *)
4193                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4194                ;;
4195              esac
4196            fi
4197          else
4198            eval flag=\"$hardcode_libdir_flag_spec\"
4199            rpath="$rpath $flag"
4200          fi
4201        elif test -n "$runpath_var"; then
4202          case "$perm_rpath " in
4203          *" $libdir "*) ;;
4204          *) perm_rpath="$perm_rpath $libdir" ;;
4205          esac
4206        fi
4207        case $host in
4208        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4209          case :$dllsearchpath: in
4210          *":$libdir:"*) ;;
4211          *) dllsearchpath="$dllsearchpath:$libdir";;
4212          esac
4213          ;;
4214        esac
4215      done
4216      # Substitute the hardcoded libdirs into the rpath.
4217      if test -n "$hardcode_libdir_separator" &&
4218         test -n "$hardcode_libdirs"; then
4219        libdir="$hardcode_libdirs"
4220        eval rpath=\" $hardcode_libdir_flag_spec\"
4221      fi
4222      compile_rpath="$rpath"
4223
4224      rpath=
4225      hardcode_libdirs=
4226      for libdir in $finalize_rpath; do
4227        if test -n "$hardcode_libdir_flag_spec"; then
4228          if test -n "$hardcode_libdir_separator"; then
4229            if test -z "$hardcode_libdirs"; then
4230              hardcode_libdirs="$libdir"
4231            else
4232              # Just accumulate the unique libdirs.
4233              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4234              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4235                ;;
4236              *)
4237                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4238                ;;
4239              esac
4240            fi
4241          else
4242            eval flag=\"$hardcode_libdir_flag_spec\"
4243            rpath="$rpath $flag"
4244          fi
4245        elif test -n "$runpath_var"; then
4246          case "$finalize_perm_rpath " in
4247          *" $libdir "*) ;;
4248          *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4249          esac
4250        fi
4251      done
4252      # Substitute the hardcoded libdirs into the rpath.
4253      if test -n "$hardcode_libdir_separator" &&
4254         test -n "$hardcode_libdirs"; then
4255        libdir="$hardcode_libdirs"
4256        eval rpath=\" $hardcode_libdir_flag_spec\"
4257      fi
4258      finalize_rpath="$rpath"
4259
4260      if test -n "$libobjs" && test "$build_old_libs" = yes; then
4261        # Transform all the library objects into standard objects.
4262        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4263        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4264      fi
4265
4266      dlsyms=
4267      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4268        if test -n "$NM" && test -n "$global_symbol_pipe"; then
4269          dlsyms="${outputname}S.c"
4270        else
4271          $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4272        fi
4273      fi
4274
4275      if test -n "$dlsyms"; then
4276        case $dlsyms in
4277        "") ;;
4278        *.c)
4279          # Discover the nlist of each of the dlfiles.
4280          nlist="$output_objdir/${outputname}.nm"
4281
4282          $show "$rm $nlist ${nlist}S ${nlist}T"
4283          $run $rm "$nlist" "${nlist}S" "${nlist}T"
4284
4285          # Parse the name list into a source file.
4286          $show "creating $output_objdir/$dlsyms"
4287
4288          test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4289/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4290/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4291
4292#ifdef __cplusplus
4293extern \"C\" {
4294#endif
4295
4296/* Prevent the only kind of declaration conflicts we can make. */
4297#define lt_preloaded_symbols some_other_symbol
4298
4299/* External symbol declarations for the compiler. */\
4300"
4301
4302          if test "$dlself" = yes; then
4303            $show "generating symbol list for \`$output'"
4304
4305            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4306
4307            # Add our own program objects to the symbol list.
4308            progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4309            for arg in $progfiles; do
4310              $show "extracting global C symbols from \`$arg'"
4311              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4312            done
4313
4314            if test -n "$exclude_expsyms"; then
4315              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4316              $run eval '$mv "$nlist"T "$nlist"'
4317            fi
4318
4319            if test -n "$export_symbols_regex"; then
4320              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4321              $run eval '$mv "$nlist"T "$nlist"'
4322            fi
4323
4324            # Prepare the list of exported symbols
4325            if test -z "$export_symbols"; then
4326              export_symbols="$output_objdir/$output.exp"
4327              $run $rm $export_symbols
4328              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4329            else
4330              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4331              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4332              $run eval 'mv "$nlist"T "$nlist"'
4333            fi
4334          fi
4335
4336          for arg in $dlprefiles; do
4337            $show "extracting global C symbols from \`$arg'"
4338            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4339            $run eval '$echo ": $name " >> "$nlist"'
4340            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4341          done
4342
4343          if test -z "$run"; then
4344            # Make sure we have at least an empty file.
4345            test -f "$nlist" || : > "$nlist"
4346
4347            if test -n "$exclude_expsyms"; then
4348              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4349              $mv "$nlist"T "$nlist"
4350            fi
4351
4352            # Try sorting and uniquifying the output.
4353            if grep -v "^: " < "$nlist" |
4354                if sort -k 3 </dev/null >/dev/null 2>&1; then
4355                  sort -k 3
4356                else
4357                  sort +2
4358                fi |
4359                uniq > "$nlist"S; then
4360              :
4361            else
4362              grep -v "^: " < "$nlist" > "$nlist"S
4363            fi
4364
4365            if test -f "$nlist"S; then
4366              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4367            else
4368              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4369            fi
4370
4371            $echo >> "$output_objdir/$dlsyms" "\
4372
4373#undef lt_preloaded_symbols
4374
4375#if defined (__STDC__) && __STDC__
4376# define lt_ptr void *
4377#else
4378# define lt_ptr char *
4379# define const
4380#endif
4381
4382/* The mapping between symbol names and symbols. */
4383const struct {
4384  const char *name;
4385  lt_ptr address;
4386}
4387lt_preloaded_symbols[] =
4388{\
4389"
4390
4391            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4392
4393            $echo >> "$output_objdir/$dlsyms" "\
4394  {0, (lt_ptr) 0}
4395};
4396
4397/* This works around a problem in FreeBSD linker */
4398#ifdef FREEBSD_WORKAROUND
4399static const void *lt_preloaded_setup() {
4400  return lt_preloaded_symbols;
4401}
4402#endif
4403
4404#ifdef __cplusplus
4405}
4406#endif\
4407"
4408          fi
4409
4410          pic_flag_for_symtable=
4411          case $host in
4412          # compiling the symbol table file with pic_flag works around
4413          # a FreeBSD bug that causes programs to crash when -lm is
4414          # linked before any other PIC object.  But we must not use
4415          # pic_flag when linking with -static.  The problem exists in
4416          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4417          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4418            case "$compile_command " in
4419            *" -static "*) ;;
4420            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4421            esac;;
4422          *-*-hpux*)
4423            case "$compile_command " in
4424            *" -static "*) ;;
4425            *) pic_flag_for_symtable=" $pic_flag";;
4426            esac
4427          esac
4428
4429          # Now compile the dynamic symbol file.
4430          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4431          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4432
4433          # Clean up the generated files.
4434          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4435          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4436
4437          # Transform the symbol file into the correct name.
4438          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4439          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4440          ;;
4441        *)
4442          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4443          exit $EXIT_FAILURE
4444          ;;
4445        esac
4446      else
4447        # We keep going just in case the user didn't refer to
4448        # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
4449        # really was required.
4450
4451        # Nullify the symbol file.
4452        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4453        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4454      fi
4455
4456      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4457        # Replace the output file specification.
4458        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4459        link_command="$compile_command$compile_rpath"
4460
4461        # We have no uninstalled library dependencies, so finalize right now.
4462        $show "$link_command"
4463        $run eval "$link_command"
4464        status=$?
4465
4466        # Delete the generated files.
4467        if test -n "$dlsyms"; then
4468          $show "$rm $output_objdir/${outputname}S.${objext}"
4469          $run $rm "$output_objdir/${outputname}S.${objext}"
4470        fi
4471
4472        exit $status
4473      fi
4474
4475      if test -n "$shlibpath_var"; then
4476        # We should set the shlibpath_var
4477        rpath=
4478        for dir in $temp_rpath; do
4479          case $dir in
4480          [\\/]* | [A-Za-z]:[\\/]*)
4481            # Absolute path.
4482            rpath="$rpath$dir:"
4483            ;;
4484          *)
4485            # Relative path: add a thisdir entry.
4486            rpath="$rpath\$thisdir/$dir:"
4487            ;;
4488          esac
4489        done
4490        temp_rpath="$rpath"
4491      fi
4492
4493      if test -n "$compile_shlibpath$finalize_shlibpath"; then
4494        compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4495      fi
4496      if test -n "$finalize_shlibpath"; then
4497        finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4498      fi
4499
4500      compile_var=
4501      finalize_var=
4502      if test -n "$runpath_var"; then
4503        if test -n "$perm_rpath"; then
4504          # We should set the runpath_var.
4505          rpath=
4506          for dir in $perm_rpath; do
4507            rpath="$rpath$dir:"
4508          done
4509          compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4510        fi
4511        if test -n "$finalize_perm_rpath"; then
4512          # We should set the runpath_var.
4513          rpath=
4514          for dir in $finalize_perm_rpath; do
4515            rpath="$rpath$dir:"
4516          done
4517          finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4518        fi
4519      fi
4520
4521      if test "$no_install" = yes; then
4522        # We don't need to create a wrapper script.
4523        link_command="$compile_var$compile_command$compile_rpath"
4524        # Replace the output file specification.
4525        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4526        # Delete the old output file.
4527        $run $rm $output
4528        # Link the executable and exit
4529        $show "$link_command"
4530        $run eval "$link_command" || exit $?
4531        exit $EXIT_SUCCESS
4532      fi
4533
4534      if test "$hardcode_action" = relink; then
4535        # Fast installation is not supported
4536        link_command="$compile_var$compile_command$compile_rpath"
4537        relink_command="$finalize_var$finalize_command$finalize_rpath"
4538
4539        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4540        $echo "$modename: \`$output' will be relinked during installation" 1>&2
4541      else
4542        if test "$fast_install" != no; then
4543          link_command="$finalize_var$compile_command$finalize_rpath"
4544          if test "$fast_install" = yes; then
4545            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4546          else
4547            # fast_install is set to needless
4548            relink_command=
4549          fi
4550        else
4551          link_command="$compile_var$compile_command$compile_rpath"
4552          relink_command="$finalize_var$finalize_command$finalize_rpath"
4553        fi
4554      fi
4555
4556      # Replace the output file specification.
4557      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4558
4559      # Delete the old output files.
4560      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4561
4562      $show "$link_command"
4563      $run eval "$link_command" || exit $?
4564
4565      # Now create the wrapper script.
4566      $show "creating $output"
4567
4568      # Quote the relink command for shipping.
4569      if test -n "$relink_command"; then
4570        # Preserve any variables that may affect compiler behavior
4571        for var in $variables_saved_for_relink; do
4572          if eval test -z \"\${$var+set}\"; then
4573            relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4574          elif eval var_value=\$$var; test -z "$var_value"; then
4575            relink_command="$var=; export $var; $relink_command"
4576          else
4577            var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4578            relink_command="$var=\"$var_value\"; export $var; $relink_command"
4579          fi
4580        done
4581        relink_command="(cd `pwd`; $relink_command)"
4582        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4583      fi
4584
4585      # Quote $echo for shipping.
4586      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4587        case $progpath in
4588        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4589        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4590        esac
4591        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4592      else
4593        qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4594      fi
4595
4596      # Only actually do things if our run command is non-null.
4597      if test -z "$run"; then
4598        # win32 will think the script is a binary if it has
4599        # a .exe suffix, so we strip it off here.
4600        case $output in
4601          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4602        esac
4603        # test for cygwin because mv fails w/o .exe extensions
4604        case $host in
4605          *cygwin*)
4606            exeext=.exe
4607            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4608          *) exeext= ;;
4609        esac
4610        case $host in
4611          *cygwin* | *mingw* )
4612            cwrappersource=`$echo ${objdir}/lt-${output}.c`
4613            cwrapper=`$echo ${output}.exe`
4614            $rm $cwrappersource $cwrapper
4615            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4616
4617            cat > $cwrappersource <<EOF
4618
4619/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4620   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4621
4622   The $output program cannot be directly executed until all the libtool
4623   libraries that it depends on are installed.
4624
4625   This wrapper executable should never be moved out of the build directory.
4626   If it is, it will not operate correctly.
4627
4628   Currently, it simply execs the wrapper *script* "/bin/sh $output",
4629   but could eventually absorb all of the scripts functionality and
4630   exec $objdir/$outputname directly.
4631*/
4632EOF
4633            cat >> $cwrappersource<<"EOF"
4634#include <stdio.h>
4635#include <stdlib.h>
4636#include <unistd.h>
4637#include <malloc.h>
4638#include <stdarg.h>
4639#include <assert.h>
4640
4641#if defined(PATH_MAX)
4642# define LT_PATHMAX PATH_MAX
4643#elif defined(MAXPATHLEN)
4644# define LT_PATHMAX MAXPATHLEN
4645#else
4646# define LT_PATHMAX 1024
4647#endif
4648
4649#ifndef DIR_SEPARATOR
4650#define DIR_SEPARATOR '/'
4651#endif
4652
4653#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4654  defined (__OS2__)
4655#define HAVE_DOS_BASED_FILE_SYSTEM
4656#ifndef DIR_SEPARATOR_2
4657#define DIR_SEPARATOR_2 '\\'
4658#endif
4659#endif
4660
4661#ifndef DIR_SEPARATOR_2
4662# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4663#else /* DIR_SEPARATOR_2 */
4664# define IS_DIR_SEPARATOR(ch) \
4665        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4666#endif /* DIR_SEPARATOR_2 */
4667
4668#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4669#define XFREE(stale) do { \
4670  if (stale) { free ((void *) stale); stale = 0; } \
4671} while (0)
4672
4673const char *program_name = NULL;
4674
4675void * xmalloc (size_t num);
4676char * xstrdup (const char *string);
4677char * basename (const char *name);
4678char * fnqualify(const char *path);
4679char * strendzap(char *str, const char *pat);
4680void lt_fatal (const char *message, ...);
4681
4682int
4683main (int argc, char *argv[])
4684{
4685  char **newargz;
4686  int i;
4687
4688  program_name = (char *) xstrdup ((char *) basename (argv[0]));
4689  newargz = XMALLOC(char *, argc+2);
4690EOF
4691
4692            cat >> $cwrappersource <<EOF
4693  newargz[0] = "$SHELL";
4694EOF
4695
4696            cat >> $cwrappersource <<"EOF"
4697  newargz[1] = fnqualify(argv[0]);
4698  /* we know the script has the same name, without the .exe */
4699  /* so make sure newargz[1] doesn't end in .exe */
4700  strendzap(newargz[1],".exe");
4701  for (i = 1; i < argc; i++)
4702    newargz[i+1] = xstrdup(argv[i]);
4703  newargz[argc+1] = NULL;
4704EOF
4705
4706            cat >> $cwrappersource <<EOF
4707  execv("$SHELL",newargz);
4708EOF
4709
4710            cat >> $cwrappersource <<"EOF"
4711}
4712
4713void *
4714xmalloc (size_t num)
4715{
4716  void * p = (void *) malloc (num);
4717  if (!p)
4718    lt_fatal ("Memory exhausted");
4719
4720  return p;
4721}
4722
4723char *
4724xstrdup (const char *string)
4725{
4726  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4727;
4728}
4729
4730char *
4731basename (const char *name)
4732{
4733  const char *base;
4734
4735#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4736  /* Skip over the disk name in MSDOS pathnames. */
4737  if (isalpha (name[0]) && name[1] == ':')
4738    name += 2;
4739#endif
4740
4741  for (base = name; *name; name++)
4742    if (IS_DIR_SEPARATOR (*name))
4743      base = name + 1;
4744  return (char *) base;
4745}
4746
4747char *
4748fnqualify(const char *path)
4749{
4750  size_t size;
4751  char *p;
4752  char tmp[LT_PATHMAX + 1];
4753
4754  assert(path != NULL);
4755
4756  /* Is it qualified already? */
4757#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4758  if (isalpha (path[0]) && path[1] == ':')
4759    return xstrdup (path);
4760#endif
4761  if (IS_DIR_SEPARATOR (path[0]))
4762    return xstrdup (path);
4763
4764  /* prepend the current directory */
4765  /* doesn't handle '~' */
4766  if (getcwd (tmp, LT_PATHMAX) == NULL)
4767    lt_fatal ("getcwd failed");
4768  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4769  p = XMALLOC(char, size);
4770  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4771  return p;
4772}
4773
4774char *
4775strendzap(char *str, const char *pat)
4776{
4777  size_t len, patlen;
4778
4779  assert(str != NULL);
4780  assert(pat != NULL);
4781
4782  len = strlen(str);
4783  patlen = strlen(pat);
4784
4785  if (patlen <= len)
4786  {
4787    str += len - patlen;
4788    if (strcmp(str, pat) == 0)
4789      *str = '\0';
4790  }
4791  return str;
4792}
4793
4794static void
4795lt_error_core (int exit_status, const char * mode,
4796          const char * message, va_list ap)
4797{
4798  fprintf (stderr, "%s: %s: ", program_name, mode);
4799  vfprintf (stderr, message, ap);
4800  fprintf (stderr, ".\n");
4801
4802  if (exit_status >= 0)
4803    exit (exit_status);
4804}
4805
4806void
4807lt_fatal (const char *message, ...)
4808{
4809  va_list ap;
4810  va_start (ap, message);
4811  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4812  va_end (ap);
4813}
4814EOF
4815          # we should really use a build-platform specific compiler
4816          # here, but OTOH, the wrappers (shell script and this C one)
4817          # are only useful if you want to execute the "real" binary.
4818          # Since the "real" binary is built for $host, then this
4819          # wrapper might as well be built for $host, too.
4820          $run $LTCC -s -o $cwrapper $cwrappersource
4821          ;;
4822        esac
4823        $rm $output
4824        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4825
4826        $echo > $output "\
4827#! $SHELL
4828
4829# $output - temporary wrapper script for $objdir/$outputname
4830# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4831#
4832# The $output program cannot be directly executed until all the libtool
4833# libraries that it depends on are installed.
4834#
4835# This wrapper script should never be moved out of the build directory.
4836# If it is, it will not operate correctly.
4837
4838# Sed substitution that helps us do robust quoting.  It backslashifies
4839# metacharacters that are still active within double-quoted strings.
4840Xsed='${SED} -e 1s/^X//'
4841sed_quote_subst='$sed_quote_subst'
4842
4843# The HP-UX ksh and POSIX shell print the target directory to stdout
4844# if CDPATH is set.
4845(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4846
4847relink_command=\"$relink_command\"
4848
4849# This environment variable determines our operation mode.
4850if test \"\$libtool_install_magic\" = \"$magic\"; then
4851  # install mode needs the following variable:
4852  notinst_deplibs='$notinst_deplibs'
4853else
4854  # When we are sourced in execute mode, \$file and \$echo are already set.
4855  if test \"\$libtool_execute_magic\" != \"$magic\"; then
4856    echo=\"$qecho\"
4857    file=\"\$0\"
4858    # Make sure echo works.
4859    if test \"X\$1\" = X--no-reexec; then
4860      # Discard the --no-reexec flag, and continue.
4861      shift
4862    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4863      # Yippee, \$echo works!
4864      :
4865    else
4866      # Restart under the correct shell, and then maybe \$echo will work.
4867      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4868    fi
4869  fi\
4870"
4871        $echo >> $output "\
4872
4873  # Find the directory that this script lives in.
4874  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4875  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4876
4877  # Follow symbolic links until we get to the real thisdir.
4878  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4879  while test -n \"\$file\"; do
4880    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4881
4882    # If there was a directory component, then change thisdir.
4883    if test \"x\$destdir\" != \"x\$file\"; then
4884      case \"\$destdir\" in
4885      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4886      *) thisdir=\"\$thisdir/\$destdir\" ;;
4887      esac
4888    fi
4889
4890    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4891    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4892  done
4893
4894  # Try to get the absolute directory name.
4895  absdir=\`cd \"\$thisdir\" && pwd\`
4896  test -n \"\$absdir\" && thisdir=\"\$absdir\"
4897"
4898
4899        if test "$fast_install" = yes; then
4900          $echo >> $output "\
4901  program=lt-'$outputname'$exeext
4902  progdir=\"\$thisdir/$objdir\"
4903
4904  if test ! -f \"\$progdir/\$program\" || \\
4905     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4906       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4907
4908    file=\"\$\$-\$program\"
4909
4910    if test ! -d \"\$progdir\"; then
4911      $mkdir \"\$progdir\"
4912    else
4913      $rm \"\$progdir/\$file\"
4914    fi"
4915
4916          $echo >> $output "\
4917
4918    # relink executable if necessary
4919    if test -n \"\$relink_command\"; then
4920      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4921      else
4922        $echo \"\$relink_command_output\" >&2
4923        $rm \"\$progdir/\$file\"
4924        exit $EXIT_FAILURE
4925      fi
4926    fi
4927
4928    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4929    { $rm \"\$progdir/\$program\";
4930      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4931    $rm \"\$progdir/\$file\"
4932  fi"
4933        else
4934          $echo >> $output "\
4935  program='$outputname'
4936  progdir=\"\$thisdir/$objdir\"
4937"
4938        fi
4939
4940        $echo >> $output "\
4941
4942  if test -f \"\$progdir/\$program\"; then"
4943
4944        # Export our shlibpath_var if we have one.
4945        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4946          $echo >> $output "\
4947    # Add our own library path to $shlibpath_var
4948    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4949
4950    # Some systems cannot cope with colon-terminated $shlibpath_var
4951    # The second colon is a workaround for a bug in BeOS R4 sed
4952    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4953
4954    export $shlibpath_var
4955"
4956        fi
4957
4958        # fixup the dll searchpath if we need to.
4959        if test -n "$dllsearchpath"; then
4960          $echo >> $output "\
4961    # Add the dll search path components to the executable PATH
4962    PATH=$dllsearchpath:\$PATH
4963"
4964        fi
4965
4966        $echo >> $output "\
4967    if test \"\$libtool_execute_magic\" != \"$magic\"; then
4968      # Run the actual program with our arguments.
4969"
4970        case $host in
4971        # Backslashes separate directories on plain windows
4972        *-*-mingw | *-*-os2*)
4973          $echo >> $output "\
4974      exec \$progdir\\\\\$program \${1+\"\$@\"}
4975"
4976          ;;
4977
4978        *)
4979          $echo >> $output "\
4980      exec \$progdir/\$program \${1+\"\$@\"}
4981"
4982          ;;
4983        esac
4984        $echo >> $output "\
4985      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4986      exit $EXIT_FAILURE
4987    fi
4988  else
4989    # The program doesn't exist.
4990    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4991    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4992    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4993    exit $EXIT_FAILURE
4994  fi
4995fi\
4996"
4997        chmod +x $output
4998      fi
4999      exit $EXIT_SUCCESS
5000      ;;
5001    esac
5002
5003    # See if we need to build an old-fashioned archive.
5004    for oldlib in $oldlibs; do
5005
5006      if test "$build_libtool_libs" = convenience; then
5007        oldobjs="$libobjs_save"
5008        addlibs="$convenience"
5009        build_libtool_libs=no
5010      else
5011        if test "$build_libtool_libs" = module; then
5012          oldobjs="$libobjs_save"
5013          build_libtool_libs=no
5014        else
5015          oldobjs="$old_deplibs $non_pic_objects"
5016        fi
5017        addlibs="$old_convenience"
5018      fi
5019
5020      if test -n "$addlibs"; then
5021        gentop="$output_objdir/${outputname}x"
5022        generated="$generated $gentop"
5023
5024        func_extract_archives $gentop $addlibs
5025        oldobjs="$oldobjs $func_extract_archives_result"
5026      fi
5027
5028      # Do each command in the archive commands.
5029      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5030       cmds=$old_archive_from_new_cmds
5031      else
5032        eval cmds=\"$old_archive_cmds\"
5033
5034        if len=`expr "X$cmds" : ".*"` &&
5035             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5036          cmds=$old_archive_cmds
5037        else
5038          # the command line is too long to link in one step, link in parts
5039          $echo "using piecewise archive linking..."
5040          save_RANLIB=$RANLIB
5041          RANLIB=:
5042          objlist=
5043          concat_cmds=
5044          save_oldobjs=$oldobjs
5045          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5046          # encoded into archives.  This makes 'ar r' malfunction in
5047          # this piecewise linking case whenever conflicting object
5048          # names appear in distinct ar calls; check, warn and compensate.
5049            if (for obj in $save_oldobjs
5050            do
5051              $echo "X$obj" | $Xsed -e 's%^.*/%%'
5052            done | sort | sort -uc >/dev/null 2>&1); then
5053            :
5054          else
5055            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5056            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5057            AR_FLAGS=cq
5058          fi
5059          # Is there a better way of finding the last object in the list?
5060          for obj in $save_oldobjs
5061          do
5062            last_oldobj=$obj
5063          done
5064          for obj in $save_oldobjs
5065          do
5066            oldobjs="$objlist $obj"
5067            objlist="$objlist $obj"
5068            eval test_cmds=\"$old_archive_cmds\"
5069            if len=`expr "X$test_cmds" : ".*"` &&
5070               test "$len" -le "$max_cmd_len"; then
5071              :
5072            else
5073              # the above command should be used before it gets too long
5074              oldobjs=$objlist
5075              if test "$obj" = "$last_oldobj" ; then
5076                RANLIB=$save_RANLIB
5077              fi
5078              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5079              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5080              objlist=
5081            fi
5082          done
5083          RANLIB=$save_RANLIB
5084          oldobjs=$objlist
5085          if test "X$oldobjs" = "X" ; then
5086            eval cmds=\"\$concat_cmds\"
5087          else
5088            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5089          fi
5090        fi
5091      fi
5092      save_ifs="$IFS"; IFS='~'
5093      for cmd in $cmds; do
5094        eval cmd=\"$cmd\"
5095        IFS="$save_ifs"
5096        $show "$cmd"
5097        $run eval "$cmd" || exit $?
5098      done
5099      IFS="$save_ifs"
5100    done
5101
5102    if test -n "$generated"; then
5103      $show "${rm}r$generated"
5104      $run ${rm}r$generated
5105    fi
5106
5107    # Now create the libtool archive.
5108    case $output in
5109    *.la)
5110      old_library=
5111      test "$build_old_libs" = yes && old_library="$libname.$libext"
5112      $show "creating $output"
5113
5114      # Preserve any variables that may affect compiler behavior
5115      for var in $variables_saved_for_relink; do
5116        if eval test -z \"\${$var+set}\"; then
5117          relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5118        elif eval var_value=\$$var; test -z "$var_value"; then
5119          relink_command="$var=; export $var; $relink_command"
5120        else
5121          var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5122          relink_command="$var=\"$var_value\"; export $var; $relink_command"
5123        fi
5124      done
5125      # Quote the link command for shipping.
5126      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5127      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5128      if test "$hardcode_automatic" = yes ; then
5129        relink_command=
5130      fi
5131
5132
5133      # Only create the output if not a dry run.
5134      if test -z "$run"; then
5135        for installed in no yes; do
5136          if test "$installed" = yes; then
5137            if test -z "$install_libdir"; then
5138              break
5139            fi
5140            output="$output_objdir/$outputname"i
5141            # Replace all uninstalled libtool libraries with the installed ones
5142            newdependency_libs=
5143            for deplib in $dependency_libs; do
5144              case $deplib in
5145              *.la)
5146                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5147                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5148                if test -z "$libdir"; then
5149                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5150                  exit $EXIT_FAILURE
5151                fi
5152                newdependency_libs="$newdependency_libs $libdir/$name"
5153                ;;
5154              *) newdependency_libs="$newdependency_libs $deplib" ;;
5155              esac
5156            done
5157            dependency_libs="$newdependency_libs"
5158            newdlfiles=
5159            for lib in $dlfiles; do
5160              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5161              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5162              if test -z "$libdir"; then
5163                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5164                exit $EXIT_FAILURE
5165              fi
5166              newdlfiles="$newdlfiles $libdir/$name"
5167            done
5168            dlfiles="$newdlfiles"
5169            newdlprefiles=
5170            for lib in $dlprefiles; do
5171              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5172              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5173              if test -z "$libdir"; then
5174                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5175                exit $EXIT_FAILURE
5176              fi
5177              newdlprefiles="$newdlprefiles $libdir/$name"
5178            done
5179            dlprefiles="$newdlprefiles"
5180          else
5181            newdlfiles=
5182            for lib in $dlfiles; do
5183              case $lib in
5184                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5185                *) abs=`pwd`"/$lib" ;;
5186              esac
5187              newdlfiles="$newdlfiles $abs"
5188            done
5189            dlfiles="$newdlfiles"
5190            newdlprefiles=
5191            for lib in $dlprefiles; do
5192              case $lib in
5193                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5194                *) abs=`pwd`"/$lib" ;;
5195              esac
5196              newdlprefiles="$newdlprefiles $abs"
5197            done
5198            dlprefiles="$newdlprefiles"
5199          fi
5200          $rm $output
5201          # place dlname in correct position for cygwin
5202          tdlname=$dlname
5203          case $host,$output,$installed,$module,$dlname in
5204            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5205          esac
5206          $echo > $output "\
5207# $outputname - a libtool library file
5208# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5209#
5210# Please DO NOT delete this file!
5211# It is necessary for linking the library.
5212
5213# The name that we can dlopen(3).
5214dlname='$tdlname'
5215
5216# Names of this library.
5217library_names='$library_names'
5218
5219# The name of the static archive.
5220old_library='$old_library'
5221
5222# Libraries that this one depends upon.
5223dependency_libs='$dependency_libs'
5224
5225# Version information for $libname.
5226current=$current
5227age=$age
5228revision=$revision
5229
5230# Is this an already installed library?
5231installed=$installed
5232
5233# Should we warn about portability when linking against -modules?
5234shouldnotlink=$module
5235
5236# Files to dlopen/dlpreopen
5237dlopen='$dlfiles'
5238dlpreopen='$dlprefiles'
5239
5240# Directory that this library needs to be installed in:
5241libdir='$install_libdir'"
5242          if test "$installed" = no && test "$need_relink" = yes; then
5243            $echo >> $output "\
5244relink_command=\"$relink_command\""
5245          fi
5246        done
5247      fi
5248
5249      # Do a symbolic link so that the libtool archive can be found in
5250      # LD_LIBRARY_PATH before the program is installed.
5251      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5252      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5253      ;;
5254    esac
5255    exit $EXIT_SUCCESS
5256    ;;
5257
5258  # libtool install mode
5259  install)
5260    modename="$modename: install"
5261
5262    # There may be an optional sh(1) argument at the beginning of
5263    # install_prog (especially on Windows NT).
5264    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5265       # Allow the use of GNU shtool's install command.
5266       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5267      # Aesthetically quote it.
5268      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5269      case $arg in
5270      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
5271        arg="\"$arg\""
5272        ;;
5273      esac
5274      install_prog="$arg "
5275      arg="$1"
5276      shift
5277    else
5278      install_prog=
5279      arg="$nonopt"
5280    fi
5281
5282    # The real first argument should be the name of the installation program.
5283    # Aesthetically quote it.
5284    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5285    case $arg in
5286    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
5287      arg="\"$arg\""
5288      ;;
5289    esac
5290    install_prog="$install_prog$arg"
5291
5292    # We need to accept at least all the BSD install flags.
5293    dest=
5294    files=
5295    opts=
5296    prev=
5297    install_type=
5298    isdir=no
5299    stripme=
5300    for arg
5301    do
5302      if test -n "$dest"; then
5303        files="$files $dest"
5304        dest="$arg"
5305        continue
5306      fi
5307
5308      case $arg in
5309      -d) isdir=yes ;;
5310      -f) prev="-f" ;;
5311      -g) prev="-g" ;;
5312      -m) prev="-m" ;;
5313      -o) prev="-o" ;;
5314      -s)
5315        stripme=" -s"
5316        continue
5317        ;;
5318      -*) ;;
5319
5320      *)
5321        # If the previous option needed an argument, then skip it.
5322        if test -n "$prev"; then
5323          prev=
5324        else
5325          dest="$arg"
5326          continue
5327        fi
5328        ;;
5329      esac
5330
5331      # Aesthetically quote the argument.
5332      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5333      case $arg in
5334      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
5335        arg="\"$arg\""
5336        ;;
5337      esac
5338      install_prog="$install_prog $arg"
5339    done
5340
5341    if test -z "$install_prog"; then
5342      $echo "$modename: you must specify an install program" 1>&2
5343      $echo "$help" 1>&2
5344      exit $EXIT_FAILURE
5345    fi
5346
5347    if test -n "$prev"; then
5348      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5349      $echo "$help" 1>&2
5350      exit $EXIT_FAILURE
5351    fi
5352
5353    if test -z "$files"; then
5354      if test -z "$dest"; then
5355        $echo "$modename: no file or destination specified" 1>&2
5356      else
5357        $echo "$modename: you must specify a destination" 1>&2
5358      fi
5359      $echo "$help" 1>&2
5360      exit $EXIT_FAILURE
5361    fi
5362
5363    # Strip any trailing slash from the destination.
5364    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5365
5366    # Check to see that the destination is a directory.
5367    test -d "$dest" && isdir=yes
5368    if test "$isdir" = yes; then
5369      destdir="$dest"
5370      destname=
5371    else
5372      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5373      test "X$destdir" = "X$dest" && destdir=.
5374      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5375
5376      # Not a directory, so check to see that there is only one file specified.
5377      set dummy $files
5378      if test "$#" -gt 2; then
5379        $echo "$modename: \`$dest' is not a directory" 1>&2
5380        $echo "$help" 1>&2
5381        exit $EXIT_FAILURE
5382      fi
5383    fi
5384    case $destdir in
5385    [\\/]* | [A-Za-z]:[\\/]*) ;;
5386    *)
5387      for file in $files; do
5388        case $file in
5389        *.lo) ;;
5390        *)
5391          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5392          $echo "$help" 1>&2
5393          exit $EXIT_FAILURE
5394          ;;
5395        esac
5396      done
5397      ;;
5398    esac
5399
5400    # This variable tells wrapper scripts just to set variables rather
5401    # than running their programs.
5402    libtool_install_magic="$magic"
5403
5404    staticlibs=
5405    future_libdirs=
5406    current_libdirs=
5407    for file in $files; do
5408
5409      # Do each installation.
5410      case $file in
5411      *.$libext)
5412        # Do the static libraries later.
5413        staticlibs="$staticlibs $file"
5414        ;;
5415
5416      *.la)
5417        # Check to see that this really is a libtool archive.
5418        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5419        else
5420          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5421          $echo "$help" 1>&2
5422          exit $EXIT_FAILURE
5423        fi
5424
5425        library_names=
5426        old_library=
5427        relink_command=
5428        # If there is no directory component, then add one.
5429        case $file in
5430        */* | *\\*) . $file ;;
5431        *) . ./$file ;;
5432        esac
5433
5434        # Add the libdir to current_libdirs if it is the destination.
5435        if test "X$destdir" = "X$libdir"; then
5436          case "$current_libdirs " in
5437          *" $libdir "*) ;;
5438          *) current_libdirs="$current_libdirs $libdir" ;;
5439          esac
5440        else
5441          # Note the libdir as a future libdir.
5442          case "$future_libdirs " in
5443          *" $libdir "*) ;;
5444          *) future_libdirs="$future_libdirs $libdir" ;;
5445          esac
5446        fi
5447
5448        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5449        test "X$dir" = "X$file/" && dir=
5450        dir="$dir$objdir"
5451
5452        if test -n "$relink_command"; then
5453          # Determine the prefix the user has applied to our future dir.
5454          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5455
5456          # Don't allow the user to place us outside of our expected
5457          # location b/c this prevents finding dependent libraries that
5458          # are installed to the same prefix.
5459          # At present, this check doesn't affect windows .dll's that
5460          # are installed into $libdir/../bin (currently, that works fine)
5461          # but it's something to keep an eye on.
5462          if test "$inst_prefix_dir" = "$destdir"; then
5463            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5464            exit $EXIT_FAILURE
5465          fi
5466
5467          if test -n "$inst_prefix_dir"; then
5468            # Stick the inst_prefix_dir data into the link command.
5469            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5470          else
5471            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5472          fi
5473
5474          $echo "$modename: warning: relinking \`$file'" 1>&2
5475          $show "$relink_command"
5476          if $run eval "$relink_command"; then :
5477          else
5478            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5479            exit $EXIT_FAILURE
5480          fi
5481        fi
5482
5483        # See the names of the shared library.
5484        set dummy $library_names
5485        if test -n "$2"; then
5486          realname="$2"
5487          shift
5488          shift
5489
5490          srcname="$realname"
5491          test -n "$relink_command" && srcname="$realname"T
5492
5493          # Install the shared library and build the symlinks.
5494          $show "$install_prog $dir/$srcname $destdir/$realname"
5495          $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5496          if test -n "$stripme" && test -n "$striplib"; then
5497            $show "$striplib $destdir/$realname"
5498            $run eval "$striplib $destdir/$realname" || exit $?
5499          fi
5500
5501          if test "$#" -gt 0; then
5502            # Delete the old symlinks, and create new ones.
5503            for linkname
5504            do
5505              if test "$linkname" != "$realname"; then
5506                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5507                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5508              fi
5509            done
5510          fi
5511
5512          # Do each command in the postinstall commands.
5513          lib="$destdir/$realname"
5514          cmds=$postinstall_cmds
5515          save_ifs="$IFS"; IFS='~'
5516          for cmd in $cmds; do
5517            IFS="$save_ifs"
5518            eval cmd=\"$cmd\"
5519            $show "$cmd"
5520            $run eval "$cmd" || exit $?
5521          done
5522          IFS="$save_ifs"
5523        fi
5524
5525        # Install the pseudo-library for information purposes.
5526        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5527        instname="$dir/$name"i
5528        $show "$install_prog $instname $destdir/$name"
5529        $run eval "$install_prog $instname $destdir/$name" || exit $?
5530
5531        # Maybe install the static library, too.
5532        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5533        ;;
5534
5535      *.lo)
5536        # Install (i.e. copy) a libtool object.
5537
5538        # Figure out destination file name, if it wasn't already specified.
5539        if test -n "$destname"; then
5540          destfile="$destdir/$destname"
5541        else
5542          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5543          destfile="$destdir/$destfile"
5544        fi
5545
5546        # Deduce the name of the destination old-style object file.
5547        case $destfile in
5548        *.lo)
5549          staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5550          ;;
5551        *.$objext)
5552          staticdest="$destfile"
5553          destfile=
5554          ;;
5555        *)
5556          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5557          $echo "$help" 1>&2
5558          exit $EXIT_FAILURE
5559          ;;
5560        esac
5561
5562        # Install the libtool object if requested.
5563        if test -n "$destfile"; then
5564          $show "$install_prog $file $destfile"
5565          $run eval "$install_prog $file $destfile" || exit $?
5566        fi
5567
5568        # Install the old object if enabled.
5569        if test "$build_old_libs" = yes; then
5570          # Deduce the name of the old-style object file.
5571          staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5572
5573          $show "$install_prog $staticobj $staticdest"
5574          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5575        fi
5576        exit $EXIT_SUCCESS
5577        ;;
5578
5579      *)
5580        # Figure out destination file name, if it wasn't already specified.
5581        if test -n "$destname"; then
5582          destfile="$destdir/$destname"
5583        else
5584          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5585          destfile="$destdir/$destfile"
5586        fi
5587
5588        # If the file is missing, and there is a .exe on the end, strip it
5589        # because it is most likely a libtool script we actually want to
5590        # install
5591        stripped_ext=""
5592        case $file in
5593          *.exe)
5594            if test ! -f "$file"; then
5595              file=`$echo $file|${SED} 's,.exe$,,'`
5596              stripped_ext=".exe"
5597            fi
5598            ;;
5599        esac
5600
5601        # Do a test to see if this is really a libtool program.
5602        case $host in
5603        *cygwin*|*mingw*)
5604            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5605            ;;
5606        *)
5607            wrapper=$file
5608            ;;
5609        esac
5610        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5611          notinst_deplibs=
5612          relink_command=
5613
5614          # To insure that "foo" is sourced, and not "foo.exe",
5615          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5616          # which disallows the automatic-append-.exe behavior.
5617          case $build in
5618          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5619          *) wrapperdot=${wrapper} ;;
5620          esac
5621          # If there is no directory component, then add one.
5622          case $file in
5623          */* | *\\*) . ${wrapperdot} ;;
5624          *) . ./${wrapperdot} ;;
5625          esac
5626
5627          # Check the variables that should have been set.
5628          if test -z "$notinst_deplibs"; then
5629            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5630            exit $EXIT_FAILURE
5631          fi
5632
5633          finalize=yes
5634          for lib in $notinst_deplibs; do
5635            # Check to see that each library is installed.
5636            libdir=
5637            if test -f "$lib"; then
5638              # If there is no directory component, then add one.
5639              case $lib in
5640              */* | *\\*) . $lib ;;
5641              *) . ./$lib ;;
5642              esac
5643            fi
5644            libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5645            if test -n "$libdir" && test ! -f "$libfile"; then
5646              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5647              finalize=no
5648            fi
5649          done
5650
5651          relink_command=
5652          # To insure that "foo" is sourced, and not "foo.exe",
5653          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5654          # which disallows the automatic-append-.exe behavior.
5655          case $build in
5656          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5657          *) wrapperdot=${wrapper} ;;
5658          esac
5659          # If there is no directory component, then add one.
5660          case $file in
5661          */* | *\\*) . ${wrapperdot} ;;
5662          *) . ./${wrapperdot} ;;
5663          esac
5664
5665          outputname=
5666          if test "$fast_install" = no && test -n "$relink_command"; then
5667            if test "$finalize" = yes && test -z "$run"; then
5668              tmpdir="/tmp"
5669              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5670              tmpdir="$tmpdir/libtool-$$"
5671              save_umask=`umask`
5672              umask 0077
5673              if $mkdir "$tmpdir"; then
5674                umask $save_umask
5675              else
5676                umask $save_umask
5677                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5678                continue
5679              fi
5680              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5681              outputname="$tmpdir/$file"
5682              # Replace the output file specification.
5683              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5684
5685              $show "$relink_command"
5686              if $run eval "$relink_command"; then :
5687              else
5688                $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5689                ${rm}r "$tmpdir"
5690                continue
5691              fi
5692              file="$outputname"
5693            else
5694              $echo "$modename: warning: cannot relink \`$file'" 1>&2
5695            fi
5696          else
5697            # Install the binary that we compiled earlier.
5698            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5699          fi
5700        fi
5701
5702        # remove .exe since cygwin /usr/bin/install will append another
5703        # one anyways
5704        case $install_prog,$host in
5705        */usr/bin/install*,*cygwin*)
5706          case $file:$destfile in
5707          *.exe:*.exe)
5708            # this is ok
5709            ;;
5710          *.exe:*)
5711            destfile=$destfile.exe
5712            ;;
5713          *:*.exe)
5714            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5715            ;;
5716          esac
5717          ;;
5718        esac
5719        $show "$install_prog$stripme $file $destfile"
5720        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5721        test -n "$outputname" && ${rm}r "$tmpdir"
5722        ;;
5723      esac
5724    done
5725
5726    for file in $staticlibs; do
5727      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5728
5729      # Set up the ranlib parameters.
5730      oldlib="$destdir/$name"
5731
5732      $show "$install_prog $file $oldlib"
5733      $run eval "$install_prog \$file \$oldlib" || exit $?
5734
5735      if test -n "$stripme" && test -n "$old_striplib"; then
5736        $show "$old_striplib $oldlib"
5737        $run eval "$old_striplib $oldlib" || exit $?
5738      fi
5739
5740      # Do each command in the postinstall commands.
5741      cmds=$old_postinstall_cmds
5742      save_ifs="$IFS"; IFS='~'
5743      for cmd in $cmds; do
5744        IFS="$save_ifs"
5745        eval cmd=\"$cmd\"
5746        $show "$cmd"
5747        $run eval "$cmd" || exit $?
5748      done
5749      IFS="$save_ifs"
5750    done
5751
5752    if test -n "$future_libdirs"; then
5753      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5754    fi
5755
5756    if test -n "$current_libdirs"; then
5757      # Maybe just do a dry run.
5758      test -n "$run" && current_libdirs=" -n$current_libdirs"
5759      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
5760    else
5761      exit $EXIT_SUCCESS
5762    fi
5763    ;;
5764
5765  # libtool finish mode
5766  finish)
5767    modename="$modename: finish"
5768    libdirs="$nonopt"
5769    admincmds=
5770
5771    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5772      for dir
5773      do
5774        libdirs="$libdirs $dir"
5775      done
5776
5777      for libdir in $libdirs; do
5778        if test -n "$finish_cmds"; then
5779          # Do each command in the finish commands.
5780          cmds=$finish_cmds
5781          save_ifs="$IFS"; IFS='~'
5782          for cmd in $cmds; do
5783            IFS="$save_ifs"
5784            eval cmd=\"$cmd\"
5785            $show "$cmd"
5786            $run eval "$cmd" || admincmds="$admincmds
5787       $cmd"
5788          done
5789          IFS="$save_ifs"
5790        fi
5791        if test -n "$finish_eval"; then
5792          # Do the single finish_eval.
5793          eval cmds=\"$finish_eval\"
5794          $run eval "$cmds" || admincmds="$admincmds
5795       $cmds"
5796        fi
5797      done
5798    fi
5799
5800    # Exit here if they wanted silent mode.
5801    test "$show" = : && exit $EXIT_SUCCESS
5802
5803    $echo "----------------------------------------------------------------------"
5804    $echo "Libraries have been installed in:"
5805    for libdir in $libdirs; do
5806      $echo "   $libdir"
5807    done
5808    $echo
5809    $echo "If you ever happen to want to link against installed libraries"
5810    $echo "in a given directory, LIBDIR, you must either use libtool, and"
5811    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5812    $echo "flag during linking and do at least one of the following:"
5813    if test -n "$shlibpath_var"; then
5814      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
5815      $echo "     during execution"
5816    fi
5817    if test -n "$runpath_var"; then
5818      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
5819      $echo "     during linking"
5820    fi
5821    if test -n "$hardcode_libdir_flag_spec"; then
5822      libdir=LIBDIR
5823      eval flag=\"$hardcode_libdir_flag_spec\"
5824
5825      $echo "   - use the \`$flag' linker flag"
5826    fi
5827    if test -n "$admincmds"; then
5828      $echo "   - have your system administrator run these commands:$admincmds"
5829    fi
5830    if test -f /etc/ld.so.conf; then
5831      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5832    fi
5833    $echo
5834    $echo "See any operating system documentation about shared libraries for"
5835    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5836    $echo "----------------------------------------------------------------------"
5837    exit $EXIT_SUCCESS
5838    ;;
5839
5840  # libtool execute mode
5841  execute)
5842    modename="$modename: execute"
5843
5844    # The first argument is the command name.
5845    cmd="$nonopt"
5846    if test -z "$cmd"; then
5847      $echo "$modename: you must specify a COMMAND" 1>&2
5848      $echo "$help"
5849      exit $EXIT_FAILURE
5850    fi
5851
5852    # Handle -dlopen flags immediately.
5853    for file in $execute_dlfiles; do
5854      if test ! -f "$file"; then
5855        $echo "$modename: \`$file' is not a file" 1>&2
5856        $echo "$help" 1>&2
5857        exit $EXIT_FAILURE
5858      fi
5859
5860      dir=
5861      case $file in
5862      *.la)
5863        # Check to see that this really is a libtool archive.
5864        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5865        else
5866          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5867          $echo "$help" 1>&2
5868          exit $EXIT_FAILURE
5869        fi
5870
5871        # Read the libtool library.
5872        dlname=
5873        library_names=
5874
5875        # If there is no directory component, then add one.
5876        case $file in
5877        */* | *\\*) . $file ;;
5878        *) . ./$file ;;
5879        esac
5880
5881        # Skip this library if it cannot be dlopened.
5882        if test -z "$dlname"; then
5883          # Warn if it was a shared library.
5884          test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5885          continue
5886        fi
5887
5888        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5889        test "X$dir" = "X$file" && dir=.
5890
5891        if test -f "$dir/$objdir/$dlname"; then
5892          dir="$dir/$objdir"
5893        else
5894          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5895          exit $EXIT_FAILURE
5896        fi
5897        ;;
5898
5899      *.lo)
5900        # Just add the directory containing the .lo file.
5901        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5902        test "X$dir" = "X$file" && dir=.
5903        ;;
5904
5905      *)
5906        $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5907        continue
5908        ;;
5909      esac
5910
5911      # Get the absolute pathname.
5912      absdir=`cd "$dir" && pwd`
5913      test -n "$absdir" && dir="$absdir"
5914
5915      # Now add the directory to shlibpath_var.
5916      if eval "test -z \"\$$shlibpath_var\""; then
5917        eval "$shlibpath_var=\"\$dir\""
5918      else
5919        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5920      fi
5921    done
5922
5923    # This variable tells wrapper scripts just to set shlibpath_var
5924    # rather than running their programs.
5925    libtool_execute_magic="$magic"
5926
5927    # Check if any of the arguments is a wrapper script.
5928    args=
5929    for file
5930    do
5931      case $file in
5932      -*) ;;
5933      *)
5934        # Do a test to see if this is really a libtool program.
5935        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5936          # If there is no directory component, then add one.
5937          case $file in
5938          */* | *\\*) . $file ;;
5939          *) . ./$file ;;
5940          esac
5941
5942          # Transform arg to wrapped name.
5943          file="$progdir/$program"
5944        fi
5945        ;;
5946      esac
5947      # Quote arguments (to preserve shell metacharacters).
5948      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5949      args="$args \"$file\""
5950    done
5951
5952    if test -z "$run"; then
5953      if test -n "$shlibpath_var"; then
5954        # Export the shlibpath_var.
5955        eval "export $shlibpath_var"
5956      fi
5957
5958      # Restore saved environment variables
5959      if test "${save_LC_ALL+set}" = set; then
5960        LC_ALL="$save_LC_ALL"; export LC_ALL
5961      fi
5962      if test "${save_LANG+set}" = set; then
5963        LANG="$save_LANG"; export LANG
5964      fi
5965
5966      # Now prepare to actually exec the command.
5967      exec_cmd="\$cmd$args"
5968    else
5969      # Display what would be done.
5970      if test -n "$shlibpath_var"; then
5971        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5972        $echo "export $shlibpath_var"
5973      fi
5974      $echo "$cmd$args"
5975      exit $EXIT_SUCCESS
5976    fi
5977    ;;
5978
5979  # libtool clean and uninstall mode
5980  clean | uninstall)
5981    modename="$modename: $mode"
5982    rm="$nonopt"
5983    files=
5984    rmforce=
5985    exit_status=0
5986
5987    # This variable tells wrapper scripts just to set variables rather
5988    # than running their programs.
5989    libtool_install_magic="$magic"
5990
5991    for arg
5992    do
5993      case $arg in
5994      -f) rm="$rm $arg"; rmforce=yes ;;
5995      -*) rm="$rm $arg" ;;
5996      *) files="$files $arg" ;;
5997      esac
5998    done
5999
6000    if test -z "$rm"; then
6001      $echo "$modename: you must specify an RM program" 1>&2
6002      $echo "$help" 1>&2
6003      exit $EXIT_FAILURE
6004    fi
6005
6006    rmdirs=
6007
6008    origobjdir="$objdir"
6009    for file in $files; do
6010      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6011      if test "X$dir" = "X$file"; then
6012        dir=.
6013        objdir="$origobjdir"
6014      else
6015        objdir="$dir/$origobjdir"
6016      fi
6017      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6018      test "$mode" = uninstall && objdir="$dir"
6019
6020      # Remember objdir for removal later, being careful to avoid duplicates
6021      if test "$mode" = clean; then
6022        case " $rmdirs " in
6023          *" $objdir "*) ;;
6024          *) rmdirs="$rmdirs $objdir" ;;
6025        esac
6026      fi
6027
6028      # Don't error if the file doesn't exist and rm -f was used.
6029      if (test -L "$file") >/dev/null 2>&1 \
6030        || (test -h "$file") >/dev/null 2>&1 \
6031        || test -f "$file"; then
6032        :
6033      elif test -d "$file"; then
6034        exit_status=1
6035        continue
6036      elif test "$rmforce" = yes; then
6037        continue
6038      fi
6039
6040      rmfiles="$file"
6041
6042      case $name in
6043      *.la)
6044        # Possibly a libtool archive, so verify it.
6045        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6046          . $dir/$name
6047
6048          # Delete the libtool libraries and symlinks.
6049          for n in $library_names; do
6050            rmfiles="$rmfiles $objdir/$n"
6051          done
6052          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6053          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6054
6055          if test "$mode" = uninstall; then
6056            if test -n "$library_names"; then
6057              # Do each command in the postuninstall commands.
6058              cmds=$postuninstall_cmds
6059              save_ifs="$IFS"; IFS='~'
6060              for cmd in $cmds; do
6061                IFS="$save_ifs"
6062                eval cmd=\"$cmd\"
6063                $show "$cmd"
6064                $run eval "$cmd"
6065                if test "$?" -ne 0 && test "$rmforce" != yes; then
6066                  exit_status=1
6067                fi
6068              done
6069              IFS="$save_ifs"
6070            fi
6071
6072            if test -n "$old_library"; then
6073              # Do each command in the old_postuninstall commands.
6074              cmds=$old_postuninstall_cmds
6075              save_ifs="$IFS"; IFS='~'
6076              for cmd in $cmds; do
6077                IFS="$save_ifs"
6078                eval cmd=\"$cmd\"
6079                $show "$cmd"
6080                $run eval "$cmd"
6081                if test "$?" -ne 0 && test "$rmforce" != yes; then
6082                  exit_status=1
6083                fi
6084              done
6085              IFS="$save_ifs"
6086            fi
6087            # FIXME: should reinstall the best remaining shared library.
6088          fi
6089        fi
6090        ;;
6091
6092      *.lo)
6093        # Possibly a libtool object, so verify it.
6094        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6095
6096          # Read the .lo file
6097          . $dir/$name
6098
6099          # Add PIC object to the list of files to remove.
6100          if test -n "$pic_object" \
6101             && test "$pic_object" != none; then
6102            rmfiles="$rmfiles $dir/$pic_object"
6103          fi
6104
6105          # Add non-PIC object to the list of files to remove.
6106          if test -n "$non_pic_object" \
6107             && test "$non_pic_object" != none; then
6108            rmfiles="$rmfiles $dir/$non_pic_object"
6109          fi
6110        fi
6111        ;;
6112
6113      *)
6114        if test "$mode" = clean ; then
6115          noexename=$name
6116          case $file in
6117          *.exe)
6118            file=`$echo $file|${SED} 's,.exe$,,'`
6119            noexename=`$echo $name|${SED} 's,.exe$,,'`
6120            # $file with .exe has already been added to rmfiles,
6121            # add $file without .exe
6122            rmfiles="$rmfiles $file"
6123            ;;
6124          esac
6125          # Do a test to see if this is a libtool program.
6126          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6127            relink_command=
6128            . $dir/$noexename
6129
6130            # note $name still contains .exe if it was in $file originally
6131            # as does the version of $file that was added into $rmfiles
6132            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6133            if test "$fast_install" = yes && test -n "$relink_command"; then
6134              rmfiles="$rmfiles $objdir/lt-$name"
6135            fi
6136            if test "X$noexename" != "X$name" ; then
6137              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6138            fi
6139          fi
6140        fi
6141        ;;
6142      esac
6143      $show "$rm $rmfiles"
6144      $run $rm $rmfiles || exit_status=1
6145    done
6146    objdir="$origobjdir"
6147
6148    # Try to remove the ${objdir}s in the directories where we deleted files
6149    for dir in $rmdirs; do
6150      if test -d "$dir"; then
6151        $show "rmdir $dir"
6152        $run rmdir $dir >/dev/null 2>&1
6153      fi
6154    done
6155
6156    exit $exit_status
6157    ;;
6158
6159  "")
6160    $echo "$modename: you must specify a MODE" 1>&2
6161    $echo "$generic_help" 1>&2
6162    exit $EXIT_FAILURE
6163    ;;
6164  esac
6165
6166  if test -z "$exec_cmd"; then
6167    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6168    $echo "$generic_help" 1>&2
6169    exit $EXIT_FAILURE
6170  fi
6171fi # test -z "$show_help"
6172
6173if test -n "$exec_cmd"; then
6174  eval exec $exec_cmd
6175  exit $EXIT_FAILURE
6176fi
6177
6178# We need to display help for each of the modes.
6179case $mode in
6180"") $echo \
6181"Usage: $modename [OPTION]... [MODE-ARG]...
6182
6183Provide generalized library-building support services.
6184
6185    --config          show all configuration variables
6186    --debug           enable verbose shell tracing
6187-n, --dry-run         display commands without modifying any files
6188    --features        display basic configuration information and exit
6189    --finish          same as \`--mode=finish'
6190    --help            display this help message and exit
6191    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
6192    --quiet           same as \`--silent'
6193    --silent          don't print informational messages
6194    --tag=TAG         use configuration variables from tag TAG
6195    --version         print version information
6196
6197MODE must be one of the following:
6198
6199      clean           remove files from the build directory
6200      compile         compile a source file into a libtool object
6201      execute         automatically set library path, then run a program
6202      finish          complete the installation of libtool libraries
6203      install         install libraries or executables
6204      link            create a library or an executable
6205      uninstall       remove libraries from an installed directory
6206
6207MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
6208a more detailed description of MODE.
6209
6210Report bugs to <bug-libtool@gnu.org>."
6211  exit $EXIT_SUCCESS
6212  ;;
6213
6214clean)
6215  $echo \
6216"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6217
6218Remove files from the build directory.
6219
6220RM is the name of the program to use to delete files associated with each FILE
6221(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6222to RM.
6223
6224If FILE is a libtool library, object or program, all the files associated
6225with it are deleted. Otherwise, only FILE itself is deleted using RM."
6226  ;;
6227
6228compile)
6229  $echo \
6230"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6231
6232Compile a source file into a libtool library object.
6233
6234This mode accepts the following additional options:
6235
6236  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
6237  -prefer-pic       try to building PIC objects only
6238  -prefer-non-pic   try to building non-PIC objects only
6239  -static           always build a \`.o' file suitable for static linking
6240
6241COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6242from the given SOURCEFILE.
6243
6244The output file name is determined by removing the directory component from
6245SOURCEFILE, then substituting the C source code suffix \`.c' with the
6246library object suffix, \`.lo'."
6247  ;;
6248
6249execute)
6250  $echo \
6251"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6252
6253Automatically set library path, then run a program.
6254
6255This mode accepts the following additional options:
6256
6257  -dlopen FILE      add the directory containing FILE to the library path
6258
6259This mode sets the library path environment variable according to \`-dlopen'
6260flags.
6261
6262If any of the ARGS are libtool executable wrappers, then they are translated
6263into their corresponding uninstalled binary, and any of their required library
6264directories are added to the library path.
6265
6266Then, COMMAND is executed, with ARGS as arguments."
6267  ;;
6268
6269finish)
6270  $echo \
6271"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6272
6273Complete the installation of libtool libraries.
6274
6275Each LIBDIR is a directory that contains libtool libraries.
6276
6277The commands that this mode executes may require superuser privileges.  Use
6278the \`--dry-run' option if you just want to see what would be executed."
6279  ;;
6280
6281install)
6282  $echo \
6283"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6284
6285Install executables or libraries.
6286
6287INSTALL-COMMAND is the installation command.  The first component should be
6288either the \`install' or \`cp' program.
6289
6290The rest of the components are interpreted as arguments to that command (only
6291BSD-compatible install options are recognized)."
6292  ;;
6293
6294link)
6295  $echo \
6296"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6297
6298Link object files or libraries together to form another library, or to
6299create an executable program.
6300
6301LINK-COMMAND is a command using the C compiler that you would use to create
6302a program from several object files.
6303
6304The following components of LINK-COMMAND are treated specially:
6305
6306  -all-static       do not do any dynamic linking at all
6307  -avoid-version    do not add a version suffix if possible
6308  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
6309  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6310  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6311  -export-symbols SYMFILE
6312                    try to export only the symbols listed in SYMFILE
6313  -export-symbols-regex REGEX
6314                    try to export only the symbols matching REGEX
6315  -LLIBDIR          search LIBDIR for required installed libraries
6316  -lNAME            OUTPUT-FILE requires the installed library libNAME
6317  -module           build a library that can dlopened
6318  -no-fast-install  disable the fast-install mode
6319  -no-install       link a not-installable executable
6320  -no-undefined     declare that a library does not refer to external symbols
6321  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6322  -objectlist FILE  Use a list of object files found in FILE to specify objects
6323  -precious-files-regex REGEX
6324                    don't remove output files matching REGEX
6325  -release RELEASE  specify package release information
6326  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6327  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6328  -static           do not do any dynamic linking of libtool libraries
6329  -version-info CURRENT[:REVISION[:AGE]]
6330                    specify library version info [each variable defaults to 0]
6331
6332All other options (arguments beginning with \`-') are ignored.
6333
6334Every other argument is treated as a filename.  Files ending in \`.la' are
6335treated as uninstalled libtool libraries, other files are standard or library
6336object files.
6337
6338If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6339only library objects (\`.lo' files) may be specified, and \`-rpath' is
6340required, except when creating a convenience library.
6341
6342If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6343using \`ar' and \`ranlib', or on Windows using \`lib'.
6344
6345If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6346is created, otherwise an executable program is created."
6347  ;;
6348
6349uninstall)
6350  $echo \
6351"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6352
6353Remove libraries from an installation directory.
6354
6355RM is the name of the program to use to delete files associated with each FILE
6356(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6357to RM.
6358
6359If FILE is a libtool library, all the files associated with it are deleted.
6360Otherwise, only FILE itself is deleted using RM."
6361  ;;
6362
6363*)
6364  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6365  $echo "$help" 1>&2
6366  exit $EXIT_FAILURE
6367  ;;
6368esac
6369
6370$echo
6371$echo "Try \`$modename --help' for more information about other modes."
6372
6373exit $EXIT_SUCCESS
6374
6375# The TAGs below are defined such that we never get into a situation
6376# in which we disable both kinds of libraries.  Given conflicting
6377# choices, we go for a static library, that is the most portable,
6378# since we can't tell whether shared libraries were disabled because
6379# the user asked for that or because the platform doesn't support
6380# them.  This is particularly important on AIX, because we don't
6381# support having both static and shared libraries enabled at the same
6382# time on that platform, so we default to a shared-only configuration.
6383# If a disable-shared tag is given, we'll fallback to a static-only
6384# configuration.  But we'll never go from static-only to shared-only.
6385
6386# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6387build_libtool_libs=no
6388build_old_libs=yes
6389# ### END LIBTOOL TAG CONFIG: disable-shared
6390
6391# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6392build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6393# ### END LIBTOOL TAG CONFIG: disable-static
6394
6395# Local Variables:
6396# mode:shell-script
6397# sh-indentation:2
6398# End:
Note: See TracBrowser for help on using the repository browser.