source: trunk/third/bind/ltmain.sh @ 21744

Revision 21744, 179.1 KB checked in by ghudson, 20 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r21743, 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        case "$archive_cmds" in
1492         *"\$LD"*) ;;
1493         *) deplibs="$deplibs $arg";;
1494        esac
1495        continue
1496        ;;
1497
1498      -module)
1499        module=yes
1500        continue
1501        ;;
1502
1503      # gcc -m* arguments should be passed to the linker via $compiler_flags
1504      # in order to pass architecture information to the linker
1505      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1506      # but this is not reliable with gcc because gcc may use -mfoo to
1507      # select a different linker, different libraries, etc, while
1508      # -Wl,-mfoo simply passes -mfoo to the linker.
1509      -m*)
1510        # Unknown arguments in both finalize_command and compile_command need
1511        # to be aesthetically quoted because they are evaled later.
1512        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1513        case $arg in
1514        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1515          arg="\"$arg\""
1516          ;;
1517        esac
1518        compile_command="$compile_command $arg"
1519        finalize_command="$finalize_command $arg"
1520        if test "$with_gcc" = "yes" ; then
1521          compiler_flags="$compiler_flags $arg"
1522        fi
1523        continue
1524        ;;
1525
1526      -shrext)
1527        prev=shrext
1528        continue
1529        ;;
1530
1531      -no-fast-install)
1532        fast_install=no
1533        continue
1534        ;;
1535
1536      -no-install)
1537        case $host in
1538        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1539          # The PATH hackery in wrapper scripts is required on Windows
1540          # in order for the loader to find any dlls it needs.
1541          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1542          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1543          fast_install=no
1544          ;;
1545        *) no_install=yes ;;
1546        esac
1547        continue
1548        ;;
1549
1550      -no-undefined)
1551        allow_undefined=no
1552        continue
1553        ;;
1554
1555      -objectlist)
1556        prev=objectlist
1557        continue
1558        ;;
1559
1560      -o) prev=output ;;
1561
1562      -precious-files-regex)
1563        prev=precious_regex
1564        continue
1565        ;;
1566
1567      -release)
1568        prev=release
1569        continue
1570        ;;
1571
1572      -rpath)
1573        prev=rpath
1574        continue
1575        ;;
1576
1577      -R)
1578        prev=xrpath
1579        continue
1580        ;;
1581
1582      -R*)
1583        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1584        # We need an absolute path.
1585        case $dir in
1586        [\\/]* | [A-Za-z]:[\\/]*) ;;
1587        *)
1588          $echo "$modename: only absolute run-paths are allowed" 1>&2
1589          exit $EXIT_FAILURE
1590          ;;
1591        esac
1592        case "$xrpath " in
1593        *" $dir "*) ;;
1594        *) xrpath="$xrpath $dir" ;;
1595        esac
1596        continue
1597        ;;
1598
1599      -static)
1600        # The effects of -static are defined in a previous loop.
1601        # We used to do the same as -all-static on platforms that
1602        # didn't have a PIC flag, but the assumption that the effects
1603        # would be equivalent was wrong.  It would break on at least
1604        # Digital Unix and AIX.
1605        continue
1606        ;;
1607
1608      -thread-safe)
1609        thread_safe=yes
1610        continue
1611        ;;
1612
1613      -version-info)
1614        prev=vinfo
1615        continue
1616        ;;
1617      -version-number)
1618        prev=vinfo
1619        vinfo_number=yes
1620        continue
1621        ;;
1622
1623      -Wc,*)
1624        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1625        arg=
1626        save_ifs="$IFS"; IFS=','
1627        for flag in $args; do
1628          IFS="$save_ifs"
1629          case $flag in
1630            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1631            flag="\"$flag\""
1632            ;;
1633          esac
1634          arg="$arg $wl$flag"
1635          compiler_flags="$compiler_flags $flag"
1636        done
1637        IFS="$save_ifs"
1638        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1639        ;;
1640
1641      -Wl,*)
1642        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1643        arg=
1644        save_ifs="$IFS"; IFS=','
1645        for flag in $args; do
1646          IFS="$save_ifs"
1647          case $flag in
1648            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1649            flag="\"$flag\""
1650            ;;
1651          esac
1652          arg="$arg $wl$flag"
1653          compiler_flags="$compiler_flags $wl$flag"
1654          linker_flags="$linker_flags $flag"
1655        done
1656        IFS="$save_ifs"
1657        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1658        ;;
1659
1660      -Xcompiler)
1661        prev=xcompiler
1662        continue
1663        ;;
1664
1665      -Xlinker)
1666        prev=xlinker
1667        continue
1668        ;;
1669
1670      -XCClinker)
1671        prev=xcclinker
1672        continue
1673        ;;
1674
1675      # Some other compiler flag.
1676      -* | +*)
1677        # Unknown arguments in both finalize_command and compile_command need
1678        # to be aesthetically quoted because they are evaled later.
1679        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1680        case $arg in
1681        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1682          arg="\"$arg\""
1683          ;;
1684        esac
1685        ;;
1686
1687      *.$objext)
1688        # A standard object.
1689        objs="$objs $arg"
1690        ;;
1691
1692      *.lo)
1693        # A libtool-controlled object.
1694
1695        # Check to see that this really is a libtool object.
1696        if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1697          pic_object=
1698          non_pic_object=
1699
1700          # Read the .lo file
1701          # If there is no directory component, then add one.
1702          case $arg in
1703          */* | *\\*) . $arg ;;
1704          *) . ./$arg ;;
1705          esac
1706
1707          if test -z "$pic_object" || \
1708             test -z "$non_pic_object" ||
1709             test "$pic_object" = none && \
1710             test "$non_pic_object" = none; then
1711            $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1712            exit $EXIT_FAILURE
1713          fi
1714
1715          # Extract subdirectory from the argument.
1716          xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1717          if test "X$xdir" = "X$arg"; then
1718            xdir=
1719          else
1720            xdir="$xdir/"
1721          fi
1722
1723          if test "$pic_object" != none; then
1724            # Prepend the subdirectory the object is found in.
1725            pic_object="$xdir$pic_object"
1726
1727            if test "$prev" = dlfiles; then
1728              if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1729                dlfiles="$dlfiles $pic_object"
1730                prev=
1731                continue
1732              else
1733                # If libtool objects are unsupported, then we need to preload.
1734                prev=dlprefiles
1735              fi
1736            fi
1737
1738            # CHECK ME:  I think I busted this.  -Ossama
1739            if test "$prev" = dlprefiles; then
1740              # Preload the old-style object.
1741              dlprefiles="$dlprefiles $pic_object"
1742              prev=
1743            fi
1744
1745            # A PIC object.
1746            libobjs="$libobjs $pic_object"
1747            arg="$pic_object"
1748          fi
1749
1750          # Non-PIC object.
1751          if test "$non_pic_object" != none; then
1752            # Prepend the subdirectory the object is found in.
1753            non_pic_object="$xdir$non_pic_object"
1754
1755            # A standard non-PIC object
1756            non_pic_objects="$non_pic_objects $non_pic_object"
1757            if test -z "$pic_object" || test "$pic_object" = none ; then
1758              arg="$non_pic_object"
1759            fi
1760          fi
1761        else
1762          # Only an error if not doing a dry-run.
1763          if test -z "$run"; then
1764            $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1765            exit $EXIT_FAILURE
1766          else
1767            # Dry-run case.
1768
1769            # Extract subdirectory from the argument.
1770            xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1771            if test "X$xdir" = "X$arg"; then
1772              xdir=
1773            else
1774              xdir="$xdir/"
1775            fi
1776
1777            pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1778            non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1779            libobjs="$libobjs $pic_object"
1780            non_pic_objects="$non_pic_objects $non_pic_object"
1781          fi
1782        fi
1783        ;;
1784
1785      *.$libext)
1786        # An archive.
1787        deplibs="$deplibs $arg"
1788        old_deplibs="$old_deplibs $arg"
1789        continue
1790        ;;
1791
1792      *.la)
1793        # A libtool-controlled library.
1794
1795        if test "$prev" = dlfiles; then
1796          # This library was specified with -dlopen.
1797          dlfiles="$dlfiles $arg"
1798          prev=
1799        elif test "$prev" = dlprefiles; then
1800          # The library was specified with -dlpreopen.
1801          dlprefiles="$dlprefiles $arg"
1802          prev=
1803        else
1804          deplibs="$deplibs $arg"
1805        fi
1806        continue
1807        ;;
1808
1809      # Some other compiler argument.
1810      *)
1811        # Unknown arguments in both finalize_command and compile_command need
1812        # to be aesthetically quoted because they are evaled later.
1813        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1814        case $arg in
1815        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1816          arg="\"$arg\""
1817          ;;
1818        esac
1819        ;;
1820      esac # arg
1821
1822      # Now actually substitute the argument into the commands.
1823      if test -n "$arg"; then
1824        compile_command="$compile_command $arg"
1825        finalize_command="$finalize_command $arg"
1826      fi
1827    done # argument parsing loop
1828
1829    if test -n "$prev"; then
1830      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1831      $echo "$help" 1>&2
1832      exit $EXIT_FAILURE
1833    fi
1834
1835    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1836      eval arg=\"$export_dynamic_flag_spec\"
1837      compile_command="$compile_command $arg"
1838      finalize_command="$finalize_command $arg"
1839    fi
1840
1841    oldlibs=
1842    # calculate the name of the file, without its directory
1843    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1844    libobjs_save="$libobjs"
1845
1846    if test -n "$shlibpath_var"; then
1847      # get the directories listed in $shlibpath_var
1848      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1849    else
1850      shlib_search_path=
1851    fi
1852    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1853    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1854
1855    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1856    if test "X$output_objdir" = "X$output"; then
1857      output_objdir="$objdir"
1858    else
1859      output_objdir="$output_objdir/$objdir"
1860    fi
1861    # Create the object directory.
1862    if test ! -d "$output_objdir"; then
1863      $show "$mkdir $output_objdir"
1864      $run $mkdir $output_objdir
1865      status=$?
1866      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1867        exit $status
1868      fi
1869    fi
1870
1871    # Determine the type of output
1872    case $output in
1873    "")
1874      $echo "$modename: you must specify an output file" 1>&2
1875      $echo "$help" 1>&2
1876      exit $EXIT_FAILURE
1877      ;;
1878    *.$libext) linkmode=oldlib ;;
1879    *.lo | *.$objext) linkmode=obj ;;
1880    *.la) linkmode=lib ;;
1881    *) linkmode=prog ;; # Anything else should be a program.
1882    esac
1883
1884    case $host in
1885    *cygwin* | *mingw* | *pw32*)
1886      # don't eliminate duplications in $postdeps and $predeps
1887      duplicate_compiler_generated_deps=yes
1888      ;;
1889    *)
1890      duplicate_compiler_generated_deps=$duplicate_deps
1891      ;;
1892    esac
1893    specialdeplibs=
1894
1895    libs=
1896    # Find all interdependent deplibs by searching for libraries
1897    # that are linked more than once (e.g. -la -lb -la)
1898    for deplib in $deplibs; do
1899      if test "X$duplicate_deps" = "Xyes" ; then
1900        case "$libs " in
1901        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1902        esac
1903      fi
1904      libs="$libs $deplib"
1905    done
1906
1907    if test "$linkmode" = lib; then
1908      libs="$predeps $libs $compiler_lib_search_path $postdeps"
1909
1910      # Compute libraries that are listed more than once in $predeps
1911      # $postdeps and mark them as special (i.e., whose duplicates are
1912      # not to be eliminated).
1913      pre_post_deps=
1914      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1915        for pre_post_dep in $predeps $postdeps; do
1916          case "$pre_post_deps " in
1917          *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1918          esac
1919          pre_post_deps="$pre_post_deps $pre_post_dep"
1920        done
1921      fi
1922      pre_post_deps=
1923    fi
1924
1925    deplibs=
1926    newdependency_libs=
1927    newlib_search_path=
1928    need_relink=no # whether we're linking any uninstalled libtool libraries
1929    notinst_deplibs= # not-installed libtool libraries
1930    notinst_path= # paths that contain not-installed libtool libraries
1931    case $linkmode in
1932    lib)
1933        passes="conv link"
1934        for file in $dlfiles $dlprefiles; do
1935          case $file in
1936          *.la) ;;
1937          *)
1938            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1939            exit $EXIT_FAILURE
1940            ;;
1941          esac
1942        done
1943        ;;
1944    prog)
1945        compile_deplibs=
1946        finalize_deplibs=
1947        alldeplibs=no
1948        newdlfiles=
1949        newdlprefiles=
1950        passes="conv scan dlopen dlpreopen link"
1951        ;;
1952    *)  passes="conv"
1953        ;;
1954    esac
1955    for pass in $passes; do
1956      if test "$linkmode,$pass" = "lib,link" ||
1957         test "$linkmode,$pass" = "prog,scan"; then
1958        libs="$deplibs"
1959        deplibs=
1960      fi
1961      if test "$linkmode" = prog; then
1962        case $pass in
1963        dlopen) libs="$dlfiles" ;;
1964        dlpreopen) libs="$dlprefiles" ;;
1965        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1966        esac
1967      fi
1968      if test "$pass" = dlopen; then
1969        # Collect dlpreopened libraries
1970        save_deplibs="$deplibs"
1971        deplibs=
1972      fi
1973      for deplib in $libs; do
1974        lib=
1975        found=no
1976        case $deplib in
1977        -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1978          if test "$linkmode,$pass" = "prog,link"; then
1979            compile_deplibs="$deplib $compile_deplibs"
1980            finalize_deplibs="$deplib $finalize_deplibs"
1981          else
1982            case "$archive_cmds" in
1983              *"\$LD"*) ;;
1984              *) deplibs="$deplibs $arg";;
1985            esac
1986          fi
1987          continue
1988          ;;
1989        -l*)
1990          if test "$linkmode" != lib && test "$linkmode" != prog; then
1991            $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1992            continue
1993          fi
1994          if test "$pass" = conv; then
1995            deplibs="$deplib $deplibs"
1996            continue
1997          fi
1998          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1999          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2000            for search_ext in .la $std_shrext .so .a; do
2001              # Search the libtool library
2002              lib="$searchdir/lib${name}${search_ext}"
2003              if test -f "$lib"; then
2004                if test "$search_ext" = ".la"; then
2005                  found=yes
2006                else
2007                  found=no
2008                fi
2009                break 2
2010              fi
2011            done
2012          done
2013          if test "$found" != yes; then
2014            # deplib doesn't seem to be a libtool library
2015            if test "$linkmode,$pass" = "prog,link"; then
2016              compile_deplibs="$deplib $compile_deplibs"
2017              finalize_deplibs="$deplib $finalize_deplibs"
2018            else
2019              deplibs="$deplib $deplibs"
2020              test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2021            fi
2022            continue
2023          else # deplib is a libtool library
2024            # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2025            # We need to do some special things here, and not later.
2026            if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2027              case " $predeps $postdeps " in
2028              *" $deplib "*)
2029                if (${SED} -e '2q' $lib |
2030                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2031                  library_names=
2032                  old_library=
2033                  case $lib in
2034                  */* | *\\*) . $lib ;;
2035                  *) . ./$lib ;;
2036                  esac
2037                  for l in $old_library $library_names; do
2038                    ll="$l"
2039                  done
2040                  if test "X$ll" = "X$old_library" ; then # only static version available
2041                    found=no
2042                    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2043                    test "X$ladir" = "X$lib" && ladir="."
2044                    lib=$ladir/$old_library
2045                    if test "$linkmode,$pass" = "prog,link"; then
2046                      compile_deplibs="$deplib $compile_deplibs"
2047                      finalize_deplibs="$deplib $finalize_deplibs"
2048                    else
2049                      deplibs="$deplib $deplibs"
2050                      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2051                    fi
2052                    continue
2053                  fi
2054                fi
2055                ;;
2056              *) ;;
2057              esac
2058            fi
2059          fi
2060          ;; # -l
2061        -L*)
2062          case $linkmode in
2063          lib)
2064            deplibs="$deplib $deplibs"
2065            test "$pass" = conv && continue
2066            newdependency_libs="$deplib $newdependency_libs"
2067            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2068            ;;
2069          prog)
2070            if test "$pass" = conv; then
2071              deplibs="$deplib $deplibs"
2072              continue
2073            fi
2074            if test "$pass" = scan; then
2075              deplibs="$deplib $deplibs"
2076            else
2077              compile_deplibs="$deplib $compile_deplibs"
2078              finalize_deplibs="$deplib $finalize_deplibs"
2079            fi
2080            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2081            ;;
2082          *)
2083            $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2084            ;;
2085          esac # linkmode
2086          continue
2087          ;; # -L
2088        -R*)
2089          if test "$pass" = link; then
2090            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2091            # Make sure the xrpath contains only unique directories.
2092            case "$xrpath " in
2093            *" $dir "*) ;;
2094            *) xrpath="$xrpath $dir" ;;
2095            esac
2096          fi
2097          deplibs="$deplib $deplibs"
2098          continue
2099          ;;
2100        *.la) lib="$deplib" ;;
2101        *.$libext)
2102          if test "$pass" = conv; then
2103            deplibs="$deplib $deplibs"
2104            continue
2105          fi
2106          case $linkmode in
2107          lib)
2108            valid_a_lib=no
2109            case $deplibs_check_method in
2110              match_pattern*)
2111                set dummy $deplibs_check_method
2112                match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2113                if eval $echo \"$deplib\" 2>/dev/null \
2114                    | $SED 10q \
2115                    | $EGREP "$match_pattern_regex" > /dev/null; then
2116                  valid_a_lib=yes
2117                fi
2118                ;;
2119              pass_all)
2120                valid_a_lib=yes
2121                ;;
2122            esac
2123            if test "$valid_a_lib" != yes; then
2124              $echo
2125              $echo "*** Warning: Trying to link with static lib archive $deplib."
2126              $echo "*** I have the capability to make that library automatically link in when"
2127              $echo "*** you link to this library.  But I can only do this if you have a"
2128              $echo "*** shared version of the library, which you do not appear to have"
2129              $echo "*** because the file extensions .$libext of this argument makes me believe"
2130              $echo "*** that it is just a static archive that I should not used here."
2131            else
2132              $echo
2133              $echo "*** Warning: Linking the shared library $output against the"
2134              $echo "*** static library $deplib is not portable!"
2135              deplibs="$deplib $deplibs"
2136            fi
2137            continue
2138            ;;
2139          prog)
2140            if test "$pass" != link; then
2141              deplibs="$deplib $deplibs"
2142            else
2143              compile_deplibs="$deplib $compile_deplibs"
2144              finalize_deplibs="$deplib $finalize_deplibs"
2145            fi
2146            continue
2147            ;;
2148          esac # linkmode
2149          ;; # *.$libext
2150        *.lo | *.$objext)
2151          if test "$pass" = conv; then
2152            deplibs="$deplib $deplibs"
2153          elif test "$linkmode" = prog; then
2154            if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2155              # If there is no dlopen support or we're linking statically,
2156              # we need to preload.
2157              newdlprefiles="$newdlprefiles $deplib"
2158              compile_deplibs="$deplib $compile_deplibs"
2159              finalize_deplibs="$deplib $finalize_deplibs"
2160            else
2161              newdlfiles="$newdlfiles $deplib"
2162            fi
2163          fi
2164          continue
2165          ;;
2166        %DEPLIBS%)
2167          alldeplibs=yes
2168          continue
2169          ;;
2170        esac # case $deplib
2171        if test "$found" = yes || test -f "$lib"; then :
2172        else
2173          $echo "$modename: cannot find the library \`$lib'" 1>&2
2174          exit $EXIT_FAILURE
2175        fi
2176
2177        # Check to see that this really is a libtool archive.
2178        if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2179        else
2180          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2181          exit $EXIT_FAILURE
2182        fi
2183
2184        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2185        test "X$ladir" = "X$lib" && ladir="."
2186
2187        dlname=
2188        dlopen=
2189        dlpreopen=
2190        libdir=
2191        library_names=
2192        old_library=
2193        # If the library was installed with an old release of libtool,
2194        # it will not redefine variables installed, or shouldnotlink
2195        installed=yes
2196        shouldnotlink=no
2197
2198        # Read the .la file
2199        case $lib in
2200        */* | *\\*) . $lib ;;
2201        *) . ./$lib ;;
2202        esac
2203
2204        if test "$linkmode,$pass" = "lib,link" ||
2205           test "$linkmode,$pass" = "prog,scan" ||
2206           { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2207          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2208          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2209        fi
2210
2211        if test "$pass" = conv; then
2212          # Only check for convenience libraries
2213          deplibs="$lib $deplibs"
2214          if test -z "$libdir"; then
2215            if test -z "$old_library"; then
2216              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2217              exit $EXIT_FAILURE
2218            fi
2219            # It is a libtool convenience library, so add in its objects.
2220            convenience="$convenience $ladir/$objdir/$old_library"
2221            old_convenience="$old_convenience $ladir/$objdir/$old_library"
2222            tmp_libs=
2223            for deplib in $dependency_libs; do
2224              deplibs="$deplib $deplibs"
2225              if test "X$duplicate_deps" = "Xyes" ; then
2226                case "$tmp_libs " in
2227                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2228                esac
2229              fi
2230              tmp_libs="$tmp_libs $deplib"
2231            done
2232          elif test "$linkmode" != prog && test "$linkmode" != lib; then
2233            $echo "$modename: \`$lib' is not a convenience library" 1>&2
2234            exit $EXIT_FAILURE
2235          fi
2236          continue
2237        fi # $pass = conv
2238
2239
2240        # Get the name of the library we link against.
2241        linklib=
2242        for l in $old_library $library_names; do
2243          linklib="$l"
2244        done
2245        if test -z "$linklib"; then
2246          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2247          exit $EXIT_FAILURE
2248        fi
2249
2250        # This library was specified with -dlopen.
2251        if test "$pass" = dlopen; then
2252          if test -z "$libdir"; then
2253            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2254            exit $EXIT_FAILURE
2255          fi
2256          if test -z "$dlname" ||
2257             test "$dlopen_support" != yes ||
2258             test "$build_libtool_libs" = no; then
2259            # If there is no dlname, no dlopen support or we're linking
2260            # statically, we need to preload.  We also need to preload any
2261            # dependent libraries so libltdl's deplib preloader doesn't
2262            # bomb out in the load deplibs phase.
2263            dlprefiles="$dlprefiles $lib $dependency_libs"
2264          else
2265            newdlfiles="$newdlfiles $lib"
2266          fi
2267          continue
2268        fi # $pass = dlopen
2269
2270        # We need an absolute path.
2271        case $ladir in
2272        [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2273        *)
2274          abs_ladir=`cd "$ladir" && pwd`
2275          if test -z "$abs_ladir"; then
2276            $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2277            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2278            abs_ladir="$ladir"
2279          fi
2280          ;;
2281        esac
2282        laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2283
2284        # Find the relevant object directory and library name.
2285        if test "X$installed" = Xyes; then
2286          if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2287            $echo "$modename: warning: library \`$lib' was moved." 1>&2
2288            dir="$ladir"
2289            absdir="$abs_ladir"
2290            libdir="$abs_ladir"
2291          else
2292            dir="$libdir"
2293            absdir="$libdir"
2294          fi
2295        else
2296          if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2297            dir="$ladir"
2298            absdir="$abs_ladir"
2299            # Remove this search path later
2300            notinst_path="$notinst_path $abs_ladir"
2301          else
2302            dir="$ladir/$objdir"
2303            absdir="$abs_ladir/$objdir"
2304            # Remove this search path later
2305            notinst_path="$notinst_path $abs_ladir"
2306          fi
2307        fi # $installed = yes
2308        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2309
2310        # This library was specified with -dlpreopen.
2311        if test "$pass" = dlpreopen; then
2312          if test -z "$libdir"; then
2313            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2314            exit $EXIT_FAILURE
2315          fi
2316          # Prefer using a static library (so that no silly _DYNAMIC symbols
2317          # are required to link).
2318          if test -n "$old_library"; then
2319            newdlprefiles="$newdlprefiles $dir/$old_library"
2320          # Otherwise, use the dlname, so that lt_dlopen finds it.
2321          elif test -n "$dlname"; then
2322            newdlprefiles="$newdlprefiles $dir/$dlname"
2323          else
2324            newdlprefiles="$newdlprefiles $dir/$linklib"
2325          fi
2326        fi # $pass = dlpreopen
2327
2328        if test -z "$libdir"; then
2329          # Link the convenience library
2330          if test "$linkmode" = lib; then
2331            deplibs="$dir/$old_library $deplibs"
2332          elif test "$linkmode,$pass" = "prog,link"; then
2333            compile_deplibs="$dir/$old_library $compile_deplibs"
2334            finalize_deplibs="$dir/$old_library $finalize_deplibs"
2335          else
2336            deplibs="$lib $deplibs" # used for prog,scan pass
2337          fi
2338          continue
2339        fi
2340
2341
2342        if test "$linkmode" = prog && test "$pass" != link; then
2343          newlib_search_path="$newlib_search_path $ladir"
2344          deplibs="$lib $deplibs"
2345
2346          linkalldeplibs=no
2347          if test "$link_all_deplibs" != no || test -z "$library_names" ||
2348             test "$build_libtool_libs" = no; then
2349            linkalldeplibs=yes
2350          fi
2351
2352          tmp_libs=
2353          for deplib in $dependency_libs; do
2354            case $deplib in
2355            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2356            esac
2357            # Need to link against all dependency_libs?
2358            if test "$linkalldeplibs" = yes; then
2359              deplibs="$deplib $deplibs"
2360            else
2361              # Need to hardcode shared library paths
2362              # or/and link against static libraries
2363              newdependency_libs="$deplib $newdependency_libs"
2364            fi
2365            if test "X$duplicate_deps" = "Xyes" ; then
2366              case "$tmp_libs " in
2367              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2368              esac
2369            fi
2370            tmp_libs="$tmp_libs $deplib"
2371          done # for deplib
2372          continue
2373        fi # $linkmode = prog...
2374
2375        if test "$linkmode,$pass" = "prog,link"; then
2376          if test -n "$library_names" &&
2377             { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2378            # We need to hardcode the library path
2379            if test -n "$shlibpath_var"; then
2380              # Make sure the rpath contains only unique directories.
2381              case "$temp_rpath " in
2382              *" $dir "*) ;;
2383              *" $absdir "*) ;;
2384              *) temp_rpath="$temp_rpath $dir" ;;
2385              esac
2386            fi
2387
2388            # Hardcode the library path.
2389            # Skip directories that are in the system default run-time
2390            # search path.
2391            case " $sys_lib_dlsearch_path " in
2392            *" $absdir "*) ;;
2393            *)
2394              case "$compile_rpath " in
2395              *" $absdir "*) ;;
2396              *) compile_rpath="$compile_rpath $absdir"
2397              esac
2398              ;;
2399            esac
2400            case " $sys_lib_dlsearch_path " in
2401            *" $libdir "*) ;;
2402            *)
2403              case "$finalize_rpath " in
2404              *" $libdir "*) ;;
2405              *) finalize_rpath="$finalize_rpath $libdir"
2406              esac
2407              ;;
2408            esac
2409          fi # $linkmode,$pass = prog,link...
2410
2411          if test "$alldeplibs" = yes &&
2412             { test "$deplibs_check_method" = pass_all ||
2413               { test "$build_libtool_libs" = yes &&
2414                 test -n "$library_names"; }; }; then
2415            # We only need to search for static libraries
2416            continue
2417          fi
2418        fi
2419
2420        link_static=no # Whether the deplib will be linked statically
2421        if test -n "$library_names" &&
2422           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2423          if test "$installed" = no; then
2424            notinst_deplibs="$notinst_deplibs $lib"
2425            need_relink=yes
2426          fi
2427          # This is a shared library
2428
2429          # Warn about portability, can't link against -module's on
2430          # some systems (darwin)
2431          if test "$shouldnotlink" = yes && test "$pass" = link ; then
2432            $echo
2433            if test "$linkmode" = prog; then
2434              $echo "*** Warning: Linking the executable $output against the loadable module"
2435            else
2436              $echo "*** Warning: Linking the shared library $output against the loadable module"
2437            fi
2438            $echo "*** $linklib is not portable!"
2439          fi
2440          if test "$linkmode" = lib &&
2441             test "$hardcode_into_libs" = yes; then
2442            # Hardcode the library path.
2443            # Skip directories that are in the system default run-time
2444            # search path.
2445            case " $sys_lib_dlsearch_path " in
2446            *" $absdir "*) ;;
2447            *)
2448              case "$compile_rpath " in
2449              *" $absdir "*) ;;
2450              *) compile_rpath="$compile_rpath $absdir"
2451              esac
2452              ;;
2453            esac
2454            case " $sys_lib_dlsearch_path " in
2455            *" $libdir "*) ;;
2456            *)
2457              case "$finalize_rpath " in
2458              *" $libdir "*) ;;
2459              *) finalize_rpath="$finalize_rpath $libdir"
2460              esac
2461              ;;
2462            esac
2463          fi
2464
2465          if test -n "$old_archive_from_expsyms_cmds"; then
2466            # figure out the soname
2467            set dummy $library_names
2468            realname="$2"
2469            shift; shift
2470            libname=`eval \\$echo \"$libname_spec\"`
2471            # use dlname if we got it. it's perfectly good, no?
2472            if test -n "$dlname"; then
2473              soname="$dlname"
2474            elif test -n "$soname_spec"; then
2475              # bleh windows
2476              case $host in
2477              *cygwin* | mingw*)
2478                major=`expr $current - $age`
2479                versuffix="-$major"
2480                ;;
2481              esac
2482              eval soname=\"$soname_spec\"
2483            else
2484              soname="$realname"
2485            fi
2486
2487            # Make a new name for the extract_expsyms_cmds to use
2488            soroot="$soname"
2489            soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2490            newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2491
2492            # If the library has no export list, then create one now
2493            if test -f "$output_objdir/$soname-def"; then :
2494            else
2495              $show "extracting exported symbol list from \`$soname'"
2496              save_ifs="$IFS"; IFS='~'
2497              cmds=$extract_expsyms_cmds
2498              for cmd in $cmds; do
2499                IFS="$save_ifs"
2500                eval cmd=\"$cmd\"
2501                $show "$cmd"
2502                $run eval "$cmd" || exit $?
2503              done
2504              IFS="$save_ifs"
2505            fi
2506
2507            # Create $newlib
2508            if test -f "$output_objdir/$newlib"; then :; else
2509              $show "generating import library for \`$soname'"
2510              save_ifs="$IFS"; IFS='~'
2511              cmds=$old_archive_from_expsyms_cmds
2512              for cmd in $cmds; do
2513                IFS="$save_ifs"
2514                eval cmd=\"$cmd\"
2515                $show "$cmd"
2516                $run eval "$cmd" || exit $?
2517              done
2518              IFS="$save_ifs"
2519            fi
2520            # make sure the library variables are pointing to the new library
2521            dir=$output_objdir
2522            linklib=$newlib
2523          fi # test -n "$old_archive_from_expsyms_cmds"
2524
2525          if test "$linkmode" = prog || test "$mode" != relink; then
2526            add_shlibpath=
2527            add_dir=
2528            add=
2529            lib_linked=yes
2530            case $hardcode_action in
2531            immediate | unsupported)
2532              if test "$hardcode_direct" = no; then
2533                add="$dir/$linklib"
2534                case $host in
2535                  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2536                  *-*-darwin* )
2537                    # if the lib is a module then we can not link against
2538                    # it, someone is ignoring the new warnings I added
2539                    if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then
2540                      $echo "** Warning, lib $linklib is a module, not a shared library"
2541                      if test -z "$old_library" ; then
2542                        $echo
2543                        $echo "** And there doesn't seem to be a static archive available"
2544                        $echo "** The link will probably fail, sorry"
2545                      else
2546                        add="$dir/$old_library"
2547                      fi
2548                    fi
2549                esac
2550              elif test "$hardcode_minus_L" = no; then
2551                case $host in
2552                *-*-sunos*) add_shlibpath="$dir" ;;
2553                esac
2554                add_dir="-L$dir"
2555                add="-l$name"
2556              elif test "$hardcode_shlibpath_var" = no; then
2557                add_shlibpath="$dir"
2558                add="-l$name"
2559              else
2560                lib_linked=no
2561              fi
2562              ;;
2563            relink)
2564              if test "$hardcode_direct" = yes; then
2565                add="$dir/$linklib"
2566              elif test "$hardcode_minus_L" = yes; then
2567                add_dir="-L$dir"
2568                # Try looking first in the location we're being installed to.
2569                if test -n "$inst_prefix_dir"; then
2570                  case "$libdir" in
2571                    [\\/]*)
2572                      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2573                      ;;
2574                  esac
2575                fi
2576                add="-l$name"
2577              elif test "$hardcode_shlibpath_var" = yes; then
2578                add_shlibpath="$dir"
2579                add="-l$name"
2580              else
2581                lib_linked=no
2582              fi
2583              ;;
2584            *) lib_linked=no ;;
2585            esac
2586
2587            if test "$lib_linked" != yes; then
2588              $echo "$modename: configuration error: unsupported hardcode properties"
2589              exit $EXIT_FAILURE
2590            fi
2591
2592            if test -n "$add_shlibpath"; then
2593              case :$compile_shlibpath: in
2594              *":$add_shlibpath:"*) ;;
2595              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2596              esac
2597            fi
2598            if test "$linkmode" = prog; then
2599              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2600              test -n "$add" && compile_deplibs="$add $compile_deplibs"
2601            else
2602              test -n "$add_dir" && deplibs="$add_dir $deplibs"
2603              test -n "$add" && deplibs="$add $deplibs"
2604              if test "$hardcode_direct" != yes && \
2605                 test "$hardcode_minus_L" != yes && \
2606                 test "$hardcode_shlibpath_var" = yes; then
2607                case :$finalize_shlibpath: in
2608                *":$libdir:"*) ;;
2609                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2610                esac
2611              fi
2612            fi
2613          fi
2614
2615          if test "$linkmode" = prog || test "$mode" = relink; then
2616            add_shlibpath=
2617            add_dir=
2618            add=
2619            # Finalize command for both is simple: just hardcode it.
2620            if test "$hardcode_direct" = yes; then
2621              add="$libdir/$linklib"
2622            elif test "$hardcode_minus_L" = yes; then
2623              add_dir="-L$libdir"
2624              add="-l$name"
2625            elif test "$hardcode_shlibpath_var" = yes; then
2626              case :$finalize_shlibpath: in
2627              *":$libdir:"*) ;;
2628              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2629              esac
2630              add="-l$name"
2631            elif test "$hardcode_automatic" = yes; then
2632              if test -n "$inst_prefix_dir" &&
2633                 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2634                add="$inst_prefix_dir$libdir/$linklib"
2635              else
2636                add="$libdir/$linklib"
2637              fi
2638            else
2639              # We cannot seem to hardcode it, guess we'll fake it.
2640              add_dir="-L$libdir"
2641              # Try looking first in the location we're being installed to.
2642              if test -n "$inst_prefix_dir"; then
2643                case "$libdir" in
2644                  [\\/]*)
2645                    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2646                    ;;
2647                esac
2648              fi
2649              add="-l$name"
2650            fi
2651
2652            if test "$linkmode" = prog; then
2653              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2654              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2655            else
2656              test -n "$add_dir" && deplibs="$add_dir $deplibs"
2657              test -n "$add" && deplibs="$add $deplibs"
2658            fi
2659          fi
2660        elif test "$linkmode" = prog; then
2661          # Here we assume that one of hardcode_direct or hardcode_minus_L
2662          # is not unsupported.  This is valid on all known static and
2663          # shared platforms.
2664          if test "$hardcode_direct" != unsupported; then
2665            test -n "$old_library" && linklib="$old_library"
2666            compile_deplibs="$dir/$linklib $compile_deplibs"
2667            finalize_deplibs="$dir/$linklib $finalize_deplibs"
2668          else
2669            compile_deplibs="-l$name -L$dir $compile_deplibs"
2670            finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2671          fi
2672        elif test "$build_libtool_libs" = yes; then
2673          # Not a shared library
2674          if test "$deplibs_check_method" != pass_all; then
2675            # We're trying link a shared library against a static one
2676            # but the system doesn't support it.
2677
2678            # Just print a warning and add the library to dependency_libs so
2679            # that the program can be linked against the static library.
2680            $echo
2681            $echo "*** Warning: This system can not link to static lib archive $lib."
2682            $echo "*** I have the capability to make that library automatically link in when"
2683            $echo "*** you link to this library.  But I can only do this if you have a"
2684            $echo "*** shared version of the library, which you do not appear to have."
2685            if test "$module" = yes; then
2686              $echo "*** But as you try to build a module library, libtool will still create "
2687              $echo "*** a static module, that should work as long as the dlopening application"
2688              $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2689              if test -z "$global_symbol_pipe"; then
2690                $echo
2691                $echo "*** However, this would only work if libtool was able to extract symbol"
2692                $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2693                $echo "*** not find such a program.  So, this module is probably useless."
2694                $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2695              fi
2696              if test "$build_old_libs" = no; then
2697                build_libtool_libs=module
2698                build_old_libs=yes
2699              else
2700                build_libtool_libs=no
2701              fi
2702            fi
2703          else
2704            convenience="$convenience $dir/$old_library"
2705            old_convenience="$old_convenience $dir/$old_library"
2706            deplibs="$dir/$old_library $deplibs"
2707            link_static=yes
2708          fi
2709        fi # link shared/static library?
2710
2711        if test "$linkmode" = lib; then
2712          if test -n "$dependency_libs" &&
2713             { test "$hardcode_into_libs" != yes ||
2714               test "$build_old_libs" = yes ||
2715               test "$link_static" = yes; }; then
2716            # Extract -R from dependency_libs
2717            temp_deplibs=
2718            for libdir in $dependency_libs; do
2719              case $libdir in
2720              -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2721                   case " $xrpath " in
2722                   *" $temp_xrpath "*) ;;
2723                   *) xrpath="$xrpath $temp_xrpath";;
2724                   esac;;
2725              *) temp_deplibs="$temp_deplibs $libdir";;
2726              esac
2727            done
2728            dependency_libs="$temp_deplibs"
2729          fi
2730
2731          newlib_search_path="$newlib_search_path $absdir"
2732          # Link against this library
2733          test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2734          # ... and its dependency_libs
2735          tmp_libs=
2736          for deplib in $dependency_libs; do
2737            newdependency_libs="$deplib $newdependency_libs"
2738            if test "X$duplicate_deps" = "Xyes" ; then
2739              case "$tmp_libs " in
2740              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2741              esac
2742            fi
2743            tmp_libs="$tmp_libs $deplib"
2744          done
2745
2746          if test "$link_all_deplibs" != no; then
2747            # Add the search paths of all dependency libraries
2748            for deplib in $dependency_libs; do
2749              case $deplib in
2750              -L*) path="$deplib" ;;
2751              *.la)
2752                dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2753                test "X$dir" = "X$deplib" && dir="."
2754                # We need an absolute path.
2755                case $dir in
2756                [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2757                *)
2758                  absdir=`cd "$dir" && pwd`
2759                  if test -z "$absdir"; then
2760                    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2761                    absdir="$dir"
2762                  fi
2763                  ;;
2764                esac
2765                if grep "^installed=no" $deplib > /dev/null; then
2766                  path="$absdir/$objdir"
2767                else
2768                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2769                  if test -z "$libdir"; then
2770                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2771                    exit $EXIT_FAILURE
2772                  fi
2773                  if test "$absdir" != "$libdir"; then
2774                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2775                  fi
2776                  path="$absdir"
2777                fi
2778                depdepl=
2779                case $host in
2780                *-*-darwin*)
2781                  # we do not want to link against static libs,
2782                  # but need to link against shared
2783                  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2784                  if test -n "$deplibrary_names" ; then
2785                    for tmp in $deplibrary_names ; do
2786                      depdepl=$tmp
2787                    done
2788                    if test -f "$path/$depdepl" ; then
2789                      depdepl="$path/$depdepl"
2790                    fi
2791                    # do not add paths which are already there
2792                    case " $newlib_search_path " in
2793                    *" $path "*) ;;
2794                    *) newlib_search_path="$newlib_search_path $path";;
2795                    esac
2796                  fi
2797                  path=""
2798                  ;;
2799                *)
2800                  path="-L$path"
2801                  ;;
2802                esac
2803                ;;
2804              -l*)
2805                case $host in
2806                *-*-darwin*)
2807                  # Again, we only want to link against shared libraries
2808                  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2809                  for tmp in $newlib_search_path ; do
2810                    if test -f "$tmp/lib$tmp_libs.dylib" ; then
2811                      eval depdepl="$tmp/lib$tmp_libs.dylib"
2812                      break
2813                    fi
2814                  done
2815                  path=""
2816                  ;;
2817                *) continue ;;
2818                esac
2819                ;;
2820              *) continue ;;
2821              esac
2822              case " $deplibs " in
2823              *" $depdepl "*) ;;
2824              *) deplibs="$depdepl $deplibs" ;;
2825              esac
2826              case " $deplibs " in
2827              *" $path "*) ;;
2828              *) deplibs="$deplibs $path" ;;
2829              esac
2830            done
2831          fi # link_all_deplibs != no
2832        fi # linkmode = lib
2833      done # for deplib in $libs
2834      dependency_libs="$newdependency_libs"
2835      if test "$pass" = dlpreopen; then
2836        # Link the dlpreopened libraries before other libraries
2837        for deplib in $save_deplibs; do
2838          deplibs="$deplib $deplibs"
2839        done
2840      fi
2841      if test "$pass" != dlopen; then
2842        if test "$pass" != conv; then
2843          # Make sure lib_search_path contains only unique directories.
2844          lib_search_path=
2845          for dir in $newlib_search_path; do
2846            case "$lib_search_path " in
2847            *" $dir "*) ;;
2848            *) lib_search_path="$lib_search_path $dir" ;;
2849            esac
2850          done
2851          newlib_search_path=
2852        fi
2853
2854        if test "$linkmode,$pass" != "prog,link"; then
2855          vars="deplibs"
2856        else
2857          vars="compile_deplibs finalize_deplibs"
2858        fi
2859        for var in $vars dependency_libs; do
2860          # Add libraries to $var in reverse order
2861          eval tmp_libs=\"\$$var\"
2862          new_libs=
2863          for deplib in $tmp_libs; do
2864            # FIXME: Pedantically, this is the right thing to do, so
2865            #        that some nasty dependency loop isn't accidentally
2866            #        broken:
2867            #new_libs="$deplib $new_libs"
2868            # Pragmatically, this seems to cause very few problems in
2869            # practice:
2870            case $deplib in
2871            -L*) new_libs="$deplib $new_libs" ;;
2872            -R*) ;;
2873            *)
2874              # And here is the reason: when a library appears more
2875              # than once as an explicit dependence of a library, or
2876              # is implicitly linked in more than once by the
2877              # compiler, it is considered special, and multiple
2878              # occurrences thereof are not removed.  Compare this
2879              # with having the same library being listed as a
2880              # dependency of multiple other libraries: in this case,
2881              # we know (pedantically, we assume) the library does not
2882              # need to be listed more than once, so we keep only the
2883              # last copy.  This is not always right, but it is rare
2884              # enough that we require users that really mean to play
2885              # such unportable linking tricks to link the library
2886              # using -Wl,-lname, so that libtool does not consider it
2887              # for duplicate removal.
2888              case " $specialdeplibs " in
2889              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2890              *)
2891                case " $new_libs " in
2892                *" $deplib "*) ;;
2893                *) new_libs="$deplib $new_libs" ;;
2894                esac
2895                ;;
2896              esac
2897              ;;
2898            esac
2899          done
2900          tmp_libs=
2901          for deplib in $new_libs; do
2902            case $deplib in
2903            -L*)
2904              case " $tmp_libs " in
2905              *" $deplib "*) ;;
2906              *) tmp_libs="$tmp_libs $deplib" ;;
2907              esac
2908              ;;
2909            *) tmp_libs="$tmp_libs $deplib" ;;
2910            esac
2911          done
2912          eval $var=\"$tmp_libs\"
2913        done # for var
2914      fi
2915      # Last step: remove runtime libs from dependency_libs
2916      # (they stay in deplibs)
2917      tmp_libs=
2918      for i in $dependency_libs ; do
2919        case " $predeps $postdeps $compiler_lib_search_path " in
2920        *" $i "*)
2921          i=""
2922          ;;
2923        esac
2924        if test -n "$i" ; then
2925          tmp_libs="$tmp_libs $i"
2926        fi
2927      done
2928      dependency_libs=$tmp_libs
2929    done # for pass
2930    if test "$linkmode" = prog; then
2931      dlfiles="$newdlfiles"
2932      dlprefiles="$newdlprefiles"
2933    fi
2934
2935    case $linkmode in
2936    oldlib)
2937      if test -n "$deplibs"; then
2938        $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2939      fi
2940
2941      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2942        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2943      fi
2944
2945      if test -n "$rpath"; then
2946        $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2947      fi
2948
2949      if test -n "$xrpath"; then
2950        $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2951      fi
2952
2953      if test -n "$vinfo"; then
2954        $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2955      fi
2956
2957      if test -n "$release"; then
2958        $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2959      fi
2960
2961      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2962        $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2963      fi
2964
2965      # Now set the variables for building old libraries.
2966      build_libtool_libs=no
2967      oldlibs="$output"
2968      objs="$objs$old_deplibs"
2969      ;;
2970
2971    lib)
2972      # Make sure we only generate libraries of the form `libNAME.la'.
2973      case $outputname in
2974      lib*)
2975        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2976        eval shared_ext=\"$shrext_cmds\"
2977        eval libname=\"$libname_spec\"
2978        ;;
2979      *)
2980        if test "$module" = no; then
2981          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2982          $echo "$help" 1>&2
2983          exit $EXIT_FAILURE
2984        fi
2985        if test "$need_lib_prefix" != no; then
2986          # Add the "lib" prefix for modules if required
2987          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2988          eval shared_ext=\"$shrext_cmds\"
2989          eval libname=\"$libname_spec\"
2990        else
2991          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2992        fi
2993        ;;
2994      esac
2995
2996      if test -n "$objs"; then
2997        if test "$deplibs_check_method" != pass_all; then
2998          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2999          exit $EXIT_FAILURE
3000        else
3001          $echo
3002          $echo "*** Warning: Linking the shared library $output against the non-libtool"
3003          $echo "*** objects $objs is not portable!"
3004          libobjs="$libobjs $objs"
3005        fi
3006      fi
3007
3008      if test "$dlself" != no; then
3009        $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3010      fi
3011
3012      set dummy $rpath
3013      if test "$#" -gt 2; then
3014        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3015      fi
3016      install_libdir="$2"
3017
3018      oldlibs=
3019      if test -z "$rpath"; then
3020        if test "$build_libtool_libs" = yes; then
3021          # Building a libtool convenience library.
3022          # Some compilers have problems with a `.al' extension so
3023          # convenience libraries should have the same extension an
3024          # archive normally would.
3025          oldlibs="$output_objdir/$libname.$libext $oldlibs"
3026          build_libtool_libs=convenience
3027          build_old_libs=yes
3028        fi
3029
3030        if test -n "$vinfo"; then
3031          $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3032        fi
3033
3034        if test -n "$release"; then
3035          $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3036        fi
3037      else
3038
3039        # Parse the version information argument.
3040        save_ifs="$IFS"; IFS=':'
3041        set dummy $vinfo 0 0 0
3042        IFS="$save_ifs"
3043
3044        if test -n "$8"; then
3045          $echo "$modename: too many parameters to \`-version-info'" 1>&2
3046          $echo "$help" 1>&2
3047          exit $EXIT_FAILURE
3048        fi
3049
3050        # convert absolute version numbers to libtool ages
3051        # this retains compatibility with .la files and attempts
3052        # to make the code below a bit more comprehensible
3053
3054        case $vinfo_number in
3055        yes)
3056          number_major="$2"
3057          number_minor="$3"
3058          number_revision="$4"
3059          #
3060          # There are really only two kinds -- those that
3061          # use the current revision as the major version
3062          # and those that subtract age and use age as
3063          # a minor version.  But, then there is irix
3064          # which has an extra 1 added just for fun
3065          #
3066          case $version_type in
3067          darwin|linux|osf|windows)
3068            current=`expr $number_major + $number_minor`
3069            age="$number_minor"
3070            revision="$number_revision"
3071            ;;
3072          freebsd-aout|freebsd-elf|sunos)
3073            current="$number_major"
3074            revision="$number_minor"
3075            age="0"
3076            ;;
3077          irix|nonstopux)
3078            current=`expr $number_major + $number_minor - 1`
3079            age="$number_minor"
3080            revision="$number_minor"
3081            ;;
3082          esac
3083          ;;
3084        no)
3085          current="$2"
3086          revision="$3"
3087          age="$4"
3088          ;;
3089        esac
3090
3091        # Check that each of the things are valid numbers.
3092        case $current in
3093        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3094        *)
3095          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
3096          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3097          exit $EXIT_FAILURE
3098          ;;
3099        esac
3100
3101        case $revision in
3102        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3103        *)
3104          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
3105          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3106          exit $EXIT_FAILURE
3107          ;;
3108        esac
3109
3110        case $age in
3111        0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
3112        *)
3113          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
3114          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3115          exit $EXIT_FAILURE
3116          ;;
3117        esac
3118
3119        if test "$age" -gt "$current"; then
3120          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3121          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3122          exit $EXIT_FAILURE
3123        fi
3124
3125        # Calculate the version variables.
3126        major=
3127        versuffix=
3128        verstring=
3129        case $version_type in
3130        none) ;;
3131
3132        darwin)
3133          # Like Linux, but with the current version available in
3134          # verstring for coding it into the library header
3135          major=.`expr $current - $age`
3136          versuffix="$major.$age.$revision"
3137          # Darwin ld doesn't like 0 for these options...
3138          minor_current=`expr $current + 1`
3139          verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3140          ;;
3141
3142        freebsd-aout)
3143          major=".$current"
3144          versuffix=".$current.$revision";
3145          ;;
3146
3147        freebsd-elf)
3148          major=".$current"
3149          versuffix=".$current";
3150          ;;
3151
3152        irix | nonstopux)
3153          major=`expr $current - $age + 1`
3154
3155          case $version_type in
3156            nonstopux) verstring_prefix=nonstopux ;;
3157            *)         verstring_prefix=sgi ;;
3158          esac
3159          verstring="$verstring_prefix$major.$revision"
3160
3161          # Add in all the interfaces that we are compatible with.
3162          loop=$revision
3163          while test "$loop" -ne 0; do
3164            iface=`expr $revision - $loop`
3165            loop=`expr $loop - 1`
3166            verstring="$verstring_prefix$major.$iface:$verstring"
3167          done
3168
3169          # Before this point, $major must not contain `.'.
3170          major=.$major
3171          versuffix="$major.$revision"
3172          ;;
3173
3174        linux)
3175          major=.`expr $current - $age`
3176          versuffix="$major.$age.$revision"
3177          ;;
3178
3179        osf)
3180          major=.`expr $current - $age`
3181          versuffix=".$current.$age.$revision"
3182          verstring="$current.$age.$revision"
3183
3184          # Add in all the interfaces that we are compatible with.
3185          loop=$age
3186          while test "$loop" -ne 0; do
3187            iface=`expr $current - $loop`
3188            loop=`expr $loop - 1`
3189            verstring="$verstring:${iface}.0"
3190          done
3191
3192          # Make executables depend on our current version.
3193          verstring="$verstring:${current}.0"
3194          ;;
3195
3196        sunos)
3197          major=".$current"
3198          versuffix=".$current.$revision"
3199          ;;
3200
3201        windows)
3202          # Use '-' rather than '.', since we only want one
3203          # extension on DOS 8.3 filesystems.
3204          major=`expr $current - $age`
3205          versuffix="-$major"
3206          ;;
3207
3208        *)
3209          $echo "$modename: unknown library version type \`$version_type'" 1>&2
3210          $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3211          exit $EXIT_FAILURE
3212          ;;
3213        esac
3214
3215        # Clear the version info if we defaulted, and they specified a release.
3216        if test -z "$vinfo" && test -n "$release"; then
3217          major=
3218          case $version_type in
3219          darwin)
3220            # we can't check for "0.0" in archive_cmds due to quoting
3221            # problems, so we reset it completely
3222            verstring=
3223            ;;
3224          *)
3225            verstring="0.0"
3226            ;;
3227          esac
3228          if test "$need_version" = no; then
3229            versuffix=
3230          else
3231            versuffix=".0.0"
3232          fi
3233        fi
3234
3235        # Remove version info from name if versioning should be avoided
3236        if test "$avoid_version" = yes && test "$need_version" = no; then
3237          major=
3238          versuffix=
3239          verstring=""
3240        fi
3241
3242        # Check to see if the archive will have undefined symbols.
3243        if test "$allow_undefined" = yes; then
3244          if test "$allow_undefined_flag" = unsupported; then
3245            $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3246            build_libtool_libs=no
3247            build_old_libs=yes
3248          fi
3249        else
3250          # Don't allow undefined symbols.
3251          allow_undefined_flag="$no_undefined_flag"
3252        fi
3253      fi
3254
3255      if test "$mode" != relink; then
3256        # Remove our outputs, but don't remove object files since they
3257        # may have been created when compiling PIC objects.
3258        removelist=
3259        tempremovelist=`$echo "$output_objdir/*"`
3260        for p in $tempremovelist; do
3261          case $p in
3262            *.$objext)
3263               ;;
3264            $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3265               if test "X$precious_files_regex" != "X"; then
3266                 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3267                 then
3268                   continue
3269                 fi
3270               fi
3271               removelist="$removelist $p"
3272               ;;
3273            *) ;;
3274          esac
3275        done
3276        if test -n "$removelist"; then
3277          $show "${rm}r $removelist"
3278          $run ${rm}r $removelist
3279        fi
3280      fi
3281
3282      # Now set the variables for building old libraries.
3283      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3284        oldlibs="$oldlibs $output_objdir/$libname.$libext"
3285
3286        # Transform .lo files to .o files.
3287        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3288      fi
3289
3290      # Eliminate all temporary directories.
3291      for path in $notinst_path; do
3292        lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3293        deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3294        dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3295      done
3296
3297      if test -n "$xrpath"; then
3298        # If the user specified any rpath flags, then add them.
3299        temp_xrpath=
3300        for libdir in $xrpath; do
3301          temp_xrpath="$temp_xrpath -R$libdir"
3302          case "$finalize_rpath " in
3303          *" $libdir "*) ;;
3304          *) finalize_rpath="$finalize_rpath $libdir" ;;
3305          esac
3306        done
3307        if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3308          dependency_libs="$temp_xrpath $dependency_libs"
3309        fi
3310      fi
3311
3312      # Make sure dlfiles contains only unique files that won't be dlpreopened
3313      old_dlfiles="$dlfiles"
3314      dlfiles=
3315      for lib in $old_dlfiles; do
3316        case " $dlprefiles $dlfiles " in
3317        *" $lib "*) ;;
3318        *) dlfiles="$dlfiles $lib" ;;
3319        esac
3320      done
3321
3322      # Make sure dlprefiles contains only unique files
3323      old_dlprefiles="$dlprefiles"
3324      dlprefiles=
3325      for lib in $old_dlprefiles; do
3326        case "$dlprefiles " in
3327        *" $lib "*) ;;
3328        *) dlprefiles="$dlprefiles $lib" ;;
3329        esac
3330      done
3331
3332      if test "$build_libtool_libs" = yes; then
3333        if test -n "$rpath"; then
3334          case $host in
3335          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3336            # these systems don't actually have a c library (as such)!
3337            ;;
3338          *-*-rhapsody* | *-*-darwin1.[012])
3339            # Rhapsody C library is in the System framework
3340            deplibs="$deplibs -framework System"
3341            ;;
3342          *-*-netbsd*)
3343            # Don't link with libc until the a.out ld.so is fixed.
3344            ;;
3345          *-*-openbsd* | *-*-freebsd*)
3346            # Do not include libc due to us having libc/libc_r.
3347            test "X$arg" = "X-lc" && continue
3348            ;;
3349          *)
3350            # Add libc to deplibs on all other systems if necessary.
3351            if test "$build_libtool_need_lc" = "yes"; then
3352              deplibs="$deplibs -lc"
3353            fi
3354            ;;
3355          esac
3356        fi
3357
3358        # Transform deplibs into only deplibs that can be linked in shared.
3359        name_save=$name
3360        libname_save=$libname
3361        release_save=$release
3362        versuffix_save=$versuffix
3363        major_save=$major
3364        # I'm not sure if I'm treating the release correctly.  I think
3365        # release should show up in the -l (ie -lgmp5) so we don't want to
3366        # add it in twice.  Is that correct?
3367        release=""
3368        versuffix=""
3369        major=""
3370        newdeplibs=
3371        droppeddeps=no
3372        case $deplibs_check_method in
3373        pass_all)
3374          # Don't check for shared/static.  Everything works.
3375          # This might be a little naive.  We might want to check
3376          # whether the library exists or not.  But this is on
3377          # osf3 & osf4 and I'm not really sure... Just
3378          # implementing what was already the behavior.
3379          newdeplibs=$deplibs
3380          ;;
3381        test_compile)
3382          # This code stresses the "libraries are programs" paradigm to its
3383          # limits. Maybe even breaks it.  We compile a program, linking it
3384          # against the deplibs as a proxy for the library.  Then we can check
3385          # whether they linked in statically or dynamically with ldd.
3386          $rm conftest.c
3387          cat > conftest.c <<EOF
3388          int main() { return 0; }
3389EOF
3390          $rm conftest
3391          $LTCC -o conftest conftest.c $deplibs
3392          if test "$?" -eq 0 ; then
3393            ldd_output=`ldd conftest`
3394            for i in $deplibs; do
3395              name="`expr $i : '-l\(.*\)'`"
3396              # If $name is empty we are operating on a -L argument.
3397              if test "$name" != "" && test "$name" -ne "0"; then
3398                if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3399                  case " $predeps $postdeps " in
3400                  *" $i "*)
3401                    newdeplibs="$newdeplibs $i"
3402                    i=""
3403                    ;;
3404                  esac
3405                fi
3406                if test -n "$i" ; then
3407                  libname=`eval \\$echo \"$libname_spec\"`
3408                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
3409                  set dummy $deplib_matches
3410                  deplib_match=$2
3411                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3412                    newdeplibs="$newdeplibs $i"
3413                  else
3414                    droppeddeps=yes
3415                    $echo
3416                    $echo "*** Warning: dynamic linker does not accept needed library $i."
3417                    $echo "*** I have the capability to make that library automatically link in when"
3418                    $echo "*** you link to this library.  But I can only do this if you have a"
3419                    $echo "*** shared version of the library, which I believe you do not have"
3420                    $echo "*** because a test_compile did reveal that the linker did not use it for"
3421                    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3422                  fi
3423                fi
3424              else
3425                newdeplibs="$newdeplibs $i"
3426              fi
3427            done
3428          else
3429            # Error occurred in the first compile.  Let's try to salvage
3430            # the situation: Compile a separate program for each library.
3431            for i in $deplibs; do
3432              name="`expr $i : '-l\(.*\)'`"
3433              # If $name is empty we are operating on a -L argument.
3434              if test "$name" != "" && test "$name" != "0"; then
3435                $rm conftest
3436                $LTCC -o conftest conftest.c $i
3437                # Did it work?
3438                if test "$?" -eq 0 ; then
3439                  ldd_output=`ldd conftest`
3440                  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3441                    case " $predeps $postdeps " in
3442                    *" $i "*)
3443                      newdeplibs="$newdeplibs $i"
3444                      i=""
3445                      ;;
3446                    esac
3447                  fi
3448                  if test -n "$i" ; then
3449                    libname=`eval \\$echo \"$libname_spec\"`
3450                    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3451                    set dummy $deplib_matches
3452                    deplib_match=$2
3453                    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3454                      newdeplibs="$newdeplibs $i"
3455                    else
3456                      droppeddeps=yes
3457                      $echo
3458                      $echo "*** Warning: dynamic linker does not accept needed library $i."
3459                      $echo "*** I have the capability to make that library automatically link in when"
3460                      $echo "*** you link to this library.  But I can only do this if you have a"
3461                      $echo "*** shared version of the library, which you do not appear to have"
3462                      $echo "*** because a test_compile did reveal that the linker did not use this one"
3463                      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3464                    fi
3465                  fi
3466                else
3467                  droppeddeps=yes
3468                  $echo
3469                  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3470                  $echo "***  make it link in!  You will probably need to install it or some"
3471                  $echo "*** library that it depends on before this library will be fully"
3472                  $echo "*** functional.  Installing it before continuing would be even better."
3473                fi
3474              else
3475                newdeplibs="$newdeplibs $i"
3476              fi
3477            done
3478          fi
3479          ;;
3480        file_magic*)
3481          set dummy $deplibs_check_method
3482          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3483          for a_deplib in $deplibs; do
3484            name="`expr $a_deplib : '-l\(.*\)'`"
3485            # If $name is empty we are operating on a -L argument.
3486            if test "$name" != "" && test  "$name" != "0"; then
3487              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3488                case " $predeps $postdeps " in
3489                *" $a_deplib "*)
3490                  newdeplibs="$newdeplibs $a_deplib"
3491                  a_deplib=""
3492                  ;;
3493                esac
3494              fi
3495              if test -n "$a_deplib" ; then
3496                libname=`eval \\$echo \"$libname_spec\"`
3497                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3498                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3499                  for potent_lib in $potential_libs; do
3500                      # Follow soft links.
3501                      if ls -lLd "$potent_lib" 2>/dev/null \
3502                         | grep " -> " >/dev/null; then
3503                        continue
3504                      fi
3505                      # The statement above tries to avoid entering an
3506                      # endless loop below, in case of cyclic links.
3507                      # We might still enter an endless loop, since a link
3508                      # loop can be closed while we follow links,
3509                      # but so what?
3510                      potlib="$potent_lib"
3511                      while test -h "$potlib" 2>/dev/null; do
3512                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3513                        case $potliblink in
3514                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3515                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3516                        esac
3517                      done
3518                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3519                         | ${SED} 10q \
3520                         | $EGREP "$file_magic_regex" > /dev/null; then
3521                        newdeplibs="$newdeplibs $a_deplib"
3522                        a_deplib=""
3523                        break 2
3524                      fi
3525                  done
3526                done
3527              fi
3528              if test -n "$a_deplib" ; then
3529                droppeddeps=yes
3530                $echo
3531                $echo "*** Warning: linker path does not have real file for library $a_deplib."
3532                $echo "*** I have the capability to make that library automatically link in when"
3533                $echo "*** you link to this library.  But I can only do this if you have a"
3534                $echo "*** shared version of the library, which you do not appear to have"
3535                $echo "*** because I did check the linker path looking for a file starting"
3536                if test -z "$potlib" ; then
3537                  $echo "*** with $libname but no candidates were found. (...for file magic test)"
3538                else
3539                  $echo "*** with $libname and none of the candidates passed a file format test"
3540                  $echo "*** using a file magic. Last file checked: $potlib"
3541                fi
3542              fi
3543            else
3544              # Add a -L argument.
3545              newdeplibs="$newdeplibs $a_deplib"
3546            fi
3547          done # Gone through all deplibs.
3548          ;;
3549        match_pattern*)
3550          set dummy $deplibs_check_method
3551          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3552          for a_deplib in $deplibs; do
3553            name="`expr $a_deplib : '-l\(.*\)'`"
3554            # If $name is empty we are operating on a -L argument.
3555            if test -n "$name" && test "$name" != "0"; then
3556              if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3557                case " $predeps $postdeps " in
3558                *" $a_deplib "*)
3559                  newdeplibs="$newdeplibs $a_deplib"
3560                  a_deplib=""
3561                  ;;
3562                esac
3563              fi
3564              if test -n "$a_deplib" ; then
3565                libname=`eval \\$echo \"$libname_spec\"`
3566                for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3567                  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3568                  for potent_lib in $potential_libs; do
3569                    potlib="$potent_lib" # see symlink-check above in file_magic test
3570                    if eval $echo \"$potent_lib\" 2>/dev/null \
3571                        | ${SED} 10q \
3572                        | $EGREP "$match_pattern_regex" > /dev/null; then
3573                      newdeplibs="$newdeplibs $a_deplib"
3574                      a_deplib=""
3575                      break 2
3576                    fi
3577                  done
3578                done
3579              fi
3580              if test -n "$a_deplib" ; then
3581                droppeddeps=yes
3582                $echo
3583                $echo "*** Warning: linker path does not have real file for library $a_deplib."
3584                $echo "*** I have the capability to make that library automatically link in when"
3585                $echo "*** you link to this library.  But I can only do this if you have a"
3586                $echo "*** shared version of the library, which you do not appear to have"
3587                $echo "*** because I did check the linker path looking for a file starting"
3588                if test -z "$potlib" ; then
3589                  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3590                else
3591                  $echo "*** with $libname and none of the candidates passed a file format test"
3592                  $echo "*** using a regex pattern. Last file checked: $potlib"
3593                fi
3594              fi
3595            else
3596              # Add a -L argument.
3597              newdeplibs="$newdeplibs $a_deplib"
3598            fi
3599          done # Gone through all deplibs.
3600          ;;
3601        none | unknown | *)
3602          newdeplibs=""
3603          tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3604            -e 's/ -[LR][^ ]*//g'`
3605          if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3606            for i in $predeps $postdeps ; do
3607              # can't use Xsed below, because $i might contain '/'
3608              tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3609            done
3610          fi
3611          if $echo "X $tmp_deplibs" | $Xsed -e 's/[     ]//g' \
3612            | grep . >/dev/null; then
3613            $echo
3614            if test "X$deplibs_check_method" = "Xnone"; then
3615              $echo "*** Warning: inter-library dependencies are not supported in this platform."
3616            else
3617              $echo "*** Warning: inter-library dependencies are not known to be supported."
3618            fi
3619            $echo "*** All declared inter-library dependencies are being dropped."
3620            droppeddeps=yes
3621          fi
3622          ;;
3623        esac
3624        versuffix=$versuffix_save
3625        major=$major_save
3626        release=$release_save
3627        libname=$libname_save
3628        name=$name_save
3629
3630        case $host in
3631        *-*-rhapsody* | *-*-darwin1.[012])
3632          # On Rhapsody replace the C library is the System framework
3633          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3634          ;;
3635        esac
3636
3637        if test "$droppeddeps" = yes; then
3638          if test "$module" = yes; then
3639            $echo
3640            $echo "*** Warning: libtool could not satisfy all declared inter-library"
3641            $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3642            $echo "*** a static module, that should work as long as the dlopening"
3643            $echo "*** application is linked with the -dlopen flag."
3644            if test -z "$global_symbol_pipe"; then
3645              $echo
3646              $echo "*** However, this would only work if libtool was able to extract symbol"
3647              $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3648              $echo "*** not find such a program.  So, this module is probably useless."
3649              $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3650            fi
3651            if test "$build_old_libs" = no; then
3652              oldlibs="$output_objdir/$libname.$libext"
3653              build_libtool_libs=module
3654              build_old_libs=yes
3655            else
3656              build_libtool_libs=no
3657            fi
3658          else
3659            $echo "*** The inter-library dependencies that have been dropped here will be"
3660            $echo "*** automatically added whenever a program is linked with this library"
3661            $echo "*** or is declared to -dlopen it."
3662
3663            if test "$allow_undefined" = no; then
3664              $echo
3665              $echo "*** Since this library must not contain undefined symbols,"
3666              $echo "*** because either the platform does not support them or"
3667              $echo "*** it was explicitly requested with -no-undefined,"
3668              $echo "*** libtool will only create a static version of it."
3669              if test "$build_old_libs" = no; then
3670                oldlibs="$output_objdir/$libname.$libext"
3671                build_libtool_libs=module
3672                build_old_libs=yes
3673              else
3674                build_libtool_libs=no
3675              fi
3676            fi
3677          fi
3678        fi
3679        # Done checking deplibs!
3680        deplibs=$newdeplibs
3681      fi
3682
3683      # All the library-specific variables (install_libdir is set above).
3684      library_names=
3685      old_library=
3686      dlname=
3687
3688      # Test again, we may have decided not to build it any more
3689      if test "$build_libtool_libs" = yes; then
3690        if test "$hardcode_into_libs" = yes; then
3691          # Hardcode the library paths
3692          hardcode_libdirs=
3693          dep_rpath=
3694          rpath="$finalize_rpath"
3695          test "$mode" != relink && rpath="$compile_rpath$rpath"
3696          for libdir in $rpath; do
3697            if test -n "$hardcode_libdir_flag_spec"; then
3698              if test -n "$hardcode_libdir_separator"; then
3699                if test -z "$hardcode_libdirs"; then
3700                  hardcode_libdirs="$libdir"
3701                else
3702                  # Just accumulate the unique libdirs.
3703                  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3704                  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3705                    ;;
3706                  *)
3707                    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3708                    ;;
3709                  esac
3710                fi
3711              else
3712                eval flag=\"$hardcode_libdir_flag_spec\"
3713                dep_rpath="$dep_rpath $flag"
3714              fi
3715            elif test -n "$runpath_var"; then
3716              case "$perm_rpath " in
3717              *" $libdir "*) ;;
3718              *) perm_rpath="$perm_rpath $libdir" ;;
3719              esac
3720            fi
3721          done
3722          # Substitute the hardcoded libdirs into the rpath.
3723          if test -n "$hardcode_libdir_separator" &&
3724             test -n "$hardcode_libdirs"; then
3725            libdir="$hardcode_libdirs"
3726            if test -n "$hardcode_libdir_flag_spec_ld"; then
3727              eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3728            else
3729              eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3730            fi
3731          fi
3732          if test -n "$runpath_var" && test -n "$perm_rpath"; then
3733            # We should set the runpath_var.
3734            rpath=
3735            for dir in $perm_rpath; do
3736              rpath="$rpath$dir:"
3737            done
3738            eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3739          fi
3740          test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3741        fi
3742
3743        shlibpath="$finalize_shlibpath"
3744        test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3745        if test -n "$shlibpath"; then
3746          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3747        fi
3748
3749        # Get the real and link names of the library.
3750        eval shared_ext=\"$shrext_cmds\"
3751        eval library_names=\"$library_names_spec\"
3752        set dummy $library_names
3753        realname="$2"
3754        shift; shift
3755
3756        if test -n "$soname_spec"; then
3757          eval soname=\"$soname_spec\"
3758        else
3759          soname="$realname"
3760        fi
3761        if test -z "$dlname"; then
3762          dlname=$soname
3763        fi
3764
3765        lib="$output_objdir/$realname"
3766        for link
3767        do
3768          linknames="$linknames $link"
3769        done
3770
3771        # Use standard objects if they are pic
3772        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3773
3774        # Prepare the list of exported symbols
3775        if test -z "$export_symbols"; then
3776          if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3777            $show "generating symbol list for \`$libname.la'"
3778            export_symbols="$output_objdir/$libname.exp"
3779            $run $rm $export_symbols
3780            cmds=$export_symbols_cmds
3781            save_ifs="$IFS"; IFS='~'
3782            for cmd in $cmds; do
3783              IFS="$save_ifs"
3784              eval cmd=\"$cmd\"
3785              if len=`expr "X$cmd" : ".*"` &&
3786               test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3787                $show "$cmd"
3788                $run eval "$cmd" || exit $?
3789                skipped_export=false
3790              else
3791                # The command line is too long to execute in one step.
3792                $show "using reloadable object file for export list..."
3793                skipped_export=:
3794              fi
3795            done
3796            IFS="$save_ifs"
3797            if test -n "$export_symbols_regex"; then
3798              $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3799              $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3800              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3801              $run eval '$mv "${export_symbols}T" "$export_symbols"'
3802            fi
3803          fi
3804        fi
3805
3806        if test -n "$export_symbols" && test -n "$include_expsyms"; then
3807          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3808        fi
3809
3810        tmp_deplibs=
3811        for test_deplib in $deplibs; do
3812                case " $convenience " in
3813                *" $test_deplib "*) ;;
3814                *)
3815                        tmp_deplibs="$tmp_deplibs $test_deplib"
3816                        ;;
3817                esac
3818        done
3819        deplibs="$tmp_deplibs"
3820
3821        if test -n "$convenience"; then
3822          if test -n "$whole_archive_flag_spec"; then
3823            save_libobjs=$libobjs
3824            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3825          else
3826            gentop="$output_objdir/${outputname}x"
3827            generated="$generated $gentop"
3828
3829            func_extract_archives $gentop $convenience
3830            libobjs="$libobjs $func_extract_archives_result"
3831          fi
3832        fi
3833       
3834        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3835          eval flag=\"$thread_safe_flag_spec\"
3836          linker_flags="$linker_flags $flag"
3837        fi
3838
3839        # Make a backup of the uninstalled library when relinking
3840        if test "$mode" = relink; then
3841          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3842        fi
3843
3844        # Do each of the archive commands.
3845        if test "$module" = yes && test -n "$module_cmds" ; then
3846          if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3847            eval test_cmds=\"$module_expsym_cmds\"
3848            cmds=$module_expsym_cmds
3849          else
3850            eval test_cmds=\"$module_cmds\"
3851            cmds=$module_cmds
3852          fi
3853        else
3854        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3855          eval test_cmds=\"$archive_expsym_cmds\"
3856          cmds=$archive_expsym_cmds
3857        else
3858          eval test_cmds=\"$archive_cmds\"
3859          cmds=$archive_cmds
3860          fi
3861        fi
3862
3863        if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` &&
3864           test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3865          :
3866        else
3867          # The command line is too long to link in one step, link piecewise.
3868          $echo "creating reloadable object files..."
3869
3870          # Save the value of $output and $libobjs because we want to
3871          # use them later.  If we have whole_archive_flag_spec, we
3872          # want to use save_libobjs as it was before
3873          # whole_archive_flag_spec was expanded, because we can't
3874          # assume the linker understands whole_archive_flag_spec.
3875          # This may have to be revisited, in case too many
3876          # convenience libraries get linked in and end up exceeding
3877          # the spec.
3878          if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3879            save_libobjs=$libobjs
3880          fi
3881          save_output=$output
3882
3883          # Clear the reloadable object creation command queue and
3884          # initialize k to one.
3885          test_cmds=
3886          concat_cmds=
3887          objlist=
3888          delfiles=
3889          last_robj=
3890          k=1
3891          output=$output_objdir/$save_output-${k}.$objext
3892          # Loop over the list of objects to be linked.
3893          for obj in $save_libobjs
3894          do
3895            eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3896            if test "X$objlist" = X ||
3897               { len=`expr "X$test_cmds" : ".*"` &&
3898                 test "$len" -le "$max_cmd_len"; }; then
3899              objlist="$objlist $obj"
3900            else
3901              # The command $test_cmds is almost too long, add a
3902              # command to the queue.
3903              if test "$k" -eq 1 ; then
3904                # The first file doesn't have a previous command to add.
3905                eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3906              else
3907                # All subsequent reloadable object files will link in
3908                # the last one created.
3909                eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3910              fi
3911              last_robj=$output_objdir/$save_output-${k}.$objext
3912              k=`expr $k + 1`
3913              output=$output_objdir/$save_output-${k}.$objext
3914              objlist=$obj
3915              len=1
3916            fi
3917          done
3918          # Handle the remaining objects by creating one last
3919          # reloadable object file.  All subsequent reloadable object
3920          # files will link in the last one created.
3921          test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3922          eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3923
3924          if ${skipped_export-false}; then
3925            $show "generating symbol list for \`$libname.la'"
3926            export_symbols="$output_objdir/$libname.exp"
3927            $run $rm $export_symbols
3928            libobjs=$output
3929            # Append the command to create the export file.
3930            eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3931          fi
3932
3933          # Set up a command to remove the reloadale object files
3934          # after they are used.
3935          i=0
3936          while test "$i" -lt "$k"
3937          do
3938            i=`expr $i + 1`
3939            delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3940          done
3941
3942          $echo "creating a temporary reloadable object file: $output"
3943
3944          # Loop through the commands generated above and execute them.
3945          save_ifs="$IFS"; IFS='~'
3946          for cmd in $concat_cmds; do
3947            IFS="$save_ifs"
3948            $show "$cmd"
3949            $run eval "$cmd" || exit $?
3950          done
3951          IFS="$save_ifs"
3952
3953          libobjs=$output
3954          # Restore the value of output.
3955          output=$save_output
3956
3957          if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3958            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3959          fi
3960          # Expand the library linking commands again to reset the
3961          # value of $libobjs for piecewise linking.
3962
3963          # Do each of the archive commands.
3964          if test "$module" = yes && test -n "$module_cmds" ; then
3965            if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3966              cmds=$module_expsym_cmds
3967            else
3968              cmds=$module_cmds
3969            fi
3970          else
3971          if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3972            cmds=$archive_expsym_cmds
3973          else
3974            cmds=$archive_cmds
3975            fi
3976          fi
3977
3978          # Append the command to remove the reloadable object files
3979          # to the just-reset $cmds.
3980          eval cmds=\"\$cmds~\$rm $delfiles\"
3981        fi
3982        save_ifs="$IFS"; IFS='~'
3983        for cmd in $cmds; do
3984          IFS="$save_ifs"
3985          eval cmd=\"$cmd\"
3986          $show "$cmd"
3987          $run eval "$cmd" || exit $?
3988        done
3989        IFS="$save_ifs"
3990
3991        # Restore the uninstalled library and exit
3992        if test "$mode" = relink; then
3993          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3994          exit $EXIT_SUCCESS
3995        fi
3996
3997        # Create links to the real library.
3998        for linkname in $linknames; do
3999          if test "$realname" != "$linkname"; then
4000            $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
4001            $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
4002          fi
4003        done
4004
4005        # If -module or -export-dynamic was specified, set the dlname.
4006        if test "$module" = yes || test "$export_dynamic" = yes; then
4007          # On all known operating systems, these are identical.
4008          dlname="$soname"
4009        fi
4010      fi
4011      ;;
4012
4013    obj)
4014      if test -n "$deplibs"; then
4015        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
4016      fi
4017
4018      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4019        $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
4020      fi
4021
4022      if test -n "$rpath"; then
4023        $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
4024      fi
4025
4026      if test -n "$xrpath"; then
4027        $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
4028      fi
4029
4030      if test -n "$vinfo"; then
4031        $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
4032      fi
4033
4034      if test -n "$release"; then
4035        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
4036      fi
4037
4038      case $output in
4039      *.lo)
4040        if test -n "$objs$old_deplibs"; then
4041          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
4042          exit $EXIT_FAILURE
4043        fi
4044        libobj="$output"
4045        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
4046        ;;
4047      *)
4048        libobj=
4049        obj="$output"
4050        ;;
4051      esac
4052
4053      # Delete the old objects.
4054      $run $rm $obj $libobj
4055
4056      # Objects from convenience libraries.  This assumes
4057      # single-version convenience libraries.  Whenever we create
4058      # different ones for PIC/non-PIC, this we'll have to duplicate
4059      # the extraction.
4060      reload_conv_objs=
4061      gentop=
4062      # reload_cmds runs $LD directly, so let us get rid of
4063      # -Wl from whole_archive_flag_spec
4064      wl=
4065
4066      if test -n "$convenience"; then
4067        if test -n "$whole_archive_flag_spec"; then
4068          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
4069        else
4070          gentop="$output_objdir/${obj}x"
4071          generated="$generated $gentop"
4072
4073          func_extract_archives $gentop $convenience
4074          reload_conv_objs="$reload_objs $func_extract_archives_result"
4075        fi
4076      fi
4077
4078      # Create the old-style object.
4079      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
4080
4081      output="$obj"
4082      cmds=$reload_cmds
4083      save_ifs="$IFS"; IFS='~'
4084      for cmd in $cmds; do
4085        IFS="$save_ifs"
4086        eval cmd=\"$cmd\"
4087        $show "$cmd"
4088        $run eval "$cmd" || exit $?
4089      done
4090      IFS="$save_ifs"
4091
4092      # Exit if we aren't doing a library object file.
4093      if test -z "$libobj"; then
4094        if test -n "$gentop"; then
4095          $show "${rm}r $gentop"
4096          $run ${rm}r $gentop
4097        fi
4098
4099        exit $EXIT_SUCCESS
4100      fi
4101
4102      if test "$build_libtool_libs" != yes; then
4103        if test -n "$gentop"; then
4104          $show "${rm}r $gentop"
4105          $run ${rm}r $gentop
4106        fi
4107
4108        # Create an invalid libtool object if no PIC, so that we don't
4109        # accidentally link it into a program.
4110        # $show "echo timestamp > $libobj"
4111        # $run eval "echo timestamp > $libobj" || exit $?
4112        exit $EXIT_SUCCESS
4113      fi
4114
4115      if test -n "$pic_flag" || test "$pic_mode" != default; then
4116        # Only do commands if we really have different PIC objects.
4117        reload_objs="$libobjs $reload_conv_objs"
4118        output="$libobj"
4119        cmds=$reload_cmds
4120        save_ifs="$IFS"; IFS='~'
4121        for cmd in $cmds; do
4122          IFS="$save_ifs"
4123          eval cmd=\"$cmd\"
4124          $show "$cmd"
4125          $run eval "$cmd" || exit $?
4126        done
4127        IFS="$save_ifs"
4128      fi
4129
4130      if test -n "$gentop"; then
4131        $show "${rm}r $gentop"
4132        $run ${rm}r $gentop
4133      fi
4134
4135      exit $EXIT_SUCCESS
4136      ;;
4137
4138    prog)
4139      case $host in
4140        *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4141      esac
4142      if test -n "$vinfo"; then
4143        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4144      fi
4145
4146      if test -n "$release"; then
4147        $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4148      fi
4149
4150      if test "$preload" = yes; then
4151        if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4152           test "$dlopen_self_static" = unknown; then
4153          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4154        fi
4155      fi
4156
4157      case $host in
4158      *-*-rhapsody* | *-*-darwin1.[012])
4159        # On Rhapsody replace the C library is the System framework
4160        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4161        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4162        ;;
4163      esac
4164
4165      case $host in
4166      *darwin*)
4167        # Don't allow lazy linking, it breaks C++ global constructors
4168        if test "$tagname" = CXX ; then
4169        compile_command="$compile_command ${wl}-bind_at_load"
4170        finalize_command="$finalize_command ${wl}-bind_at_load"
4171        fi
4172        ;;
4173      esac
4174
4175      compile_command="$compile_command $compile_deplibs"
4176      finalize_command="$finalize_command $finalize_deplibs"
4177
4178      if test -n "$rpath$xrpath"; then
4179        # If the user specified any rpath flags, then add them.
4180        for libdir in $rpath $xrpath; do
4181          # This is the magic to use -rpath.
4182          case "$finalize_rpath " in
4183          *" $libdir "*) ;;
4184          *) finalize_rpath="$finalize_rpath $libdir" ;;
4185          esac
4186        done
4187      fi
4188
4189      # Now hardcode the library paths
4190      rpath=
4191      hardcode_libdirs=
4192      for libdir in $compile_rpath $finalize_rpath; do
4193        if test -n "$hardcode_libdir_flag_spec"; then
4194          if test -n "$hardcode_libdir_separator"; then
4195            if test -z "$hardcode_libdirs"; then
4196              hardcode_libdirs="$libdir"
4197            else
4198              # Just accumulate the unique libdirs.
4199              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4200              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4201                ;;
4202              *)
4203                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4204                ;;
4205              esac
4206            fi
4207          else
4208            eval flag=\"$hardcode_libdir_flag_spec\"
4209            rpath="$rpath $flag"
4210          fi
4211        elif test -n "$runpath_var"; then
4212          case "$perm_rpath " in
4213          *" $libdir "*) ;;
4214          *) perm_rpath="$perm_rpath $libdir" ;;
4215          esac
4216        fi
4217        case $host in
4218        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4219          case :$dllsearchpath: in
4220          *":$libdir:"*) ;;
4221          *) dllsearchpath="$dllsearchpath:$libdir";;
4222          esac
4223          ;;
4224        esac
4225      done
4226      # Substitute the hardcoded libdirs into the rpath.
4227      if test -n "$hardcode_libdir_separator" &&
4228         test -n "$hardcode_libdirs"; then
4229        libdir="$hardcode_libdirs"
4230        eval rpath=\" $hardcode_libdir_flag_spec\"
4231      fi
4232      compile_rpath="$rpath"
4233
4234      rpath=
4235      hardcode_libdirs=
4236      for libdir in $finalize_rpath; do
4237        if test -n "$hardcode_libdir_flag_spec"; then
4238          if test -n "$hardcode_libdir_separator"; then
4239            if test -z "$hardcode_libdirs"; then
4240              hardcode_libdirs="$libdir"
4241            else
4242              # Just accumulate the unique libdirs.
4243              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4244              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4245                ;;
4246              *)
4247                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4248                ;;
4249              esac
4250            fi
4251          else
4252            eval flag=\"$hardcode_libdir_flag_spec\"
4253            rpath="$rpath $flag"
4254          fi
4255        elif test -n "$runpath_var"; then
4256          case "$finalize_perm_rpath " in
4257          *" $libdir "*) ;;
4258          *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4259          esac
4260        fi
4261      done
4262      # Substitute the hardcoded libdirs into the rpath.
4263      if test -n "$hardcode_libdir_separator" &&
4264         test -n "$hardcode_libdirs"; then
4265        libdir="$hardcode_libdirs"
4266        eval rpath=\" $hardcode_libdir_flag_spec\"
4267      fi
4268      finalize_rpath="$rpath"
4269
4270      if test -n "$libobjs" && test "$build_old_libs" = yes; then
4271        # Transform all the library objects into standard objects.
4272        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4273        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4274      fi
4275
4276      dlsyms=
4277      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4278        if test -n "$NM" && test -n "$global_symbol_pipe"; then
4279          dlsyms="${outputname}S.c"
4280        else
4281          $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4282        fi
4283      fi
4284
4285      if test -n "$dlsyms"; then
4286        case $dlsyms in
4287        "") ;;
4288        *.c)
4289          # Discover the nlist of each of the dlfiles.
4290          nlist="$output_objdir/${outputname}.nm"
4291
4292          $show "$rm $nlist ${nlist}S ${nlist}T"
4293          $run $rm "$nlist" "${nlist}S" "${nlist}T"
4294
4295          # Parse the name list into a source file.
4296          $show "creating $output_objdir/$dlsyms"
4297
4298          test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4299/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4300/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4301
4302#ifdef __cplusplus
4303extern \"C\" {
4304#endif
4305
4306/* Prevent the only kind of declaration conflicts we can make. */
4307#define lt_preloaded_symbols some_other_symbol
4308
4309/* External symbol declarations for the compiler. */\
4310"
4311
4312          if test "$dlself" = yes; then
4313            $show "generating symbol list for \`$output'"
4314
4315            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4316
4317            # Add our own program objects to the symbol list.
4318            progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4319            for arg in $progfiles; do
4320              $show "extracting global C symbols from \`$arg'"
4321              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4322            done
4323
4324            if test -n "$exclude_expsyms"; then
4325              $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4326              $run eval '$mv "$nlist"T "$nlist"'
4327            fi
4328
4329            if test -n "$export_symbols_regex"; then
4330              $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4331              $run eval '$mv "$nlist"T "$nlist"'
4332            fi
4333
4334            # Prepare the list of exported symbols
4335            if test -z "$export_symbols"; then
4336              export_symbols="$output_objdir/$output.exp"
4337              $run $rm $export_symbols
4338              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4339            else
4340              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4341              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4342              $run eval 'mv "$nlist"T "$nlist"'
4343            fi
4344          fi
4345
4346          for arg in $dlprefiles; do
4347            $show "extracting global C symbols from \`$arg'"
4348            name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4349            $run eval '$echo ": $name " >> "$nlist"'
4350            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4351          done
4352
4353          if test -z "$run"; then
4354            # Make sure we have at least an empty file.
4355            test -f "$nlist" || : > "$nlist"
4356
4357            if test -n "$exclude_expsyms"; then
4358              $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4359              $mv "$nlist"T "$nlist"
4360            fi
4361
4362            # Try sorting and uniquifying the output.
4363            if grep -v "^: " < "$nlist" |
4364                if sort -k 3 </dev/null >/dev/null 2>&1; then
4365                  sort -k 3
4366                else
4367                  sort +2
4368                fi |
4369                uniq > "$nlist"S; then
4370              :
4371            else
4372              grep -v "^: " < "$nlist" > "$nlist"S
4373            fi
4374
4375            if test -f "$nlist"S; then
4376              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4377            else
4378              $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4379            fi
4380
4381            $echo >> "$output_objdir/$dlsyms" "\
4382
4383#undef lt_preloaded_symbols
4384
4385#if defined (__STDC__) && __STDC__
4386# define lt_ptr void *
4387#else
4388# define lt_ptr char *
4389# define const
4390#endif
4391
4392/* The mapping between symbol names and symbols. */
4393const struct {
4394  const char *name;
4395  lt_ptr address;
4396}
4397lt_preloaded_symbols[] =
4398{\
4399"
4400
4401            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4402
4403            $echo >> "$output_objdir/$dlsyms" "\
4404  {0, (lt_ptr) 0}
4405};
4406
4407/* This works around a problem in FreeBSD linker */
4408#ifdef FREEBSD_WORKAROUND
4409static const void *lt_preloaded_setup() {
4410  return lt_preloaded_symbols;
4411}
4412#endif
4413
4414#ifdef __cplusplus
4415}
4416#endif\
4417"
4418          fi
4419
4420          pic_flag_for_symtable=
4421          case $host in
4422          # compiling the symbol table file with pic_flag works around
4423          # a FreeBSD bug that causes programs to crash when -lm is
4424          # linked before any other PIC object.  But we must not use
4425          # pic_flag when linking with -static.  The problem exists in
4426          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4427          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4428            case "$compile_command " in
4429            *" -static "*) ;;
4430            *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4431            esac;;
4432          *-*-hpux*)
4433            case "$compile_command " in
4434            *" -static "*) ;;
4435            *) pic_flag_for_symtable=" $pic_flag";;
4436            esac
4437          esac
4438
4439          # Now compile the dynamic symbol file.
4440          $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4441          $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4442
4443          # Clean up the generated files.
4444          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4445          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4446
4447          # Transform the symbol file into the correct name.
4448          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4449          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4450          ;;
4451        *)
4452          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4453          exit $EXIT_FAILURE
4454          ;;
4455        esac
4456      else
4457        # We keep going just in case the user didn't refer to
4458        # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
4459        # really was required.
4460
4461        # Nullify the symbol file.
4462        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4463        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4464      fi
4465
4466      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4467        # Replace the output file specification.
4468        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4469        link_command="$compile_command$compile_rpath"
4470
4471        # We have no uninstalled library dependencies, so finalize right now.
4472        $show "$link_command"
4473        $run eval "$link_command"
4474        status=$?
4475
4476        # Delete the generated files.
4477        if test -n "$dlsyms"; then
4478          $show "$rm $output_objdir/${outputname}S.${objext}"
4479          $run $rm "$output_objdir/${outputname}S.${objext}"
4480        fi
4481
4482        exit $status
4483      fi
4484
4485      if test -n "$shlibpath_var"; then
4486        # We should set the shlibpath_var
4487        rpath=
4488        for dir in $temp_rpath; do
4489          case $dir in
4490          [\\/]* | [A-Za-z]:[\\/]*)
4491            # Absolute path.
4492            rpath="$rpath$dir:"
4493            ;;
4494          *)
4495            # Relative path: add a thisdir entry.
4496            rpath="$rpath\$thisdir/$dir:"
4497            ;;
4498          esac
4499        done
4500        temp_rpath="$rpath"
4501      fi
4502
4503      if test -n "$compile_shlibpath$finalize_shlibpath"; then
4504        compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4505      fi
4506      if test -n "$finalize_shlibpath"; then
4507        finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4508      fi
4509
4510      compile_var=
4511      finalize_var=
4512      if test -n "$runpath_var"; then
4513        if test -n "$perm_rpath"; then
4514          # We should set the runpath_var.
4515          rpath=
4516          for dir in $perm_rpath; do
4517            rpath="$rpath$dir:"
4518          done
4519          compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4520        fi
4521        if test -n "$finalize_perm_rpath"; then
4522          # We should set the runpath_var.
4523          rpath=
4524          for dir in $finalize_perm_rpath; do
4525            rpath="$rpath$dir:"
4526          done
4527          finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4528        fi
4529      fi
4530
4531      if test "$no_install" = yes; then
4532        # We don't need to create a wrapper script.
4533        link_command="$compile_var$compile_command$compile_rpath"
4534        # Replace the output file specification.
4535        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4536        # Delete the old output file.
4537        $run $rm $output
4538        # Link the executable and exit
4539        $show "$link_command"
4540        $run eval "$link_command" || exit $?
4541        exit $EXIT_SUCCESS
4542      fi
4543
4544      if test "$hardcode_action" = relink; then
4545        # Fast installation is not supported
4546        link_command="$compile_var$compile_command$compile_rpath"
4547        relink_command="$finalize_var$finalize_command$finalize_rpath"
4548
4549        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4550        $echo "$modename: \`$output' will be relinked during installation" 1>&2
4551      else
4552        if test "$fast_install" != no; then
4553          link_command="$finalize_var$compile_command$finalize_rpath"
4554          if test "$fast_install" = yes; then
4555            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4556          else
4557            # fast_install is set to needless
4558            relink_command=
4559          fi
4560        else
4561          link_command="$compile_var$compile_command$compile_rpath"
4562          relink_command="$finalize_var$finalize_command$finalize_rpath"
4563        fi
4564      fi
4565
4566      # Replace the output file specification.
4567      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4568
4569      # Delete the old output files.
4570      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4571
4572      $show "$link_command"
4573      $run eval "$link_command" || exit $?
4574
4575      # Now create the wrapper script.
4576      $show "creating $output"
4577
4578      # Quote the relink command for shipping.
4579      if test -n "$relink_command"; then
4580        # Preserve any variables that may affect compiler behavior
4581        for var in $variables_saved_for_relink; do
4582          if eval test -z \"\${$var+set}\"; then
4583            relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4584          elif eval var_value=\$$var; test -z "$var_value"; then
4585            relink_command="$var=; export $var; $relink_command"
4586          else
4587            var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4588            relink_command="$var=\"$var_value\"; export $var; $relink_command"
4589          fi
4590        done
4591        relink_command="(cd `pwd`; $relink_command)"
4592        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4593      fi
4594
4595      # Quote $echo for shipping.
4596      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
4597        case $progpath in
4598        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
4599        *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
4600        esac
4601        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4602      else
4603        qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4604      fi
4605
4606      # Only actually do things if our run command is non-null.
4607      if test -z "$run"; then
4608        # win32 will think the script is a binary if it has
4609        # a .exe suffix, so we strip it off here.
4610        case $output in
4611          *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4612        esac
4613        # test for cygwin because mv fails w/o .exe extensions
4614        case $host in
4615          *cygwin*)
4616            exeext=.exe
4617            outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4618          *) exeext= ;;
4619        esac
4620        case $host in
4621          *cygwin* | *mingw* )
4622            cwrappersource=`$echo ${objdir}/lt-${output}.c`
4623            cwrapper=`$echo ${output}.exe`
4624            $rm $cwrappersource $cwrapper
4625            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
4626
4627            cat > $cwrappersource <<EOF
4628
4629/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4630   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4631
4632   The $output program cannot be directly executed until all the libtool
4633   libraries that it depends on are installed.
4634
4635   This wrapper executable should never be moved out of the build directory.
4636   If it is, it will not operate correctly.
4637
4638   Currently, it simply execs the wrapper *script* "/bin/sh $output",
4639   but could eventually absorb all of the scripts functionality and
4640   exec $objdir/$outputname directly.
4641*/
4642EOF
4643            cat >> $cwrappersource<<"EOF"
4644#include <stdio.h>
4645#include <stdlib.h>
4646#include <unistd.h>
4647#include <malloc.h>
4648#include <stdarg.h>
4649#include <assert.h>
4650
4651#if defined(PATH_MAX)
4652# define LT_PATHMAX PATH_MAX
4653#elif defined(MAXPATHLEN)
4654# define LT_PATHMAX MAXPATHLEN
4655#else
4656# define LT_PATHMAX 1024
4657#endif
4658
4659#ifndef DIR_SEPARATOR
4660#define DIR_SEPARATOR '/'
4661#endif
4662
4663#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4664  defined (__OS2__)
4665#define HAVE_DOS_BASED_FILE_SYSTEM
4666#ifndef DIR_SEPARATOR_2
4667#define DIR_SEPARATOR_2 '\\'
4668#endif
4669#endif
4670
4671#ifndef DIR_SEPARATOR_2
4672# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4673#else /* DIR_SEPARATOR_2 */
4674# define IS_DIR_SEPARATOR(ch) \
4675        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4676#endif /* DIR_SEPARATOR_2 */
4677
4678#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4679#define XFREE(stale) do { \
4680  if (stale) { free ((void *) stale); stale = 0; } \
4681} while (0)
4682
4683const char *program_name = NULL;
4684
4685void * xmalloc (size_t num);
4686char * xstrdup (const char *string);
4687char * basename (const char *name);
4688char * fnqualify(const char *path);
4689char * strendzap(char *str, const char *pat);
4690void lt_fatal (const char *message, ...);
4691
4692int
4693main (int argc, char *argv[])
4694{
4695  char **newargz;
4696  int i;
4697
4698  program_name = (char *) xstrdup ((char *) basename (argv[0]));
4699  newargz = XMALLOC(char *, argc+2);
4700EOF
4701
4702            cat >> $cwrappersource <<EOF
4703  newargz[0] = "$SHELL";
4704EOF
4705
4706            cat >> $cwrappersource <<"EOF"
4707  newargz[1] = fnqualify(argv[0]);
4708  /* we know the script has the same name, without the .exe */
4709  /* so make sure newargz[1] doesn't end in .exe */
4710  strendzap(newargz[1],".exe");
4711  for (i = 1; i < argc; i++)
4712    newargz[i+1] = xstrdup(argv[i]);
4713  newargz[argc+1] = NULL;
4714EOF
4715
4716            cat >> $cwrappersource <<EOF
4717  execv("$SHELL",newargz);
4718EOF
4719
4720            cat >> $cwrappersource <<"EOF"
4721}
4722
4723void *
4724xmalloc (size_t num)
4725{
4726  void * p = (void *) malloc (num);
4727  if (!p)
4728    lt_fatal ("Memory exhausted");
4729
4730  return p;
4731}
4732
4733char *
4734xstrdup (const char *string)
4735{
4736  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4737;
4738}
4739
4740char *
4741basename (const char *name)
4742{
4743  const char *base;
4744
4745#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4746  /* Skip over the disk name in MSDOS pathnames. */
4747  if (isalpha (name[0]) && name[1] == ':')
4748    name += 2;
4749#endif
4750
4751  for (base = name; *name; name++)
4752    if (IS_DIR_SEPARATOR (*name))
4753      base = name + 1;
4754  return (char *) base;
4755}
4756
4757char *
4758fnqualify(const char *path)
4759{
4760  size_t size;
4761  char *p;
4762  char tmp[LT_PATHMAX + 1];
4763
4764  assert(path != NULL);
4765
4766  /* Is it qualified already? */
4767#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4768  if (isalpha (path[0]) && path[1] == ':')
4769    return xstrdup (path);
4770#endif
4771  if (IS_DIR_SEPARATOR (path[0]))
4772    return xstrdup (path);
4773
4774  /* prepend the current directory */
4775  /* doesn't handle '~' */
4776  if (getcwd (tmp, LT_PATHMAX) == NULL)
4777    lt_fatal ("getcwd failed");
4778  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4779  p = XMALLOC(char, size);
4780  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4781  return p;
4782}
4783
4784char *
4785strendzap(char *str, const char *pat)
4786{
4787  size_t len, patlen;
4788
4789  assert(str != NULL);
4790  assert(pat != NULL);
4791
4792  len = strlen(str);
4793  patlen = strlen(pat);
4794
4795  if (patlen <= len)
4796  {
4797    str += len - patlen;
4798    if (strcmp(str, pat) == 0)
4799      *str = '\0';
4800  }
4801  return str;
4802}
4803
4804static void
4805lt_error_core (int exit_status, const char * mode,
4806          const char * message, va_list ap)
4807{
4808  fprintf (stderr, "%s: %s: ", program_name, mode);
4809  vfprintf (stderr, message, ap);
4810  fprintf (stderr, ".\n");
4811
4812  if (exit_status >= 0)
4813    exit (exit_status);
4814}
4815
4816void
4817lt_fatal (const char *message, ...)
4818{
4819  va_list ap;
4820  va_start (ap, message);
4821  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4822  va_end (ap);
4823}
4824EOF
4825          # we should really use a build-platform specific compiler
4826          # here, but OTOH, the wrappers (shell script and this C one)
4827          # are only useful if you want to execute the "real" binary.
4828          # Since the "real" binary is built for $host, then this
4829          # wrapper might as well be built for $host, too.
4830          $run $LTCC -s -o $cwrapper $cwrappersource
4831          ;;
4832        esac
4833        $rm $output
4834        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
4835
4836        $echo > $output "\
4837#! $SHELL
4838
4839# $output - temporary wrapper script for $objdir/$outputname
4840# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4841#
4842# The $output program cannot be directly executed until all the libtool
4843# libraries that it depends on are installed.
4844#
4845# This wrapper script should never be moved out of the build directory.
4846# If it is, it will not operate correctly.
4847
4848# Sed substitution that helps us do robust quoting.  It backslashifies
4849# metacharacters that are still active within double-quoted strings.
4850Xsed='${SED} -e 1s/^X//'
4851sed_quote_subst='$sed_quote_subst'
4852
4853# The HP-UX ksh and POSIX shell print the target directory to stdout
4854# if CDPATH is set.
4855(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
4856
4857relink_command=\"$relink_command\"
4858
4859# This environment variable determines our operation mode.
4860if test \"\$libtool_install_magic\" = \"$magic\"; then
4861  # install mode needs the following variable:
4862  notinst_deplibs='$notinst_deplibs'
4863else
4864  # When we are sourced in execute mode, \$file and \$echo are already set.
4865  if test \"\$libtool_execute_magic\" != \"$magic\"; then
4866    echo=\"$qecho\"
4867    file=\"\$0\"
4868    # Make sure echo works.
4869    if test \"X\$1\" = X--no-reexec; then
4870      # Discard the --no-reexec flag, and continue.
4871      shift
4872    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4873      # Yippee, \$echo works!
4874      :
4875    else
4876      # Restart under the correct shell, and then maybe \$echo will work.
4877      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4878    fi
4879  fi\
4880"
4881        $echo >> $output "\
4882
4883  # Find the directory that this script lives in.
4884  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4885  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4886
4887  # Follow symbolic links until we get to the real thisdir.
4888  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4889  while test -n \"\$file\"; do
4890    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4891
4892    # If there was a directory component, then change thisdir.
4893    if test \"x\$destdir\" != \"x\$file\"; then
4894      case \"\$destdir\" in
4895      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4896      *) thisdir=\"\$thisdir/\$destdir\" ;;
4897      esac
4898    fi
4899
4900    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4901    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4902  done
4903
4904  # Try to get the absolute directory name.
4905  absdir=\`cd \"\$thisdir\" && pwd\`
4906  test -n \"\$absdir\" && thisdir=\"\$absdir\"
4907"
4908
4909        if test "$fast_install" = yes; then
4910          $echo >> $output "\
4911  program=lt-'$outputname'$exeext
4912  progdir=\"\$thisdir/$objdir\"
4913
4914  if test ! -f \"\$progdir/\$program\" || \\
4915     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4916       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4917
4918    file=\"\$\$-\$program\"
4919
4920    if test ! -d \"\$progdir\"; then
4921      $mkdir \"\$progdir\"
4922    else
4923      $rm \"\$progdir/\$file\"
4924    fi"
4925
4926          $echo >> $output "\
4927
4928    # relink executable if necessary
4929    if test -n \"\$relink_command\"; then
4930      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4931      else
4932        $echo \"\$relink_command_output\" >&2
4933        $rm \"\$progdir/\$file\"
4934        exit $EXIT_FAILURE
4935      fi
4936    fi
4937
4938    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4939    { $rm \"\$progdir/\$program\";
4940      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4941    $rm \"\$progdir/\$file\"
4942  fi"
4943        else
4944          $echo >> $output "\
4945  program='$outputname'
4946  progdir=\"\$thisdir/$objdir\"
4947"
4948        fi
4949
4950        $echo >> $output "\
4951
4952  if test -f \"\$progdir/\$program\"; then"
4953
4954        # Export our shlibpath_var if we have one.
4955        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4956          $echo >> $output "\
4957    # Add our own library path to $shlibpath_var
4958    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4959
4960    # Some systems cannot cope with colon-terminated $shlibpath_var
4961    # The second colon is a workaround for a bug in BeOS R4 sed
4962    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4963
4964    export $shlibpath_var
4965"
4966        fi
4967
4968        # fixup the dll searchpath if we need to.
4969        if test -n "$dllsearchpath"; then
4970          $echo >> $output "\
4971    # Add the dll search path components to the executable PATH
4972    PATH=$dllsearchpath:\$PATH
4973"
4974        fi
4975
4976        $echo >> $output "\
4977    if test \"\$libtool_execute_magic\" != \"$magic\"; then
4978      # Run the actual program with our arguments.
4979"
4980        case $host in
4981        # Backslashes separate directories on plain windows
4982        *-*-mingw | *-*-os2*)
4983          $echo >> $output "\
4984      exec \$progdir\\\\\$program \${1+\"\$@\"}
4985"
4986          ;;
4987
4988        *)
4989          $echo >> $output "\
4990      exec \$progdir/\$program \${1+\"\$@\"}
4991"
4992          ;;
4993        esac
4994        $echo >> $output "\
4995      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4996      exit $EXIT_FAILURE
4997    fi
4998  else
4999    # The program doesn't exist.
5000    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
5001    \$echo \"This script is just a wrapper for \$program.\" 1>&2
5002    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
5003    exit $EXIT_FAILURE
5004  fi
5005fi\
5006"
5007        chmod +x $output
5008      fi
5009      exit $EXIT_SUCCESS
5010      ;;
5011    esac
5012
5013    # See if we need to build an old-fashioned archive.
5014    for oldlib in $oldlibs; do
5015
5016      if test "$build_libtool_libs" = convenience; then
5017        oldobjs="$libobjs_save"
5018        addlibs="$convenience"
5019        build_libtool_libs=no
5020      else
5021        if test "$build_libtool_libs" = module; then
5022          oldobjs="$libobjs_save"
5023          build_libtool_libs=no
5024        else
5025          oldobjs="$old_deplibs $non_pic_objects"
5026        fi
5027        addlibs="$old_convenience"
5028      fi
5029
5030      if test -n "$addlibs"; then
5031        gentop="$output_objdir/${outputname}x"
5032        generated="$generated $gentop"
5033
5034        func_extract_archives $gentop $addlibs
5035        oldobjs="$oldobjs $func_extract_archives_result"
5036      fi
5037
5038      # Do each command in the archive commands.
5039      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5040       cmds=$old_archive_from_new_cmds
5041      else
5042        eval cmds=\"$old_archive_cmds\"
5043
5044        if len=`expr "X$cmds" : ".*"` &&
5045             test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5046          cmds=$old_archive_cmds
5047        else
5048          # the command line is too long to link in one step, link in parts
5049          $echo "using piecewise archive linking..."
5050          save_RANLIB=$RANLIB
5051          RANLIB=:
5052          objlist=
5053          concat_cmds=
5054          save_oldobjs=$oldobjs
5055          # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5056          # encoded into archives.  This makes 'ar r' malfunction in
5057          # this piecewise linking case whenever conflicting object
5058          # names appear in distinct ar calls; check, warn and compensate.
5059            if (for obj in $save_oldobjs
5060            do
5061              $echo "X$obj" | $Xsed -e 's%^.*/%%'
5062            done | sort | sort -uc >/dev/null 2>&1); then
5063            :
5064          else
5065            $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5066            $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5067            AR_FLAGS=cq
5068          fi
5069          # Is there a better way of finding the last object in the list?
5070          for obj in $save_oldobjs
5071          do
5072            last_oldobj=$obj
5073          done
5074          for obj in $save_oldobjs
5075          do
5076            oldobjs="$objlist $obj"
5077            objlist="$objlist $obj"
5078            eval test_cmds=\"$old_archive_cmds\"
5079            if len=`expr "X$test_cmds" : ".*"` &&
5080               test "$len" -le "$max_cmd_len"; then
5081              :
5082            else
5083              # the above command should be used before it gets too long
5084              oldobjs=$objlist
5085              if test "$obj" = "$last_oldobj" ; then
5086                RANLIB=$save_RANLIB
5087              fi
5088              test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5089              eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5090              objlist=
5091            fi
5092          done
5093          RANLIB=$save_RANLIB
5094          oldobjs=$objlist
5095          if test "X$oldobjs" = "X" ; then
5096            eval cmds=\"\$concat_cmds\"
5097          else
5098            eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
5099          fi
5100        fi
5101      fi
5102      save_ifs="$IFS"; IFS='~'
5103      for cmd in $cmds; do
5104        eval cmd=\"$cmd\"
5105        IFS="$save_ifs"
5106        $show "$cmd"
5107        $run eval "$cmd" || exit $?
5108      done
5109      IFS="$save_ifs"
5110    done
5111
5112    if test -n "$generated"; then
5113      $show "${rm}r$generated"
5114      $run ${rm}r$generated
5115    fi
5116
5117    # Now create the libtool archive.
5118    case $output in
5119    *.la)
5120      old_library=
5121      test "$build_old_libs" = yes && old_library="$libname.$libext"
5122      $show "creating $output"
5123
5124      # Preserve any variables that may affect compiler behavior
5125      for var in $variables_saved_for_relink; do
5126        if eval test -z \"\${$var+set}\"; then
5127          relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5128        elif eval var_value=\$$var; test -z "$var_value"; then
5129          relink_command="$var=; export $var; $relink_command"
5130        else
5131          var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5132          relink_command="$var=\"$var_value\"; export $var; $relink_command"
5133        fi
5134      done
5135      # Quote the link command for shipping.
5136      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5137      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5138      if test "$hardcode_automatic" = yes ; then
5139        relink_command=
5140      fi
5141
5142
5143      # Only create the output if not a dry run.
5144      if test -z "$run"; then
5145        for installed in no yes; do
5146          if test "$installed" = yes; then
5147            if test -z "$install_libdir"; then
5148              break
5149            fi
5150            output="$output_objdir/$outputname"i
5151            # Replace all uninstalled libtool libraries with the installed ones
5152            newdependency_libs=
5153            for deplib in $dependency_libs; do
5154              case $deplib in
5155              *.la)
5156                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5157                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5158                if test -z "$libdir"; then
5159                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5160                  exit $EXIT_FAILURE
5161                fi
5162                newdependency_libs="$newdependency_libs $libdir/$name"
5163                ;;
5164              *) newdependency_libs="$newdependency_libs $deplib" ;;
5165              esac
5166            done
5167            dependency_libs="$newdependency_libs"
5168            newdlfiles=
5169            for lib in $dlfiles; do
5170              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5171              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5172              if test -z "$libdir"; then
5173                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5174                exit $EXIT_FAILURE
5175              fi
5176              newdlfiles="$newdlfiles $libdir/$name"
5177            done
5178            dlfiles="$newdlfiles"
5179            newdlprefiles=
5180            for lib in $dlprefiles; do
5181              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5182              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5183              if test -z "$libdir"; then
5184                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5185                exit $EXIT_FAILURE
5186              fi
5187              newdlprefiles="$newdlprefiles $libdir/$name"
5188            done
5189            dlprefiles="$newdlprefiles"
5190          else
5191            newdlfiles=
5192            for lib in $dlfiles; do
5193              case $lib in
5194                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5195                *) abs=`pwd`"/$lib" ;;
5196              esac
5197              newdlfiles="$newdlfiles $abs"
5198            done
5199            dlfiles="$newdlfiles"
5200            newdlprefiles=
5201            for lib in $dlprefiles; do
5202              case $lib in
5203                [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5204                *) abs=`pwd`"/$lib" ;;
5205              esac
5206              newdlprefiles="$newdlprefiles $abs"
5207            done
5208            dlprefiles="$newdlprefiles"
5209          fi
5210          $rm $output
5211          # place dlname in correct position for cygwin
5212          tdlname=$dlname
5213          case $host,$output,$installed,$module,$dlname in
5214            *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5215          esac
5216          $echo > $output "\
5217# $outputname - a libtool library file
5218# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5219#
5220# Please DO NOT delete this file!
5221# It is necessary for linking the library.
5222
5223# The name that we can dlopen(3).
5224dlname='$tdlname'
5225
5226# Names of this library.
5227library_names='$library_names'
5228
5229# The name of the static archive.
5230old_library='$old_library'
5231
5232# Libraries that this one depends upon.
5233dependency_libs='$dependency_libs'
5234
5235# Version information for $libname.
5236current=$current
5237age=$age
5238revision=$revision
5239
5240# Is this an already installed library?
5241installed=$installed
5242
5243# Should we warn about portability when linking against -modules?
5244shouldnotlink=$module
5245
5246# Files to dlopen/dlpreopen
5247dlopen='$dlfiles'
5248dlpreopen='$dlprefiles'
5249
5250# Directory that this library needs to be installed in:
5251libdir='$install_libdir'"
5252          if test "$installed" = no && test "$need_relink" = yes; then
5253            $echo >> $output "\
5254relink_command=\"$relink_command\""
5255          fi
5256        done
5257      fi
5258
5259      # Do a symbolic link so that the libtool archive can be found in
5260      # LD_LIBRARY_PATH before the program is installed.
5261      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5262      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5263      ;;
5264    esac
5265    exit $EXIT_SUCCESS
5266    ;;
5267
5268  # libtool install mode
5269  install)
5270    modename="$modename: install"
5271
5272    # There may be an optional sh(1) argument at the beginning of
5273    # install_prog (especially on Windows NT).
5274    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5275       # Allow the use of GNU shtool's install command.
5276       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5277      # Aesthetically quote it.
5278      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5279      case $arg in
5280      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
5281        arg="\"$arg\""
5282        ;;
5283      esac
5284      install_prog="$arg "
5285      arg="$1"
5286      shift
5287    else
5288      install_prog=
5289      arg="$nonopt"
5290    fi
5291
5292    # The real first argument should be the name of the installation program.
5293    # Aesthetically quote it.
5294    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5295    case $arg in
5296    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
5297      arg="\"$arg\""
5298      ;;
5299    esac
5300    install_prog="$install_prog$arg"
5301
5302    # We need to accept at least all the BSD install flags.
5303    dest=
5304    files=
5305    opts=
5306    prev=
5307    install_type=
5308    isdir=no
5309    stripme=
5310    for arg
5311    do
5312      if test -n "$dest"; then
5313        files="$files $dest"
5314        dest="$arg"
5315        continue
5316      fi
5317
5318      case $arg in
5319      -d) isdir=yes ;;
5320      -f) prev="-f" ;;
5321      -g) prev="-g" ;;
5322      -m) prev="-m" ;;
5323      -o) prev="-o" ;;
5324      -s)
5325        stripme=" -s"
5326        continue
5327        ;;
5328      -*) ;;
5329
5330      *)
5331        # If the previous option needed an argument, then skip it.
5332        if test -n "$prev"; then
5333          prev=
5334        else
5335          dest="$arg"
5336          continue
5337        fi
5338        ;;
5339      esac
5340
5341      # Aesthetically quote the argument.
5342      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5343      case $arg in
5344      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
5345        arg="\"$arg\""
5346        ;;
5347      esac
5348      install_prog="$install_prog $arg"
5349    done
5350
5351    if test -z "$install_prog"; then
5352      $echo "$modename: you must specify an install program" 1>&2
5353      $echo "$help" 1>&2
5354      exit $EXIT_FAILURE
5355    fi
5356
5357    if test -n "$prev"; then
5358      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5359      $echo "$help" 1>&2
5360      exit $EXIT_FAILURE
5361    fi
5362
5363    if test -z "$files"; then
5364      if test -z "$dest"; then
5365        $echo "$modename: no file or destination specified" 1>&2
5366      else
5367        $echo "$modename: you must specify a destination" 1>&2
5368      fi
5369      $echo "$help" 1>&2
5370      exit $EXIT_FAILURE
5371    fi
5372
5373    # Strip any trailing slash from the destination.
5374    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5375
5376    # Check to see that the destination is a directory.
5377    test -d "$dest" && isdir=yes
5378    if test "$isdir" = yes; then
5379      destdir="$dest"
5380      destname=
5381    else
5382      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5383      test "X$destdir" = "X$dest" && destdir=.
5384      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5385
5386      # Not a directory, so check to see that there is only one file specified.
5387      set dummy $files
5388      if test "$#" -gt 2; then
5389        $echo "$modename: \`$dest' is not a directory" 1>&2
5390        $echo "$help" 1>&2
5391        exit $EXIT_FAILURE
5392      fi
5393    fi
5394    case $destdir in
5395    [\\/]* | [A-Za-z]:[\\/]*) ;;
5396    *)
5397      for file in $files; do
5398        case $file in
5399        *.lo) ;;
5400        *)
5401          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5402          $echo "$help" 1>&2
5403          exit $EXIT_FAILURE
5404          ;;
5405        esac
5406      done
5407      ;;
5408    esac
5409
5410    # This variable tells wrapper scripts just to set variables rather
5411    # than running their programs.
5412    libtool_install_magic="$magic"
5413
5414    staticlibs=
5415    future_libdirs=
5416    current_libdirs=
5417    for file in $files; do
5418
5419      # Do each installation.
5420      case $file in
5421      *.$libext)
5422        # Do the static libraries later.
5423        staticlibs="$staticlibs $file"
5424        ;;
5425
5426      *.la)
5427        # Check to see that this really is a libtool archive.
5428        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5429        else
5430          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5431          $echo "$help" 1>&2
5432          exit $EXIT_FAILURE
5433        fi
5434
5435        library_names=
5436        old_library=
5437        relink_command=
5438        # If there is no directory component, then add one.
5439        case $file in
5440        */* | *\\*) . $file ;;
5441        *) . ./$file ;;
5442        esac
5443
5444        # Add the libdir to current_libdirs if it is the destination.
5445        if test "X$destdir" = "X$libdir"; then
5446          case "$current_libdirs " in
5447          *" $libdir "*) ;;
5448          *) current_libdirs="$current_libdirs $libdir" ;;
5449          esac
5450        else
5451          # Note the libdir as a future libdir.
5452          case "$future_libdirs " in
5453          *" $libdir "*) ;;
5454          *) future_libdirs="$future_libdirs $libdir" ;;
5455          esac
5456        fi
5457
5458        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5459        test "X$dir" = "X$file/" && dir=
5460        dir="$dir$objdir"
5461
5462        if test -n "$relink_command"; then
5463          # Determine the prefix the user has applied to our future dir.
5464          inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5465
5466          # Don't allow the user to place us outside of our expected
5467          # location b/c this prevents finding dependent libraries that
5468          # are installed to the same prefix.
5469          # At present, this check doesn't affect windows .dll's that
5470          # are installed into $libdir/../bin (currently, that works fine)
5471          # but it's something to keep an eye on.
5472          if test "$inst_prefix_dir" = "$destdir"; then
5473            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5474            exit $EXIT_FAILURE
5475          fi
5476
5477          if test -n "$inst_prefix_dir"; then
5478            # Stick the inst_prefix_dir data into the link command.
5479            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5480          else
5481            relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5482          fi
5483
5484          $echo "$modename: warning: relinking \`$file'" 1>&2
5485          $show "$relink_command"
5486          if $run eval "$relink_command"; then :
5487          else
5488            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5489            exit $EXIT_FAILURE
5490          fi
5491        fi
5492
5493        # See the names of the shared library.
5494        set dummy $library_names
5495        if test -n "$2"; then
5496          realname="$2"
5497          shift
5498          shift
5499
5500          srcname="$realname"
5501          test -n "$relink_command" && srcname="$realname"T
5502
5503          # Install the shared library and build the symlinks.
5504          $show "$install_prog $dir/$srcname $destdir/$realname"
5505          $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5506          if test -n "$stripme" && test -n "$striplib"; then
5507            $show "$striplib $destdir/$realname"
5508            $run eval "$striplib $destdir/$realname" || exit $?
5509          fi
5510
5511          if test "$#" -gt 0; then
5512            # Delete the old symlinks, and create new ones.
5513            for linkname
5514            do
5515              if test "$linkname" != "$realname"; then
5516                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5517                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5518              fi
5519            done
5520          fi
5521
5522          # Do each command in the postinstall commands.
5523          lib="$destdir/$realname"
5524          cmds=$postinstall_cmds
5525          save_ifs="$IFS"; IFS='~'
5526          for cmd in $cmds; do
5527            IFS="$save_ifs"
5528            eval cmd=\"$cmd\"
5529            $show "$cmd"
5530            $run eval "$cmd" || exit $?
5531          done
5532          IFS="$save_ifs"
5533        fi
5534
5535        # Install the pseudo-library for information purposes.
5536        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5537        instname="$dir/$name"i
5538        $show "$install_prog $instname $destdir/$name"
5539        $run eval "$install_prog $instname $destdir/$name" || exit $?
5540
5541        # Maybe install the static library, too.
5542        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5543        ;;
5544
5545      *.lo)
5546        # Install (i.e. copy) a libtool object.
5547
5548        # Figure out destination file name, if it wasn't already specified.
5549        if test -n "$destname"; then
5550          destfile="$destdir/$destname"
5551        else
5552          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5553          destfile="$destdir/$destfile"
5554        fi
5555
5556        # Deduce the name of the destination old-style object file.
5557        case $destfile in
5558        *.lo)
5559          staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5560          ;;
5561        *.$objext)
5562          staticdest="$destfile"
5563          destfile=
5564          ;;
5565        *)
5566          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5567          $echo "$help" 1>&2
5568          exit $EXIT_FAILURE
5569          ;;
5570        esac
5571
5572        # Install the libtool object if requested.
5573        if test -n "$destfile"; then
5574          $show "$install_prog $file $destfile"
5575          $run eval "$install_prog $file $destfile" || exit $?
5576        fi
5577
5578        # Install the old object if enabled.
5579        if test "$build_old_libs" = yes; then
5580          # Deduce the name of the old-style object file.
5581          staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5582
5583          $show "$install_prog $staticobj $staticdest"
5584          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5585        fi
5586        exit $EXIT_SUCCESS
5587        ;;
5588
5589      *)
5590        # Figure out destination file name, if it wasn't already specified.
5591        if test -n "$destname"; then
5592          destfile="$destdir/$destname"
5593        else
5594          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5595          destfile="$destdir/$destfile"
5596        fi
5597
5598        # If the file is missing, and there is a .exe on the end, strip it
5599        # because it is most likely a libtool script we actually want to
5600        # install
5601        stripped_ext=""
5602        case $file in
5603          *.exe)
5604            if test ! -f "$file"; then
5605              file=`$echo $file|${SED} 's,.exe$,,'`
5606              stripped_ext=".exe"
5607            fi
5608            ;;
5609        esac
5610
5611        # Do a test to see if this is really a libtool program.
5612        case $host in
5613        *cygwin*|*mingw*)
5614            wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5615            ;;
5616        *)
5617            wrapper=$file
5618            ;;
5619        esac
5620        if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5621          notinst_deplibs=
5622          relink_command=
5623
5624          # To insure that "foo" is sourced, and not "foo.exe",
5625          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5626          # which disallows the automatic-append-.exe behavior.
5627          case $build in
5628          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5629          *) wrapperdot=${wrapper} ;;
5630          esac
5631          # If there is no directory component, then add one.
5632          case $file in
5633          */* | *\\*) . ${wrapperdot} ;;
5634          *) . ./${wrapperdot} ;;
5635          esac
5636
5637          # Check the variables that should have been set.
5638          if test -z "$notinst_deplibs"; then
5639            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5640            exit $EXIT_FAILURE
5641          fi
5642
5643          finalize=yes
5644          for lib in $notinst_deplibs; do
5645            # Check to see that each library is installed.
5646            libdir=
5647            if test -f "$lib"; then
5648              # If there is no directory component, then add one.
5649              case $lib in
5650              */* | *\\*) . $lib ;;
5651              *) . ./$lib ;;
5652              esac
5653            fi
5654            libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5655            if test -n "$libdir" && test ! -f "$libfile"; then
5656              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5657              finalize=no
5658            fi
5659          done
5660
5661          relink_command=
5662          # To insure that "foo" is sourced, and not "foo.exe",
5663          # finese the cygwin/MSYS system by explicitly sourcing "foo."
5664          # which disallows the automatic-append-.exe behavior.
5665          case $build in
5666          *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5667          *) wrapperdot=${wrapper} ;;
5668          esac
5669          # If there is no directory component, then add one.
5670          case $file in
5671          */* | *\\*) . ${wrapperdot} ;;
5672          *) . ./${wrapperdot} ;;
5673          esac
5674
5675          outputname=
5676          if test "$fast_install" = no && test -n "$relink_command"; then
5677            if test "$finalize" = yes && test -z "$run"; then
5678              tmpdir="/tmp"
5679              test -n "$TMPDIR" && tmpdir="$TMPDIR"
5680              tmpdir="$tmpdir/libtool-$$"
5681              save_umask=`umask`
5682              umask 0077
5683              if $mkdir "$tmpdir"; then
5684                umask $save_umask
5685              else
5686                umask $save_umask
5687                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5688                continue
5689              fi
5690              file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5691              outputname="$tmpdir/$file"
5692              # Replace the output file specification.
5693              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5694
5695              $show "$relink_command"
5696              if $run eval "$relink_command"; then :
5697              else
5698                $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5699                ${rm}r "$tmpdir"
5700                continue
5701              fi
5702              file="$outputname"
5703            else
5704              $echo "$modename: warning: cannot relink \`$file'" 1>&2
5705            fi
5706          else
5707            # Install the binary that we compiled earlier.
5708            file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5709          fi
5710        fi
5711
5712        # remove .exe since cygwin /usr/bin/install will append another
5713        # one anyways
5714        case $install_prog,$host in
5715        */usr/bin/install*,*cygwin*)
5716          case $file:$destfile in
5717          *.exe:*.exe)
5718            # this is ok
5719            ;;
5720          *.exe:*)
5721            destfile=$destfile.exe
5722            ;;
5723          *:*.exe)
5724            destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5725            ;;
5726          esac
5727          ;;
5728        esac
5729        $show "$install_prog$stripme $file $destfile"
5730        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5731        test -n "$outputname" && ${rm}r "$tmpdir"
5732        ;;
5733      esac
5734    done
5735
5736    for file in $staticlibs; do
5737      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5738
5739      # Set up the ranlib parameters.
5740      oldlib="$destdir/$name"
5741
5742      $show "$install_prog $file $oldlib"
5743      $run eval "$install_prog \$file \$oldlib" || exit $?
5744
5745      if test -n "$stripme" && test -n "$old_striplib"; then
5746        $show "$old_striplib $oldlib"
5747        $run eval "$old_striplib $oldlib" || exit $?
5748      fi
5749
5750      # Do each command in the postinstall commands.
5751      cmds=$old_postinstall_cmds
5752      save_ifs="$IFS"; IFS='~'
5753      for cmd in $cmds; do
5754        IFS="$save_ifs"
5755        eval cmd=\"$cmd\"
5756        $show "$cmd"
5757        $run eval "$cmd" || exit $?
5758      done
5759      IFS="$save_ifs"
5760    done
5761
5762    if test -n "$future_libdirs"; then
5763      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5764    fi
5765
5766    if test -n "$current_libdirs"; then
5767      # Maybe just do a dry run.
5768      test -n "$run" && current_libdirs=" -n$current_libdirs"
5769      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
5770    else
5771      exit $EXIT_SUCCESS
5772    fi
5773    ;;
5774
5775  # libtool finish mode
5776  finish)
5777    modename="$modename: finish"
5778    libdirs="$nonopt"
5779    admincmds=
5780
5781    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5782      for dir
5783      do
5784        libdirs="$libdirs $dir"
5785      done
5786
5787      for libdir in $libdirs; do
5788        if test -n "$finish_cmds"; then
5789          # Do each command in the finish commands.
5790          cmds=$finish_cmds
5791          save_ifs="$IFS"; IFS='~'
5792          for cmd in $cmds; do
5793            IFS="$save_ifs"
5794            eval cmd=\"$cmd\"
5795            $show "$cmd"
5796            $run eval "$cmd" || admincmds="$admincmds
5797       $cmd"
5798          done
5799          IFS="$save_ifs"
5800        fi
5801        if test -n "$finish_eval"; then
5802          # Do the single finish_eval.
5803          eval cmds=\"$finish_eval\"
5804          $run eval "$cmds" || admincmds="$admincmds
5805       $cmds"
5806        fi
5807      done
5808    fi
5809
5810    # Exit here if they wanted silent mode.
5811    test "$show" = : && exit $EXIT_SUCCESS
5812
5813    $echo "----------------------------------------------------------------------"
5814    $echo "Libraries have been installed in:"
5815    for libdir in $libdirs; do
5816      $echo "   $libdir"
5817    done
5818    $echo
5819    $echo "If you ever happen to want to link against installed libraries"
5820    $echo "in a given directory, LIBDIR, you must either use libtool, and"
5821    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5822    $echo "flag during linking and do at least one of the following:"
5823    if test -n "$shlibpath_var"; then
5824      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
5825      $echo "     during execution"
5826    fi
5827    if test -n "$runpath_var"; then
5828      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
5829      $echo "     during linking"
5830    fi
5831    if test -n "$hardcode_libdir_flag_spec"; then
5832      libdir=LIBDIR
5833      eval flag=\"$hardcode_libdir_flag_spec\"
5834
5835      $echo "   - use the \`$flag' linker flag"
5836    fi
5837    if test -n "$admincmds"; then
5838      $echo "   - have your system administrator run these commands:$admincmds"
5839    fi
5840    if test -f /etc/ld.so.conf; then
5841      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5842    fi
5843    $echo
5844    $echo "See any operating system documentation about shared libraries for"
5845    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5846    $echo "----------------------------------------------------------------------"
5847    exit $EXIT_SUCCESS
5848    ;;
5849
5850  # libtool execute mode
5851  execute)
5852    modename="$modename: execute"
5853
5854    # The first argument is the command name.
5855    cmd="$nonopt"
5856    if test -z "$cmd"; then
5857      $echo "$modename: you must specify a COMMAND" 1>&2
5858      $echo "$help"
5859      exit $EXIT_FAILURE
5860    fi
5861
5862    # Handle -dlopen flags immediately.
5863    for file in $execute_dlfiles; do
5864      if test ! -f "$file"; then
5865        $echo "$modename: \`$file' is not a file" 1>&2
5866        $echo "$help" 1>&2
5867        exit $EXIT_FAILURE
5868      fi
5869
5870      dir=
5871      case $file in
5872      *.la)
5873        # Check to see that this really is a libtool archive.
5874        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5875        else
5876          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5877          $echo "$help" 1>&2
5878          exit $EXIT_FAILURE
5879        fi
5880
5881        # Read the libtool library.
5882        dlname=
5883        library_names=
5884
5885        # If there is no directory component, then add one.
5886        case $file in
5887        */* | *\\*) . $file ;;
5888        *) . ./$file ;;
5889        esac
5890
5891        # Skip this library if it cannot be dlopened.
5892        if test -z "$dlname"; then
5893          # Warn if it was a shared library.
5894          test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5895          continue
5896        fi
5897
5898        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5899        test "X$dir" = "X$file" && dir=.
5900
5901        if test -f "$dir/$objdir/$dlname"; then
5902          dir="$dir/$objdir"
5903        else
5904          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5905          exit $EXIT_FAILURE
5906        fi
5907        ;;
5908
5909      *.lo)
5910        # Just add the directory containing the .lo file.
5911        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5912        test "X$dir" = "X$file" && dir=.
5913        ;;
5914
5915      *)
5916        $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5917        continue
5918        ;;
5919      esac
5920
5921      # Get the absolute pathname.
5922      absdir=`cd "$dir" && pwd`
5923      test -n "$absdir" && dir="$absdir"
5924
5925      # Now add the directory to shlibpath_var.
5926      if eval "test -z \"\$$shlibpath_var\""; then
5927        eval "$shlibpath_var=\"\$dir\""
5928      else
5929        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5930      fi
5931    done
5932
5933    # This variable tells wrapper scripts just to set shlibpath_var
5934    # rather than running their programs.
5935    libtool_execute_magic="$magic"
5936
5937    # Check if any of the arguments is a wrapper script.
5938    args=
5939    for file
5940    do
5941      case $file in
5942      -*) ;;
5943      *)
5944        # Do a test to see if this is really a libtool program.
5945        if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5946          # If there is no directory component, then add one.
5947          case $file in
5948          */* | *\\*) . $file ;;
5949          *) . ./$file ;;
5950          esac
5951
5952          # Transform arg to wrapped name.
5953          file="$progdir/$program"
5954        fi
5955        ;;
5956      esac
5957      # Quote arguments (to preserve shell metacharacters).
5958      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5959      args="$args \"$file\""
5960    done
5961
5962    if test -z "$run"; then
5963      if test -n "$shlibpath_var"; then
5964        # Export the shlibpath_var.
5965        eval "export $shlibpath_var"
5966      fi
5967
5968      # Restore saved environment variables
5969      if test "${save_LC_ALL+set}" = set; then
5970        LC_ALL="$save_LC_ALL"; export LC_ALL
5971      fi
5972      if test "${save_LANG+set}" = set; then
5973        LANG="$save_LANG"; export LANG
5974      fi
5975
5976      # Now prepare to actually exec the command.
5977      exec_cmd="\$cmd$args"
5978    else
5979      # Display what would be done.
5980      if test -n "$shlibpath_var"; then
5981        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5982        $echo "export $shlibpath_var"
5983      fi
5984      $echo "$cmd$args"
5985      exit $EXIT_SUCCESS
5986    fi
5987    ;;
5988
5989  # libtool clean and uninstall mode
5990  clean | uninstall)
5991    modename="$modename: $mode"
5992    rm="$nonopt"
5993    files=
5994    rmforce=
5995    exit_status=0
5996
5997    # This variable tells wrapper scripts just to set variables rather
5998    # than running their programs.
5999    libtool_install_magic="$magic"
6000
6001    for arg
6002    do
6003      case $arg in
6004      -f) rm="$rm $arg"; rmforce=yes ;;
6005      -*) rm="$rm $arg" ;;
6006      *) files="$files $arg" ;;
6007      esac
6008    done
6009
6010    if test -z "$rm"; then
6011      $echo "$modename: you must specify an RM program" 1>&2
6012      $echo "$help" 1>&2
6013      exit $EXIT_FAILURE
6014    fi
6015
6016    rmdirs=
6017
6018    origobjdir="$objdir"
6019    for file in $files; do
6020      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6021      if test "X$dir" = "X$file"; then
6022        dir=.
6023        objdir="$origobjdir"
6024      else
6025        objdir="$dir/$origobjdir"
6026      fi
6027      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6028      test "$mode" = uninstall && objdir="$dir"
6029
6030      # Remember objdir for removal later, being careful to avoid duplicates
6031      if test "$mode" = clean; then
6032        case " $rmdirs " in
6033          *" $objdir "*) ;;
6034          *) rmdirs="$rmdirs $objdir" ;;
6035        esac
6036      fi
6037
6038      # Don't error if the file doesn't exist and rm -f was used.
6039      if (test -L "$file") >/dev/null 2>&1 \
6040        || (test -h "$file") >/dev/null 2>&1 \
6041        || test -f "$file"; then
6042        :
6043      elif test -d "$file"; then
6044        exit_status=1
6045        continue
6046      elif test "$rmforce" = yes; then
6047        continue
6048      fi
6049
6050      rmfiles="$file"
6051
6052      case $name in
6053      *.la)
6054        # Possibly a libtool archive, so verify it.
6055        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6056          . $dir/$name
6057
6058          # Delete the libtool libraries and symlinks.
6059          for n in $library_names; do
6060            rmfiles="$rmfiles $objdir/$n"
6061          done
6062          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6063          test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6064
6065          if test "$mode" = uninstall; then
6066            if test -n "$library_names"; then
6067              # Do each command in the postuninstall commands.
6068              cmds=$postuninstall_cmds
6069              save_ifs="$IFS"; IFS='~'
6070              for cmd in $cmds; do
6071                IFS="$save_ifs"
6072                eval cmd=\"$cmd\"
6073                $show "$cmd"
6074                $run eval "$cmd"
6075                if test "$?" -ne 0 && test "$rmforce" != yes; then
6076                  exit_status=1
6077                fi
6078              done
6079              IFS="$save_ifs"
6080            fi
6081
6082            if test -n "$old_library"; then
6083              # Do each command in the old_postuninstall commands.
6084              cmds=$old_postuninstall_cmds
6085              save_ifs="$IFS"; IFS='~'
6086              for cmd in $cmds; do
6087                IFS="$save_ifs"
6088                eval cmd=\"$cmd\"
6089                $show "$cmd"
6090                $run eval "$cmd"
6091                if test "$?" -ne 0 && test "$rmforce" != yes; then
6092                  exit_status=1
6093                fi
6094              done
6095              IFS="$save_ifs"
6096            fi
6097            # FIXME: should reinstall the best remaining shared library.
6098          fi
6099        fi
6100        ;;
6101
6102      *.lo)
6103        # Possibly a libtool object, so verify it.
6104        if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6105
6106          # Read the .lo file
6107          . $dir/$name
6108
6109          # Add PIC object to the list of files to remove.
6110          if test -n "$pic_object" \
6111             && test "$pic_object" != none; then
6112            rmfiles="$rmfiles $dir/$pic_object"
6113          fi
6114
6115          # Add non-PIC object to the list of files to remove.
6116          if test -n "$non_pic_object" \
6117             && test "$non_pic_object" != none; then
6118            rmfiles="$rmfiles $dir/$non_pic_object"
6119          fi
6120        fi
6121        ;;
6122
6123      *)
6124        if test "$mode" = clean ; then
6125          noexename=$name
6126          case $file in
6127          *.exe)
6128            file=`$echo $file|${SED} 's,.exe$,,'`
6129            noexename=`$echo $name|${SED} 's,.exe$,,'`
6130            # $file with .exe has already been added to rmfiles,
6131            # add $file without .exe
6132            rmfiles="$rmfiles $file"
6133            ;;
6134          esac
6135          # Do a test to see if this is a libtool program.
6136          if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6137            relink_command=
6138            . $dir/$noexename
6139
6140            # note $name still contains .exe if it was in $file originally
6141            # as does the version of $file that was added into $rmfiles
6142            rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6143            if test "$fast_install" = yes && test -n "$relink_command"; then
6144              rmfiles="$rmfiles $objdir/lt-$name"
6145            fi
6146            if test "X$noexename" != "X$name" ; then
6147              rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6148            fi
6149          fi
6150        fi
6151        ;;
6152      esac
6153      $show "$rm $rmfiles"
6154      $run $rm $rmfiles || exit_status=1
6155    done
6156    objdir="$origobjdir"
6157
6158    # Try to remove the ${objdir}s in the directories where we deleted files
6159    for dir in $rmdirs; do
6160      if test -d "$dir"; then
6161        $show "rmdir $dir"
6162        $run rmdir $dir >/dev/null 2>&1
6163      fi
6164    done
6165
6166    exit $exit_status
6167    ;;
6168
6169  "")
6170    $echo "$modename: you must specify a MODE" 1>&2
6171    $echo "$generic_help" 1>&2
6172    exit $EXIT_FAILURE
6173    ;;
6174  esac
6175
6176  if test -z "$exec_cmd"; then
6177    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6178    $echo "$generic_help" 1>&2
6179    exit $EXIT_FAILURE
6180  fi
6181fi # test -z "$show_help"
6182
6183if test -n "$exec_cmd"; then
6184  eval exec $exec_cmd
6185  exit $EXIT_FAILURE
6186fi
6187
6188# We need to display help for each of the modes.
6189case $mode in
6190"") $echo \
6191"Usage: $modename [OPTION]... [MODE-ARG]...
6192
6193Provide generalized library-building support services.
6194
6195    --config          show all configuration variables
6196    --debug           enable verbose shell tracing
6197-n, --dry-run         display commands without modifying any files
6198    --features        display basic configuration information and exit
6199    --finish          same as \`--mode=finish'
6200    --help            display this help message and exit
6201    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
6202    --quiet           same as \`--silent'
6203    --silent          don't print informational messages
6204    --tag=TAG         use configuration variables from tag TAG
6205    --version         print version information
6206
6207MODE must be one of the following:
6208
6209      clean           remove files from the build directory
6210      compile         compile a source file into a libtool object
6211      execute         automatically set library path, then run a program
6212      finish          complete the installation of libtool libraries
6213      install         install libraries or executables
6214      link            create a library or an executable
6215      uninstall       remove libraries from an installed directory
6216
6217MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
6218a more detailed description of MODE.
6219
6220Report bugs to <bug-libtool@gnu.org>."
6221  exit $EXIT_SUCCESS
6222  ;;
6223
6224clean)
6225  $echo \
6226"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6227
6228Remove files from the build directory.
6229
6230RM is the name of the program to use to delete files associated with each FILE
6231(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6232to RM.
6233
6234If FILE is a libtool library, object or program, all the files associated
6235with it are deleted. Otherwise, only FILE itself is deleted using RM."
6236  ;;
6237
6238compile)
6239  $echo \
6240"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6241
6242Compile a source file into a libtool library object.
6243
6244This mode accepts the following additional options:
6245
6246  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
6247  -prefer-pic       try to building PIC objects only
6248  -prefer-non-pic   try to building non-PIC objects only
6249  -static           always build a \`.o' file suitable for static linking
6250
6251COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6252from the given SOURCEFILE.
6253
6254The output file name is determined by removing the directory component from
6255SOURCEFILE, then substituting the C source code suffix \`.c' with the
6256library object suffix, \`.lo'."
6257  ;;
6258
6259execute)
6260  $echo \
6261"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6262
6263Automatically set library path, then run a program.
6264
6265This mode accepts the following additional options:
6266
6267  -dlopen FILE      add the directory containing FILE to the library path
6268
6269This mode sets the library path environment variable according to \`-dlopen'
6270flags.
6271
6272If any of the ARGS are libtool executable wrappers, then they are translated
6273into their corresponding uninstalled binary, and any of their required library
6274directories are added to the library path.
6275
6276Then, COMMAND is executed, with ARGS as arguments."
6277  ;;
6278
6279finish)
6280  $echo \
6281"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6282
6283Complete the installation of libtool libraries.
6284
6285Each LIBDIR is a directory that contains libtool libraries.
6286
6287The commands that this mode executes may require superuser privileges.  Use
6288the \`--dry-run' option if you just want to see what would be executed."
6289  ;;
6290
6291install)
6292  $echo \
6293"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6294
6295Install executables or libraries.
6296
6297INSTALL-COMMAND is the installation command.  The first component should be
6298either the \`install' or \`cp' program.
6299
6300The rest of the components are interpreted as arguments to that command (only
6301BSD-compatible install options are recognized)."
6302  ;;
6303
6304link)
6305  $echo \
6306"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6307
6308Link object files or libraries together to form another library, or to
6309create an executable program.
6310
6311LINK-COMMAND is a command using the C compiler that you would use to create
6312a program from several object files.
6313
6314The following components of LINK-COMMAND are treated specially:
6315
6316  -all-static       do not do any dynamic linking at all
6317  -avoid-version    do not add a version suffix if possible
6318  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
6319  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6320  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6321  -export-symbols SYMFILE
6322                    try to export only the symbols listed in SYMFILE
6323  -export-symbols-regex REGEX
6324                    try to export only the symbols matching REGEX
6325  -LLIBDIR          search LIBDIR for required installed libraries
6326  -lNAME            OUTPUT-FILE requires the installed library libNAME
6327  -module           build a library that can dlopened
6328  -no-fast-install  disable the fast-install mode
6329  -no-install       link a not-installable executable
6330  -no-undefined     declare that a library does not refer to external symbols
6331  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6332  -objectlist FILE  Use a list of object files found in FILE to specify objects
6333  -precious-files-regex REGEX
6334                    don't remove output files matching REGEX
6335  -release RELEASE  specify package release information
6336  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6337  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6338  -static           do not do any dynamic linking of libtool libraries
6339  -version-info CURRENT[:REVISION[:AGE]]
6340                    specify library version info [each variable defaults to 0]
6341
6342All other options (arguments beginning with \`-') are ignored.
6343
6344Every other argument is treated as a filename.  Files ending in \`.la' are
6345treated as uninstalled libtool libraries, other files are standard or library
6346object files.
6347
6348If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6349only library objects (\`.lo' files) may be specified, and \`-rpath' is
6350required, except when creating a convenience library.
6351
6352If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6353using \`ar' and \`ranlib', or on Windows using \`lib'.
6354
6355If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6356is created, otherwise an executable program is created."
6357  ;;
6358
6359uninstall)
6360  $echo \
6361"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6362
6363Remove libraries from an installation directory.
6364
6365RM is the name of the program to use to delete files associated with each FILE
6366(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6367to RM.
6368
6369If FILE is a libtool library, all the files associated with it are deleted.
6370Otherwise, only FILE itself is deleted using RM."
6371  ;;
6372
6373*)
6374  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6375  $echo "$help" 1>&2
6376  exit $EXIT_FAILURE
6377  ;;
6378esac
6379
6380$echo
6381$echo "Try \`$modename --help' for more information about other modes."
6382
6383exit $EXIT_SUCCESS
6384
6385# The TAGs below are defined such that we never get into a situation
6386# in which we disable both kinds of libraries.  Given conflicting
6387# choices, we go for a static library, that is the most portable,
6388# since we can't tell whether shared libraries were disabled because
6389# the user asked for that or because the platform doesn't support
6390# them.  This is particularly important on AIX, because we don't
6391# support having both static and shared libraries enabled at the same
6392# time on that platform, so we default to a shared-only configuration.
6393# If a disable-shared tag is given, we'll fallback to a static-only
6394# configuration.  But we'll never go from static-only to shared-only.
6395
6396# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6397build_libtool_libs=no
6398build_old_libs=yes
6399# ### END LIBTOOL TAG CONFIG: disable-shared
6400
6401# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6402build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6403# ### END LIBTOOL TAG CONFIG: disable-static
6404
6405# Local Variables:
6406# mode:shell-script
6407# sh-indentation:2
6408# End:
Note: See TracBrowser for help on using the repository browser.