source: trunk/third/gtk-engines/ltmain.sh @ 18625

Revision 18625, 140.5 KB checked in by ghudson, 22 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r18624, 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
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
27# Check that we have a working $echo.
28if test "X$1" = X--no-reexec; then
29  # Discard the --no-reexec flag, and continue.
30  shift
31elif test "X$1" = X--fallback-echo; then
32  # Avoid inline document here, it may be left over
33  :
34elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35  # Yippee, $echo works!
36  :
37else
38  # Restart under the correct shell, and then maybe $echo will work.
39  exec $SHELL "$0" --no-reexec ${1+"$@"}
40fi
41
42if test "X$1" = X--fallback-echo; then
43  # used as fallback echo
44  shift
45  cat <<EOF
46$*
47EOF
48  exit 0
49fi
50
51# The name of this program.
52progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53modename="$progname"
54
55# Constants.
56PROGRAM=ltmain.sh
57PACKAGE=libtool
58VERSION=1.4.3
59TIMESTAMP=" (1.922.2.111 2002/10/23 02:54:36)"
60
61default_mode=
62help="Try \`$progname --help' for more information."
63magic="%%%MAGIC variable%%%"
64mkdir="mkdir"
65mv="mv -f"
66rm="rm -f"
67
68# Sed substitution that helps us do robust quoting.  It backslashifies
69# metacharacters that are still active within double-quoted strings.
70Xsed="${SED}"' -e 1s/^X//'
71sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72# test EBCDIC or ASCII                                                         
73case `echo A|od -x` in                                                         
74 *[Cc]1*) # EBCDIC based system                                               
75  SP2NL="tr '\100' '\n'"                                                       
76  NL2SP="tr '\r\n' '\100\100'"                                                 
77  ;;                                                                           
78 *) # Assume ASCII based system                                               
79  SP2NL="tr '\040' '\012'"                                                     
80  NL2SP="tr '\015\012' '\040\040'"                                             
81  ;;                                                                           
82esac                                                                           
83
84# NLS nuisances.
85# Only set LANG and LC_ALL to C if already set.
86# These must not be set unconditionally because not all systems understand
87# e.g. LANG=C (notably SCO).
88# We save the old values to restore during execute mode.
89if test "${LC_ALL+set}" = set; then
90  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
91fi
92if test "${LANG+set}" = set; then
93  save_LANG="$LANG"; LANG=C; export LANG
94fi
95
96# Make sure IFS has a sensible default
97: ${IFS="       "}
98
99if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100  echo "$modename: not configured to build any kind of library" 1>&2
101  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
102  exit 1
103fi
104
105# Global variables.
106mode=$default_mode
107nonopt=
108prev=
109prevopt=
110run=
111show="$echo"
112show_help=
113execute_dlfiles=
114lo2o="s/\\.lo\$/.${objext}/"
115o2lo="s/\\.${objext}\$/.lo/"
116
117# Parse our command line options once, thoroughly.
118while test $# -gt 0
119do
120  arg="$1"
121  shift
122
123  case $arg in
124  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
125  *) optarg= ;;
126  esac
127
128  # If the previous option needs an argument, assign it.
129  if test -n "$prev"; then
130    case $prev in
131    execute_dlfiles)
132      execute_dlfiles="$execute_dlfiles $arg"
133      ;;
134    *)
135      eval "$prev=\$arg"
136      ;;
137    esac
138
139    prev=
140    prevopt=
141    continue
142  fi
143
144  # Have we seen a non-optional argument yet?
145  case $arg in
146  --help)
147    show_help=yes
148    ;;
149
150  --version)
151    echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
152    exit 0
153    ;;
154
155  --config)
156    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
157    exit 0
158    ;;
159
160  --debug)
161    echo "$progname: enabling shell trace mode"
162    set -x
163    ;;
164
165  --dry-run | -n)
166    run=:
167    ;;
168
169  --features)
170    echo "host: $host"
171    if test "$build_libtool_libs" = yes; then
172      echo "enable shared libraries"
173    else
174      echo "disable shared libraries"
175    fi
176    if test "$build_old_libs" = yes; then
177      echo "enable static libraries"
178    else
179      echo "disable static libraries"
180    fi
181    exit 0
182    ;;
183
184  --finish) mode="finish" ;;
185
186  --mode) prevopt="--mode" prev=mode ;;
187  --mode=*) mode="$optarg" ;;
188
189  --preserve-dup-deps) duplicate_deps="yes" ;;
190
191  --quiet | --silent)
192    show=:
193    ;;
194
195  -dlopen)
196    prevopt="-dlopen"
197    prev=execute_dlfiles
198    ;;
199
200  -*)
201    $echo "$modename: unrecognized option \`$arg'" 1>&2
202    $echo "$help" 1>&2
203    exit 1
204    ;;
205
206  *)
207    nonopt="$arg"
208    break
209    ;;
210  esac
211done
212
213if test -n "$prevopt"; then
214  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
215  $echo "$help" 1>&2
216  exit 1
217fi
218
219# If this variable is set in any of the actions, the command in it
220# will be execed at the end.  This prevents here-documents from being
221# left over by shells.
222exec_cmd=
223
224if test -z "$show_help"; then
225
226  # Infer the operation mode.
227  if test -z "$mode"; then
228    case $nonopt in
229    *cc | *++ | gcc* | *-gcc* | xlc*)
230      mode=link
231      for arg
232      do
233        case $arg in
234        -c)
235           mode=compile
236           break
237           ;;
238        esac
239      done
240      ;;
241    *db | *dbx | *strace | *truss)
242      mode=execute
243      ;;
244    *install*|cp|mv)
245      mode=install
246      ;;
247    *rm)
248      mode=uninstall
249      ;;
250    *)
251      # If we have no mode, but dlfiles were specified, then do execute mode.
252      test -n "$execute_dlfiles" && mode=execute
253
254      # Just use the default operation mode.
255      if test -z "$mode"; then
256        if test -n "$nonopt"; then
257          $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
258        else
259          $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
260        fi
261      fi
262      ;;
263    esac
264  fi
265
266  # Only execute mode is allowed to have -dlopen flags.
267  if test -n "$execute_dlfiles" && test "$mode" != execute; then
268    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
269    $echo "$help" 1>&2
270    exit 1
271  fi
272
273  # Change the help message to a mode-specific one.
274  generic_help="$help"
275  help="Try \`$modename --help --mode=$mode' for more information."
276
277  # These modes are in order of execution frequency so that they run quickly.
278  case $mode in
279  # libtool compile mode
280  compile)
281    modename="$modename: compile"
282    # Get the compilation command and the source file.
283    base_compile=
284    prev=
285    lastarg=
286    srcfile="$nonopt"
287    suppress_output=
288
289    user_target=no
290    for arg
291    do
292      case $prev in
293      "") ;;
294      xcompiler)
295        # Aesthetically quote the previous argument.
296        prev=
297        lastarg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
298
299        case $arg in
300        # Double-quote args containing other shell metacharacters.
301        # Many Bourne shells cannot handle close brackets correctly
302        # in scan sets, so we specify it separately.
303        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
304          arg="\"$arg\""
305          ;;
306        esac
307
308        # Add the previous argument to base_compile.
309        if test -z "$base_compile"; then
310          base_compile="$lastarg"
311        else
312          base_compile="$base_compile $lastarg"
313        fi
314        continue
315        ;;
316      esac
317
318      # Accept any command-line options.
319      case $arg in
320      -o)
321        if test "$user_target" != "no"; then
322          $echo "$modename: you cannot specify \`-o' more than once" 1>&2
323          exit 1
324        fi
325        user_target=next
326        ;;
327
328      -static)
329        build_old_libs=yes
330        continue
331        ;;
332
333      -prefer-pic)
334        pic_mode=yes
335        continue
336        ;;
337
338      -prefer-non-pic)
339        pic_mode=no
340        continue
341        ;;
342
343      -Xcompiler)
344        prev=xcompiler
345        continue
346        ;;
347
348      -Wc,*)
349        args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
350        lastarg=
351        save_ifs="$IFS"; IFS=','
352        for arg in $args; do
353          IFS="$save_ifs"
354
355          # Double-quote args containing other shell metacharacters.
356          # Many Bourne shells cannot handle close brackets correctly
357          # in scan sets, so we specify it separately.
358          case $arg in
359            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
360            arg="\"$arg\""
361            ;;
362          esac
363          lastarg="$lastarg $arg"
364        done
365        IFS="$save_ifs"
366        lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
367
368        # Add the arguments to base_compile.
369        if test -z "$base_compile"; then
370          base_compile="$lastarg"
371        else
372          base_compile="$base_compile $lastarg"
373        fi
374        continue
375        ;;
376      esac
377
378      case $user_target in
379      next)
380        # The next one is the -o target name
381        user_target=yes
382        continue
383        ;;
384      yes)
385        # We got the output file
386        user_target=set
387        libobj="$arg"
388        continue
389        ;;
390      esac
391
392      # Accept the current argument as the source file.
393      lastarg="$srcfile"
394      srcfile="$arg"
395
396      # Aesthetically quote the previous argument.
397
398      # Backslashify any backslashes, double quotes, and dollar signs.
399      # These are the only characters that are still specially
400      # interpreted inside of double-quoted scrings.
401      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
402
403      # Double-quote args containing other shell metacharacters.
404      # Many Bourne shells cannot handle close brackets correctly
405      # in scan sets, so we specify it separately.
406      case $lastarg in
407      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
408        lastarg="\"$lastarg\""
409        ;;
410      esac
411
412      # Add the previous argument to base_compile.
413      if test -z "$base_compile"; then
414        base_compile="$lastarg"
415      else
416        base_compile="$base_compile $lastarg"
417      fi
418    done
419
420    case $user_target in
421    set)
422      ;;
423    no)
424      # Get the name of the library object.
425      libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
426      ;;
427    *)
428      $echo "$modename: you must specify a target with \`-o'" 1>&2
429      exit 1
430      ;;
431    esac
432
433    # Recognize several different file suffixes.
434    # If the user specifies -o file.o, it is replaced with file.lo
435    xform='[cCFSfmso]'
436    case $libobj in
437    *.ada) xform=ada ;;
438    *.adb) xform=adb ;;
439    *.ads) xform=ads ;;
440    *.asm) xform=asm ;;
441    *.c++) xform=c++ ;;
442    *.cc) xform=cc ;;
443    *.cpp) xform=cpp ;;
444    *.cxx) xform=cxx ;;
445    *.f90) xform=f90 ;;
446    *.for) xform=for ;;
447    esac
448
449    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
450
451    case $libobj in
452    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
453    *)
454      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
455      exit 1
456      ;;
457    esac
458
459    if test -z "$base_compile"; then
460      $echo "$modename: you must specify a compilation command" 1>&2
461      $echo "$help" 1>&2
462      exit 1
463    fi
464
465    # Delete any leftover library objects.
466    if test "$build_old_libs" = yes; then
467      removelist="$obj $libobj"
468    else
469      removelist="$libobj"
470    fi
471
472    $run $rm $removelist
473    trap "$run $rm $removelist; exit 1" 1 2 15
474
475    # On Cygwin there's no "real" PIC flag so we must build both object types
476    case $host_os in
477    cygwin* | mingw* | pw32* | os2*)
478      pic_mode=default
479      ;;
480    esac
481    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
482      # non-PIC code in shared libraries is not supported
483      pic_mode=default
484    fi
485
486    # Calculate the filename of the output object if compiler does
487    # not support -o with -c
488    if test "$compiler_c_o" = no; then
489      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
490      lockfile="$output_obj.lock"
491      removelist="$removelist $output_obj $lockfile"
492      trap "$run $rm $removelist; exit 1" 1 2 15
493    else
494      need_locks=no
495      lockfile=
496    fi
497
498    # Lock this critical section if it is needed
499    # We use this script file to make the link, it avoids creating a new file
500    if test "$need_locks" = yes; then
501      until $run ln "$0" "$lockfile" 2>/dev/null; do
502        $show "Waiting for $lockfile to be removed"
503        sleep 2
504      done
505    elif test "$need_locks" = warn; then
506      if test -f "$lockfile"; then
507        echo "\
508*** ERROR, $lockfile exists and contains:
509`cat $lockfile 2>/dev/null`
510
511This indicates that another process is trying to use the same
512temporary object file, and libtool could not work around it because
513your compiler does not support \`-c' and \`-o' together.  If you
514repeat this compilation, it may succeed, by chance, but you had better
515avoid parallel builds (make -j) in this platform, or get a better
516compiler."
517
518        $run $rm $removelist
519        exit 1
520      fi
521      echo $srcfile > "$lockfile"
522    fi
523
524    if test -n "$fix_srcfile_path"; then
525      eval srcfile=\"$fix_srcfile_path\"
526    fi
527
528    # Only build a PIC object if we are building libtool libraries.
529    if test "$build_libtool_libs" = yes; then
530      # Without this assignment, base_compile gets emptied.
531      fbsd_hideous_sh_bug=$base_compile
532
533      if test "$pic_mode" != no; then
534        # All platforms use -DPIC, to notify preprocessed assembler code.
535        command="$base_compile $srcfile $pic_flag -DPIC"
536      else
537        # Don't build PIC code
538        command="$base_compile $srcfile"
539      fi
540      if test "$build_old_libs" = yes; then
541        lo_libobj="$libobj"
542        dir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
543        if test "X$dir" = "X$libobj"; then
544          dir="$objdir"
545        else
546          dir="$dir/$objdir"
547        fi
548        libobj="$dir/"`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
549
550        if test -d "$dir"; then
551          $show "$rm $libobj"
552          $run $rm $libobj
553        else
554          $show "$mkdir $dir"
555          $run $mkdir $dir
556          status=$?
557          if test $status -ne 0 && test ! -d $dir; then
558            exit $status
559          fi
560        fi
561      fi
562      if test "$compiler_o_lo" = yes; then
563        output_obj="$libobj"
564        command="$command -o $output_obj"
565      elif test "$compiler_c_o" = yes; then
566        output_obj="$obj"
567        command="$command -o $output_obj"
568      fi
569
570      $run $rm "$output_obj"
571      $show "$command"
572      if $run eval "$command"; then :
573      else
574        test -n "$output_obj" && $run $rm $removelist
575        exit 1
576      fi
577
578      if test "$need_locks" = warn &&
579         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
580        echo "\
581*** ERROR, $lockfile contains:
582`cat $lockfile 2>/dev/null`
583
584but it should contain:
585$srcfile
586
587This indicates that another process is trying to use the same
588temporary object file, and libtool could not work around it because
589your compiler does not support \`-c' and \`-o' together.  If you
590repeat this compilation, it may succeed, by chance, but you had better
591avoid parallel builds (make -j) in this platform, or get a better
592compiler."
593
594        $run $rm $removelist
595        exit 1
596      fi
597
598      # Just move the object if needed, then go on to compile the next one
599      if test x"$output_obj" != x"$libobj"; then
600        $show "$mv $output_obj $libobj"
601        if $run $mv $output_obj $libobj; then :
602        else
603          error=$?
604          $run $rm $removelist
605          exit $error
606        fi
607      fi
608
609      # If we have no pic_flag, then copy the object into place and finish.
610      if (test -z "$pic_flag" || test "$pic_mode" != default) &&
611         test "$build_old_libs" = yes; then
612        # Rename the .lo from within objdir to obj
613        if test -f $obj; then
614          $show $rm $obj
615          $run $rm $obj
616        fi
617
618        $show "$mv $libobj $obj"
619        if $run $mv $libobj $obj; then :
620        else
621          error=$?
622          $run $rm $removelist
623          exit $error
624        fi
625
626        xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
627        if test "X$xdir" = "X$obj"; then
628          xdir="."
629        else
630          xdir="$xdir"
631        fi
632        baseobj=`$echo "X$obj" | $Xsed -e "s%.*/%%"`
633        libobj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
634        # Now arrange that obj and lo_libobj become the same file
635        $show "(cd $xdir && $LN_S $baseobj $libobj)"
636        if $run eval '(cd $xdir && $LN_S $baseobj $libobj)'; then
637          # Unlock the critical section if it was locked
638          if test "$need_locks" != no; then
639            $run $rm "$lockfile"
640          fi
641          exit 0
642        else
643          error=$?
644          $run $rm $removelist
645          exit $error
646        fi
647      fi
648
649      # Allow error messages only from the first compilation.
650      suppress_output=' >/dev/null 2>&1'
651    fi
652
653    # Only build a position-dependent object if we build old libraries.
654    if test "$build_old_libs" = yes; then
655      if test "$pic_mode" != yes; then
656        # Don't build PIC code
657        command="$base_compile $srcfile"
658      else
659        # All platforms use -DPIC, to notify preprocessed assembler code.
660        command="$base_compile $srcfile $pic_flag -DPIC"
661      fi
662      if test "$compiler_c_o" = yes; then
663        command="$command -o $obj"
664        output_obj="$obj"
665      fi
666
667      # Suppress compiler output if we already did a PIC compilation.
668      command="$command$suppress_output"
669      $run $rm "$output_obj"
670      $show "$command"
671      if $run eval "$command"; then :
672      else
673        $run $rm $removelist
674        exit 1
675      fi
676
677      if test "$need_locks" = warn &&
678         test x"`cat $lockfile 2>/dev/null`" != x"$srcfile"; then
679        echo "\
680*** ERROR, $lockfile contains:
681`cat $lockfile 2>/dev/null`
682
683but it should contain:
684$srcfile
685
686This indicates that another process is trying to use the same
687temporary object file, and libtool could not work around it because
688your compiler does not support \`-c' and \`-o' together.  If you
689repeat this compilation, it may succeed, by chance, but you had better
690avoid parallel builds (make -j) in this platform, or get a better
691compiler."
692
693        $run $rm $removelist
694        exit 1
695      fi
696
697      # Just move the object if needed
698      if test x"$output_obj" != x"$obj"; then
699        $show "$mv $output_obj $obj"
700        if $run $mv $output_obj $obj; then :
701        else
702          error=$?
703          $run $rm $removelist
704          exit $error
705        fi
706      fi
707
708      # Create an invalid libtool object if no PIC, so that we do not
709      # accidentally link it into a program.
710      if test "$build_libtool_libs" != yes; then
711        $show "echo timestamp > $libobj"
712        $run eval "echo timestamp > \$libobj" || exit $?
713      else
714        # Move the .lo from within objdir
715        $show "$mv $libobj $lo_libobj"
716        if $run $mv $libobj $lo_libobj; then :
717        else
718          error=$?
719          $run $rm $removelist
720          exit $error
721        fi
722      fi
723    fi
724
725    # Unlock the critical section if it was locked
726    if test "$need_locks" != no; then
727      $run $rm "$lockfile"
728    fi
729
730    exit 0
731    ;;
732
733  # libtool link mode
734  link | relink)
735    modename="$modename: link"
736    case $host in
737    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
738      # It is impossible to link a dll without this setting, and
739      # we shouldn't force the makefile maintainer to figure out
740      # which system we are compiling for in order to pass an extra
741      # flag for every libtool invokation.
742      # allow_undefined=no
743
744      # FIXME: Unfortunately, there are problems with the above when trying
745      # to make a dll which has undefined symbols, in which case not
746      # even a static library is built.  For now, we need to specify
747      # -no-undefined on the libtool link line when we can be certain
748      # that all symbols are satisfied, otherwise we get a static library.
749      allow_undefined=yes
750      ;;
751    *)
752      allow_undefined=yes
753      ;;
754    esac
755    libtool_args="$nonopt"
756    compile_command="$nonopt"
757    finalize_command="$nonopt"
758
759    compile_rpath=
760    finalize_rpath=
761    compile_shlibpath=
762    finalize_shlibpath=
763    convenience=
764    old_convenience=
765    deplibs=
766    old_deplibs=
767    compiler_flags=
768    linker_flags=
769    dllsearchpath=
770    lib_search_path=`pwd`
771    inst_prefix_dir=
772
773    avoid_version=no
774    dlfiles=
775    dlprefiles=
776    dlself=no
777    export_dynamic=no
778    export_symbols=
779    export_symbols_regex=
780    generated=
781    libobjs=
782    ltlibs=
783    module=no
784    no_install=no
785    objs=
786    prefer_static_libs=no
787    preload=no
788    prev=
789    prevarg=
790    release=
791    rpath=
792    xrpath=
793    perm_rpath=
794    temp_rpath=
795    thread_safe=no
796    vinfo=
797
798    # We need to know -static, to get the right output filenames.
799    for arg
800    do
801      case $arg in
802      -all-static | -static)
803        if test "X$arg" = "X-all-static"; then
804          if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
805            $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
806          fi
807          if test -n "$link_static_flag"; then
808            dlopen_self=$dlopen_self_static
809          fi
810        else
811          if test -z "$pic_flag" && test -n "$link_static_flag"; then
812            dlopen_self=$dlopen_self_static
813          fi
814        fi
815        build_libtool_libs=no
816        build_old_libs=yes
817        prefer_static_libs=yes
818        break
819        ;;
820      esac
821    done
822
823    # See if our shared archives depend on static archives.
824    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
825
826    # Go through the arguments, transforming them on the way.
827    while test $# -gt 0; do
828      arg="$1"
829      shift
830      case $arg in
831      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*|"")
832        qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
833        ;;
834      *) qarg=$arg ;;
835      esac
836      libtool_args="$libtool_args $qarg"
837
838      # If the previous option needs an argument, assign it.
839      if test -n "$prev"; then
840        case $prev in
841        output)
842          compile_command="$compile_command @OUTPUT@"
843          finalize_command="$finalize_command @OUTPUT@"
844          ;;
845        esac
846
847        case $prev in
848        dlfiles|dlprefiles)
849          if test "$preload" = no; then
850            # Add the symbol object into the linking commands.
851            compile_command="$compile_command @SYMFILE@"
852            finalize_command="$finalize_command @SYMFILE@"
853            preload=yes
854          fi
855          case $arg in
856          *.la | *.lo) ;;  # We handle these cases below.
857          force)
858            if test "$dlself" = no; then
859              dlself=needless
860              export_dynamic=yes
861            fi
862            prev=
863            continue
864            ;;
865          self)
866            if test "$prev" = dlprefiles; then
867              dlself=yes
868            elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
869              dlself=yes
870            else
871              dlself=needless
872              export_dynamic=yes
873            fi
874            prev=
875            continue
876            ;;
877          *)
878            if test "$prev" = dlfiles; then
879              dlfiles="$dlfiles $arg"
880            else
881              dlprefiles="$dlprefiles $arg"
882            fi
883            prev=
884            continue
885            ;;
886          esac
887          ;;
888        expsyms)
889          export_symbols="$arg"
890          if test ! -f "$arg"; then
891            $echo "$modename: symbol file \`$arg' does not exist"
892            exit 1
893          fi
894          prev=
895          continue
896          ;;
897        expsyms_regex)
898          export_symbols_regex="$arg"
899          prev=
900          continue
901          ;;
902        inst_prefix)
903          inst_prefix_dir="$arg"
904          prev=
905          continue
906          ;;
907        release)
908          release="-$arg"
909          prev=
910          continue
911          ;;
912        rpath | xrpath)
913          # We need an absolute path.
914          case $arg in
915          [\\/]* | [A-Za-z]:[\\/]*) ;;
916          *)
917            $echo "$modename: only absolute run-paths are allowed" 1>&2
918            exit 1
919            ;;
920          esac
921          if test "$prev" = rpath; then
922            case "$rpath " in
923            *" $arg "*) ;;
924            *) rpath="$rpath $arg" ;;
925            esac
926          else
927            case "$xrpath " in
928            *" $arg "*) ;;
929            *) xrpath="$xrpath $arg" ;;
930            esac
931          fi
932          prev=
933          continue
934          ;;
935        xcompiler)
936          compiler_flags="$compiler_flags $qarg"
937          prev=
938          compile_command="$compile_command $qarg"
939          finalize_command="$finalize_command $qarg"
940          continue
941          ;;
942        xlinker)
943          linker_flags="$linker_flags $qarg"
944          compiler_flags="$compiler_flags $wl$qarg"
945          prev=
946          compile_command="$compile_command $wl$qarg"
947          finalize_command="$finalize_command $wl$qarg"
948          continue
949          ;;
950        *)
951          eval "$prev=\"\$arg\""
952          prev=
953          continue
954          ;;
955        esac
956      fi # test -n $prev
957
958      prevarg="$arg"
959
960      case $arg in
961      -all-static)
962        if test -n "$link_static_flag"; then
963          compile_command="$compile_command $link_static_flag"
964          finalize_command="$finalize_command $link_static_flag"
965        fi
966        continue
967        ;;
968
969      -allow-undefined)
970        # FIXME: remove this flag sometime in the future.
971        $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
972        continue
973        ;;
974
975      -avoid-version)
976        avoid_version=yes
977        continue
978        ;;
979
980      -dlopen)
981        prev=dlfiles
982        continue
983        ;;
984
985      -dlpreopen)
986        prev=dlprefiles
987        continue
988        ;;
989
990      -export-dynamic)
991        export_dynamic=yes
992        continue
993        ;;
994
995      -export-symbols | -export-symbols-regex)
996        if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
997          $echo "$modename: more than one -exported-symbols argument is not allowed"
998          exit 1
999        fi
1000        if test "X$arg" = "X-export-symbols"; then
1001          prev=expsyms
1002        else
1003          prev=expsyms_regex
1004        fi
1005        continue
1006        ;;
1007
1008      -inst-prefix-dir)
1009        prev=inst_prefix
1010        continue
1011        ;;
1012
1013      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1014      # so, if we see these flags be careful not to treat them like -L
1015      -L[A-Z][A-Z]*:*)
1016        case $with_gcc/$host in
1017        no/*-*-irix* | no/*-*-nonstopux*)
1018          compile_command="$compile_command $arg"
1019          finalize_command="$finalize_command $arg"
1020          ;;
1021        esac
1022        continue
1023        ;;
1024
1025      -L*)
1026        dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1027        # We need an absolute path.
1028        case $dir in
1029        [\\/]* | [A-Za-z]:[\\/]*) ;;
1030        *)
1031          absdir=`cd "$dir" && pwd`
1032          if test -z "$absdir"; then
1033            $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1034            exit 1
1035          fi
1036          dir="$absdir"
1037          ;;
1038        esac
1039        case "$deplibs " in
1040        *" -L$dir "*) ;;
1041        *)
1042          deplibs="$deplibs -L$dir"
1043          lib_search_path="$lib_search_path $dir"
1044          ;;
1045        esac
1046        case $host in
1047        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1048          case :$dllsearchpath: in
1049          *":$dir:"*) ;;
1050          *) dllsearchpath="$dllsearchpath:$dir";;
1051          esac
1052          ;;
1053        esac
1054        continue
1055        ;;
1056
1057      -l*)
1058        if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1059          case $host in
1060          *-*-cygwin* | *-*-pw32* | *-*-beos*)
1061            # These systems don't actually have a C or math library (as such)
1062            continue
1063            ;;
1064          *-*-mingw* | *-*-os2*)
1065            # These systems don't actually have a C library (as such)
1066            test "X$arg" = "X-lc" && continue
1067            ;;
1068          *-*-openbsd* | *-*-freebsd*)
1069            # Do not include libc due to us having libc/libc_r.
1070            test "X$arg" = "X-lc" && continue
1071            ;;
1072          esac
1073         elif test "X$arg" = "X-lc_r"; then
1074          case $host in
1075         *-*-openbsd* | *-*-freebsd*)
1076            # Do not include libc_r directly, use -pthread flag.
1077            continue
1078            ;;
1079          esac
1080        fi
1081        deplibs="$deplibs $arg"
1082        continue
1083        ;;
1084
1085      -module)
1086        module=yes
1087        continue
1088        ;;
1089
1090      -no-fast-install)
1091        fast_install=no
1092        continue
1093        ;;
1094
1095      -no-install)
1096        case $host in
1097        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1098          # The PATH hackery in wrapper scripts is required on Windows
1099          # in order for the loader to find any dlls it needs.
1100          $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1101          $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1102          fast_install=no
1103          ;;
1104        *) no_install=yes ;;
1105        esac
1106        continue
1107        ;;
1108
1109      -no-undefined)
1110        allow_undefined=no
1111        continue
1112        ;;
1113
1114      -o) prev=output ;;
1115
1116      -release)
1117        prev=release
1118        continue
1119        ;;
1120
1121      -rpath)
1122        prev=rpath
1123        continue
1124        ;;
1125
1126      -R)
1127        prev=xrpath
1128        continue
1129        ;;
1130
1131      -R*)
1132        dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1133        # We need an absolute path.
1134        case $dir in
1135        [\\/]* | [A-Za-z]:[\\/]*) ;;
1136        *)
1137          $echo "$modename: only absolute run-paths are allowed" 1>&2
1138          exit 1
1139          ;;
1140        esac
1141        case "$xrpath " in
1142        *" $dir "*) ;;
1143        *) xrpath="$xrpath $dir" ;;
1144        esac
1145        continue
1146        ;;
1147
1148      -static)
1149        # The effects of -static are defined in a previous loop.
1150        # We used to do the same as -all-static on platforms that
1151        # didn't have a PIC flag, but the assumption that the effects
1152        # would be equivalent was wrong.  It would break on at least
1153        # Digital Unix and AIX.
1154        continue
1155        ;;
1156
1157      -thread-safe)
1158        thread_safe=yes
1159        continue
1160        ;;
1161
1162      -version-info)
1163        prev=vinfo
1164        continue
1165        ;;
1166
1167      -Wc,*)
1168        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1169        arg=
1170        save_ifs="$IFS"; IFS=','
1171        for flag in $args; do
1172          IFS="$save_ifs"
1173          case $flag in
1174            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1175            flag="\"$flag\""
1176            ;;
1177          esac
1178          arg="$arg $wl$flag"
1179          compiler_flags="$compiler_flags $flag"
1180        done
1181        IFS="$save_ifs"
1182        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1183        ;;
1184
1185      -Wl,*)
1186        args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1187        arg=
1188        save_ifs="$IFS"; IFS=','
1189        for flag in $args; do
1190          IFS="$save_ifs"
1191          case $flag in
1192            *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*|"")
1193            flag="\"$flag\""
1194            ;;
1195          esac
1196          arg="$arg $wl$flag"
1197          compiler_flags="$compiler_flags $wl$flag"
1198          linker_flags="$linker_flags $flag"
1199        done
1200        IFS="$save_ifs"
1201        arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1202        ;;
1203
1204      -Xcompiler)
1205        prev=xcompiler
1206        continue
1207        ;;
1208
1209      -Xlinker)
1210        prev=xlinker
1211        continue
1212        ;;
1213
1214      # Some other compiler flag.
1215      -* | +*)
1216        # Unknown arguments in both finalize_command and compile_command need
1217        # to be aesthetically quoted because they are evaled later.
1218        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1219        case $arg in
1220        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1221          arg="\"$arg\""
1222          ;;
1223        esac
1224        ;;
1225
1226      *.lo | *.$objext)
1227        # A library or standard object.
1228        if test "$prev" = dlfiles; then
1229          # This file was specified with -dlopen.
1230          if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1231            dlfiles="$dlfiles $arg"
1232            prev=
1233            continue
1234          else
1235            # If libtool objects are unsupported, then we need to preload.
1236            prev=dlprefiles
1237          fi
1238        fi
1239
1240        if test "$prev" = dlprefiles; then
1241          # Preload the old-style object.
1242          dlprefiles="$dlprefiles "`$echo "X$arg" | $Xsed -e "$lo2o"`
1243          prev=
1244        else
1245          case $arg in
1246          *.lo) libobjs="$libobjs $arg" ;;
1247          *) objs="$objs $arg" ;;
1248          esac
1249        fi
1250        ;;
1251
1252      *.$libext)
1253        # An archive.
1254        deplibs="$deplibs $arg"
1255        old_deplibs="$old_deplibs $arg"
1256        continue
1257        ;;
1258
1259      *.la)
1260        # A libtool-controlled library.
1261
1262        if test "$prev" = dlfiles; then
1263          # This library was specified with -dlopen.
1264          dlfiles="$dlfiles $arg"
1265          prev=
1266        elif test "$prev" = dlprefiles; then
1267          # The library was specified with -dlpreopen.
1268          dlprefiles="$dlprefiles $arg"
1269          prev=
1270        else
1271          deplibs="$deplibs $arg"
1272        fi
1273        continue
1274        ;;
1275
1276      # Some other compiler argument.
1277      *)
1278        # Unknown arguments in both finalize_command and compile_command need
1279        # to be aesthetically quoted because they are evaled later.
1280        arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1281        case $arg in
1282        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \   ]*|*]*|"")
1283          arg="\"$arg\""
1284          ;;
1285        esac
1286        ;;
1287      esac # arg
1288
1289      # Now actually substitute the argument into the commands.
1290      if test -n "$arg"; then
1291        compile_command="$compile_command $arg"
1292        finalize_command="$finalize_command $arg"
1293      fi
1294    done # argument parsing loop
1295
1296    if test -n "$prev"; then
1297      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1298      $echo "$help" 1>&2
1299      exit 1
1300    fi
1301
1302    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1303      eval arg=\"$export_dynamic_flag_spec\"
1304      compile_command="$compile_command $arg"
1305      finalize_command="$finalize_command $arg"
1306    fi
1307
1308    # calculate the name of the file, without its directory
1309    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1310    libobjs_save="$libobjs"
1311
1312    if test -n "$shlibpath_var"; then
1313      # get the directories listed in $shlibpath_var
1314      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1315    else
1316      shlib_search_path=
1317    fi
1318    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1319    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1320
1321    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1322    if test "X$output_objdir" = "X$output"; then
1323      output_objdir="$objdir"
1324    else
1325      output_objdir="$output_objdir/$objdir"
1326    fi
1327    # Create the object directory.
1328    if test ! -d $output_objdir; then
1329      $show "$mkdir $output_objdir"
1330      $run $mkdir $output_objdir
1331      status=$?
1332      if test $status -ne 0 && test ! -d $output_objdir; then
1333        exit $status
1334      fi
1335    fi
1336
1337    # Determine the type of output
1338    case $output in
1339    "")
1340      $echo "$modename: you must specify an output file" 1>&2
1341      $echo "$help" 1>&2
1342      exit 1
1343      ;;
1344    *.$libext) linkmode=oldlib ;;
1345    *.lo | *.$objext) linkmode=obj ;;
1346    *.la) linkmode=lib ;;
1347    *) linkmode=prog ;; # Anything else should be a program.
1348    esac
1349
1350    specialdeplibs=
1351    libs=
1352    # Find all interdependent deplibs by searching for libraries
1353    # that are linked more than once (e.g. -la -lb -la)
1354    for deplib in $deplibs; do
1355      if test "X$duplicate_deps" = "Xyes" ; then
1356        case "$libs " in
1357        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1358        esac
1359      fi
1360      libs="$libs $deplib"
1361    done
1362    deplibs=
1363    newdependency_libs=
1364    newlib_search_path=
1365    need_relink=no # whether we're linking any uninstalled libtool libraries
1366    notinst_deplibs= # not-installed libtool libraries
1367    notinst_path= # paths that contain not-installed libtool libraries
1368    case $linkmode in
1369    lib)
1370        passes="conv link"
1371        for file in $dlfiles $dlprefiles; do
1372          case $file in
1373          *.la) ;;
1374          *)
1375            $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1376            exit 1
1377            ;;
1378          esac
1379        done
1380        ;;
1381    prog)
1382        compile_deplibs=
1383        finalize_deplibs=
1384        alldeplibs=no
1385        newdlfiles=
1386        newdlprefiles=
1387        passes="conv scan dlopen dlpreopen link"
1388        ;;
1389    *)  passes="conv"
1390        ;;
1391    esac
1392    for pass in $passes; do
1393      if test $linkmode = prog; then
1394        # Determine which files to process
1395        case $pass in
1396        dlopen)
1397          libs="$dlfiles"
1398          save_deplibs="$deplibs" # Collect dlpreopened libraries
1399          deplibs=
1400          ;;
1401        dlpreopen) libs="$dlprefiles" ;;
1402        link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1403        esac
1404      fi
1405      for deplib in $libs; do
1406        lib=
1407        found=no
1408        case $deplib in
1409        -l*)
1410          if test $linkmode = oldlib && test $linkmode = obj; then
1411            $echo "$modename: warning: \`-l' is ignored for archives/objects: $deplib" 1>&2
1412            continue
1413          fi
1414          if test $pass = conv; then
1415            deplibs="$deplib $deplibs"
1416            continue
1417          fi
1418          name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1419          for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1420            # Search the libtool library
1421            lib="$searchdir/lib${name}.la"
1422            if test -f "$lib"; then
1423              found=yes
1424              break
1425            fi
1426          done
1427          if test "$found" != yes; then
1428            # deplib doesn't seem to be a libtool library
1429            if test "$linkmode,$pass" = "prog,link"; then
1430              compile_deplibs="$deplib $compile_deplibs"
1431              finalize_deplibs="$deplib $finalize_deplibs"
1432            else
1433              deplibs="$deplib $deplibs"
1434              test $linkmode = lib && newdependency_libs="$deplib $newdependency_libs"
1435            fi
1436            continue
1437          fi
1438          ;; # -l
1439        -L*)
1440          case $linkmode in
1441          lib)
1442            deplibs="$deplib $deplibs"
1443            test $pass = conv && continue
1444            newdependency_libs="$deplib $newdependency_libs"
1445            newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1446            ;;
1447          prog)
1448            if test $pass = conv; then
1449              deplibs="$deplib $deplibs"
1450              continue
1451            fi
1452            if test $pass = scan; then
1453              deplibs="$deplib $deplibs"
1454              newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1455            else
1456              compile_deplibs="$deplib $compile_deplibs"
1457              finalize_deplibs="$deplib $finalize_deplibs"
1458            fi
1459            ;;
1460          *)
1461            $echo "$modename: warning: \`-L' is ignored for archives/objects: $deplib" 1>&2
1462            ;;
1463          esac # linkmode
1464          continue
1465          ;; # -L
1466        -R*)
1467          if test $pass = link; then
1468            dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1469            # Make sure the xrpath contains only unique directories.
1470            case "$xrpath " in
1471            *" $dir "*) ;;
1472            *) xrpath="$xrpath $dir" ;;
1473            esac
1474          fi
1475          deplibs="$deplib $deplibs"
1476          continue
1477          ;;
1478        *.la) lib="$deplib" ;;
1479        *.$libext)
1480          if test $pass = conv; then
1481            deplibs="$deplib $deplibs"
1482            continue
1483          fi
1484          case $linkmode in
1485          lib)
1486            if test "$deplibs_check_method" != pass_all; then
1487              echo
1488              echo "*** Warning: Trying to link with static lib archive $deplib."
1489              echo "*** I have the capability to make that library automatically link in when"
1490              echo "*** you link to this library.  But I can only do this if you have a"
1491              echo "*** shared version of the library, which you do not appear to have"
1492              echo "*** because the file extensions .$libext of this argument makes me believe"
1493              echo "*** that it is just a static archive that I should not used here."
1494            else
1495              echo
1496              echo "*** Warning: Linking the shared library $output against the"
1497              echo "*** static library $deplib is not portable!"
1498              deplibs="$deplib $deplibs"
1499            fi
1500            continue
1501            ;;
1502          prog)
1503            if test $pass != link; then
1504              deplibs="$deplib $deplibs"
1505            else
1506              compile_deplibs="$deplib $compile_deplibs"
1507              finalize_deplibs="$deplib $finalize_deplibs"
1508            fi
1509            continue
1510            ;;
1511          esac # linkmode
1512          ;; # *.$libext
1513        *.lo | *.$objext)
1514          if test $pass = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1515            # If there is no dlopen support or we're linking statically,
1516            # we need to preload.
1517            newdlprefiles="$newdlprefiles $deplib"
1518            compile_deplibs="$deplib $compile_deplibs"
1519            finalize_deplibs="$deplib $finalize_deplibs"
1520          else
1521            newdlfiles="$newdlfiles $deplib"
1522          fi
1523          continue
1524          ;;
1525        %DEPLIBS%)
1526          alldeplibs=yes
1527          continue
1528          ;;
1529        esac # case $deplib
1530        if test $found = yes || test -f "$lib"; then :
1531        else
1532          $echo "$modename: cannot find the library \`$lib'" 1>&2
1533          exit 1
1534        fi
1535
1536        # Check to see that this really is a libtool archive.
1537        if (${SED} -e '2q' $lib | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
1538        else
1539          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
1540          exit 1
1541        fi
1542
1543        ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1544        test "X$ladir" = "X$lib" && ladir="."
1545
1546        dlname=
1547        dlopen=
1548        dlpreopen=
1549        libdir=
1550        library_names=
1551        old_library=
1552        # If the library was installed with an old release of libtool,
1553        # it will not redefine variable installed.
1554        installed=yes
1555
1556        # Read the .la file
1557        case $lib in
1558        */* | *\\*) . $lib ;;
1559        *) . ./$lib ;;
1560        esac
1561
1562        if test "$linkmode,$pass" = "lib,link" ||
1563           test "$linkmode,$pass" = "prog,scan" ||
1564           { test $linkmode = oldlib && test $linkmode = obj; }; then
1565           # Add dl[pre]opened files of deplib
1566          test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
1567          test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
1568        fi
1569
1570        if test $pass = conv; then
1571          # Only check for convenience libraries
1572          deplibs="$lib $deplibs"
1573          if test -z "$libdir"; then
1574            if test -z "$old_library"; then
1575              $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1576              exit 1
1577            fi
1578            # It is a libtool convenience library, so add in its objects.
1579            convenience="$convenience $ladir/$objdir/$old_library"
1580            old_convenience="$old_convenience $ladir/$objdir/$old_library"
1581            tmp_libs=
1582            for deplib in $dependency_libs; do
1583              deplibs="$deplib $deplibs"
1584              if test "X$duplicate_deps" = "Xyes" ; then
1585                case "$tmp_libs " in
1586                *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1587                esac
1588              fi
1589              tmp_libs="$tmp_libs $deplib"
1590            done
1591          elif test $linkmode != prog && test $linkmode != lib; then
1592            $echo "$modename: \`$lib' is not a convenience library" 1>&2
1593            exit 1
1594          fi
1595          continue
1596        fi # $pass = conv
1597
1598        # Get the name of the library we link against.
1599        linklib=
1600        for l in $old_library $library_names; do
1601          linklib="$l"
1602        done
1603        if test -z "$linklib"; then
1604          $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
1605          exit 1
1606        fi
1607
1608        # This library was specified with -dlopen.
1609        if test $pass = dlopen; then
1610          if test -z "$libdir"; then
1611            $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
1612            exit 1
1613          fi
1614          if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1615            # If there is no dlname, no dlopen support or we're linking
1616            # statically, we need to preload.
1617            dlprefiles="$dlprefiles $lib"
1618          else
1619            newdlfiles="$newdlfiles $lib"
1620          fi
1621          continue
1622        fi # $pass = dlopen
1623
1624        # We need an absolute path.
1625        case $ladir in
1626        [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
1627        *)
1628          abs_ladir=`cd "$ladir" && pwd`
1629          if test -z "$abs_ladir"; then
1630            $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
1631            $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
1632            abs_ladir="$ladir"
1633          fi
1634          ;;
1635        esac
1636        laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
1637
1638        # Find the relevant object directory and library name.
1639        if test "X$installed" = Xyes; then
1640          if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
1641            $echo "$modename: warning: library \`$lib' was moved." 1>&2
1642            dir="$ladir"
1643            absdir="$abs_ladir"
1644            libdir="$abs_ladir"
1645          else
1646            dir="$libdir"
1647            absdir="$libdir"
1648          fi
1649        else
1650          dir="$ladir/$objdir"
1651          absdir="$abs_ladir/$objdir"
1652          # Remove this search path later
1653          notinst_path="$notinst_path $abs_ladir"
1654        fi # $installed = yes
1655        name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
1656
1657        # This library was specified with -dlpreopen.
1658        if test $pass = dlpreopen; then
1659          if test -z "$libdir"; then
1660            $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
1661            exit 1
1662          fi
1663          # Prefer using a static library (so that no silly _DYNAMIC symbols
1664          # are required to link).
1665          if test -n "$old_library"; then
1666            newdlprefiles="$newdlprefiles $dir/$old_library"
1667          # Otherwise, use the dlname, so that lt_dlopen finds it.
1668          elif test -n "$dlname"; then
1669            newdlprefiles="$newdlprefiles $dir/$dlname"
1670          else
1671            newdlprefiles="$newdlprefiles $dir/$linklib"
1672          fi
1673        fi # $pass = dlpreopen
1674
1675        if test -z "$libdir"; then
1676          # Link the convenience library
1677          if test $linkmode = lib; then
1678            deplibs="$dir/$old_library $deplibs"
1679          elif test "$linkmode,$pass" = "prog,link"; then
1680            compile_deplibs="$dir/$old_library $compile_deplibs"
1681            finalize_deplibs="$dir/$old_library $finalize_deplibs"
1682          else
1683            deplibs="$lib $deplibs"
1684          fi
1685          continue
1686        fi
1687
1688        if test $linkmode = prog && test $pass != link; then
1689          newlib_search_path="$newlib_search_path $ladir"
1690          deplibs="$lib $deplibs"
1691
1692          linkalldeplibs=no
1693          if test "$link_all_deplibs" != no || test -z "$library_names" ||
1694             test "$build_libtool_libs" = no; then
1695            linkalldeplibs=yes
1696          fi
1697
1698          tmp_libs=
1699          for deplib in $dependency_libs; do
1700            case $deplib in
1701            -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
1702            esac
1703            # Need to link against all dependency_libs?
1704            if test $linkalldeplibs = yes; then
1705              deplibs="$deplib $deplibs"
1706            else
1707              # Need to hardcode shared library paths
1708              # or/and link against static libraries
1709              newdependency_libs="$deplib $newdependency_libs"
1710            fi
1711            if test "X$duplicate_deps" = "Xyes" ; then
1712              case "$tmp_libs " in
1713              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1714              esac
1715            fi
1716            tmp_libs="$tmp_libs $deplib"
1717          done # for deplib
1718          continue
1719        fi # $linkmode = prog...
1720
1721        link_static=no # Whether the deplib will be linked statically
1722        if test -n "$library_names" &&
1723           { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
1724          # Link against this shared library
1725
1726          if test "$linkmode,$pass" = "prog,link" ||
1727           { test $linkmode = lib && test $hardcode_into_libs = yes; }; then
1728            # Hardcode the library path.
1729            # Skip directories that are in the system default run-time
1730            # search path.
1731            case " $sys_lib_dlsearch_path " in
1732            *" $absdir "*) ;;
1733            *)
1734              case "$compile_rpath " in
1735              *" $absdir "*) ;;
1736              *) compile_rpath="$compile_rpath $absdir"
1737              esac
1738              ;;
1739            esac
1740            case " $sys_lib_dlsearch_path " in
1741            *" $libdir "*) ;;
1742            *)
1743              case "$finalize_rpath " in
1744              *" $libdir "*) ;;
1745              *) finalize_rpath="$finalize_rpath $libdir"
1746              esac
1747              ;;
1748            esac
1749            if test $linkmode = prog; then
1750              # We need to hardcode the library path
1751              if test -n "$shlibpath_var"; then
1752                # Make sure the rpath contains only unique directories.
1753                case "$temp_rpath " in
1754                *" $dir "*) ;;
1755                *" $absdir "*) ;;
1756                *) temp_rpath="$temp_rpath $dir" ;;
1757                esac
1758              fi
1759            fi
1760          fi # $linkmode,$pass = prog,link...
1761
1762          if test "$alldeplibs" = yes &&
1763             { test "$deplibs_check_method" = pass_all ||
1764               { test "$build_libtool_libs" = yes &&
1765                 test -n "$library_names"; }; }; then
1766            # We only need to search for static libraries
1767            continue
1768          fi
1769
1770          if test "$installed" = no; then
1771            notinst_deplibs="$notinst_deplibs $lib"
1772            need_relink=yes
1773          fi
1774
1775          if test -n "$old_archive_from_expsyms_cmds"; then
1776            # figure out the soname
1777            set dummy $library_names
1778            realname="$2"
1779            shift; shift
1780            libname=`eval \\$echo \"$libname_spec\"`
1781            # use dlname if we got it. it's perfectly good, no?
1782            if test -n "$dlname"; then
1783              soname="$dlname"
1784            elif test -n "$soname_spec"; then
1785              # bleh windows
1786              case $host in
1787              *cygwin*)
1788                major=`expr $current - $age`
1789                versuffix="-$major"
1790                ;;
1791              esac
1792              eval soname=\"$soname_spec\"
1793            else
1794              soname="$realname"
1795            fi
1796
1797            # Make a new name for the extract_expsyms_cmds to use
1798            soroot="$soname"
1799            soname=`echo $soroot | ${SED} -e 's/^.*\///'`
1800            newlib="libimp-`echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
1801
1802            # If the library has no export list, then create one now
1803            if test -f "$output_objdir/$soname-def"; then :
1804            else
1805              $show "extracting exported symbol list from \`$soname'"
1806              save_ifs="$IFS"; IFS='~'
1807              eval cmds=\"$extract_expsyms_cmds\"
1808              for cmd in $cmds; do
1809                IFS="$save_ifs"
1810                $show "$cmd"
1811                $run eval "$cmd" || exit $?
1812              done
1813              IFS="$save_ifs"
1814            fi
1815
1816            # Create $newlib
1817            if test -f "$output_objdir/$newlib"; then :; else
1818              $show "generating import library for \`$soname'"
1819              save_ifs="$IFS"; IFS='~'
1820              eval cmds=\"$old_archive_from_expsyms_cmds\"
1821              for cmd in $cmds; do
1822                IFS="$save_ifs"
1823                $show "$cmd"
1824                $run eval "$cmd" || exit $?
1825              done
1826              IFS="$save_ifs"
1827            fi
1828            # make sure the library variables are pointing to the new library
1829            dir=$output_objdir
1830            linklib=$newlib
1831          fi # test -n $old_archive_from_expsyms_cmds
1832
1833          if test $linkmode = prog || test "$mode" != relink; then
1834            add_shlibpath=
1835            add_dir=
1836            add=
1837            lib_linked=yes
1838            case $hardcode_action in
1839            immediate | unsupported)
1840              if test "$hardcode_direct" = no; then
1841                add="$dir/$linklib"
1842              elif test "$hardcode_minus_L" = no; then
1843                case $host in
1844                *-*-sunos*) add_shlibpath="$dir" ;;
1845                esac
1846                add_dir="-L$dir"
1847                add="-l$name"
1848              elif test "$hardcode_shlibpath_var" = no; then
1849                add_shlibpath="$dir"
1850                add="-l$name"
1851              else
1852                lib_linked=no
1853              fi
1854              ;;
1855            relink)
1856              if test "$hardcode_direct" = yes; then
1857                add="$dir/$linklib"
1858              elif test "$hardcode_minus_L" = yes; then
1859                add_dir="-L$dir"
1860                add="-l$name"
1861              elif test "$hardcode_shlibpath_var" = yes; then
1862                add_shlibpath="$dir"
1863                add="-l$name"
1864              else
1865                lib_linked=no
1866              fi
1867              ;;
1868            *) lib_linked=no ;;
1869            esac
1870
1871            if test "$lib_linked" != yes; then
1872              $echo "$modename: configuration error: unsupported hardcode properties"
1873              exit 1
1874            fi
1875
1876            if test -n "$add_shlibpath"; then
1877              case :$compile_shlibpath: in
1878              *":$add_shlibpath:"*) ;;
1879              *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
1880              esac
1881            fi
1882            if test $linkmode = prog; then
1883              test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
1884              test -n "$add" && compile_deplibs="$add $compile_deplibs"
1885            else
1886              test -n "$add_dir" && deplibs="$add_dir $deplibs"
1887              test -n "$add" && deplibs="$add $deplibs"
1888              if test "$hardcode_direct" != yes && \
1889                 test "$hardcode_minus_L" != yes && \
1890                 test "$hardcode_shlibpath_var" = yes; then
1891                case :$finalize_shlibpath: in
1892                *":$libdir:"*) ;;
1893                *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1894                esac
1895              fi
1896            fi
1897          fi
1898
1899          if test $linkmode = prog || test "$mode" = relink; then
1900            add_shlibpath=
1901            add_dir=
1902            add=
1903            # Finalize command for both is simple: just hardcode it.
1904            if test "$hardcode_direct" = yes; then
1905              add="$libdir/$linklib"
1906            elif test "$hardcode_minus_L" = yes; then
1907              # Try looking first in the location we're being installed to.
1908              add_dir=
1909              if test -n "$inst_prefix_dir"; then
1910                case "$libdir" in
1911                [\\/]*)
1912                  add_dir="-L$inst_prefix_dir$libdir"
1913                  ;;
1914                esac
1915              fi
1916              add_dir="$add_dir -L$libdir"
1917              add="-l$name"
1918            elif test "$hardcode_shlibpath_var" = yes; then
1919              case :$finalize_shlibpath: in
1920              *":$libdir:"*) ;;
1921              *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
1922              esac
1923              add="-l$name"
1924            else
1925              # We cannot seem to hardcode it, guess we'll fake it.
1926              # Try looking first in the location we're being installed to.
1927              add_dir=
1928              if test -n "$inst_prefix_dir"; then
1929                case "$libdir" in
1930                [\\/]*)
1931                  add_dir="-L$inst_prefix_dir$libdir"
1932                  ;;
1933                esac
1934              fi
1935              add_dir="$add_dir -L$libdir"
1936              add="-l$name"
1937            fi
1938
1939            if test $linkmode = prog; then
1940              test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
1941              test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
1942            else
1943              test -n "$add_dir" && deplibs="$add_dir $deplibs"
1944              test -n "$add" && deplibs="$add $deplibs"
1945            fi
1946          fi
1947        elif test $linkmode = prog; then
1948          if test "$alldeplibs" = yes &&
1949             { test "$deplibs_check_method" = pass_all ||
1950               { test "$build_libtool_libs" = yes &&
1951                 test -n "$library_names"; }; }; then
1952            # We only need to search for static libraries
1953            continue
1954          fi
1955
1956          # Try to link the static library
1957          # Here we assume that one of hardcode_direct or hardcode_minus_L
1958          # is not unsupported.  This is valid on all known static and
1959          # shared platforms.
1960          if test "$hardcode_direct" != unsupported; then
1961            test -n "$old_library" && linklib="$old_library"
1962            compile_deplibs="$dir/$linklib $compile_deplibs"
1963            finalize_deplibs="$dir/$linklib $finalize_deplibs"
1964          else
1965            compile_deplibs="-l$name -L$dir $compile_deplibs"
1966            finalize_deplibs="-l$name -L$dir $finalize_deplibs"
1967          fi
1968        elif test "$build_libtool_libs" = yes; then
1969          # Not a shared library
1970          if test "$deplibs_check_method" != pass_all; then
1971            # We're trying link a shared library against a static one
1972            # but the system doesn't support it.
1973
1974            # Just print a warning and add the library to dependency_libs so
1975            # that the program can be linked against the static library.
1976            echo
1977            echo "*** Warning: This system can not link to static lib archive $lib."
1978            echo "*** I have the capability to make that library automatically link in when"
1979            echo "*** you link to this library.  But I can only do this if you have a"
1980            echo "*** shared version of the library, which you do not appear to have."
1981            if test "$module" = yes; then
1982              echo "*** But as you try to build a module library, libtool will still create "
1983              echo "*** a static module, that should work as long as the dlopening application"
1984              echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
1985              if test -z "$global_symbol_pipe"; then
1986                echo
1987                echo "*** However, this would only work if libtool was able to extract symbol"
1988                echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
1989                echo "*** not find such a program.  So, this module is probably useless."
1990                echo "*** \`nm' from GNU binutils and a full rebuild may help."
1991              fi
1992              if test "$build_old_libs" = no; then
1993                build_libtool_libs=module
1994                build_old_libs=yes
1995              else
1996                build_libtool_libs=no
1997              fi
1998            fi
1999          else
2000            convenience="$convenience $dir/$old_library"
2001            old_convenience="$old_convenience $dir/$old_library"
2002            deplibs="$dir/$old_library $deplibs"
2003            link_static=yes
2004          fi
2005        fi # link shared/static library?
2006
2007        if test $linkmode = lib; then
2008          if test -n "$dependency_libs" &&
2009             { test $hardcode_into_libs != yes || test $build_old_libs = yes ||
2010               test $link_static = yes; }; then
2011            # Extract -R from dependency_libs
2012            temp_deplibs=
2013            for libdir in $dependency_libs; do
2014              case $libdir in
2015              -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2016                   case " $xrpath " in
2017                   *" $temp_xrpath "*) ;;
2018                   *) xrpath="$xrpath $temp_xrpath";;
2019                   esac;;
2020              *) temp_deplibs="$temp_deplibs $libdir";;
2021              esac
2022            done
2023            dependency_libs="$temp_deplibs"
2024          fi
2025
2026          newlib_search_path="$newlib_search_path $absdir"
2027          # Link against this library
2028          test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2029          # ... and its dependency_libs
2030          tmp_libs=
2031          for deplib in $dependency_libs; do
2032            newdependency_libs="$deplib $newdependency_libs"
2033            if test "X$duplicate_deps" = "Xyes" ; then
2034              case "$tmp_libs " in
2035              *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2036              esac
2037            fi
2038            tmp_libs="$tmp_libs $deplib"
2039          done
2040
2041          if test $link_all_deplibs != no; then
2042            # Add the search paths of all dependency libraries
2043            for deplib in $dependency_libs; do
2044              case $deplib in
2045              -L*) path="$deplib" ;;
2046              *.la)
2047                dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2048                test "X$dir" = "X$deplib" && dir="."
2049                # We need an absolute path.
2050                case $dir in
2051                [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2052                *)
2053                  absdir=`cd "$dir" && pwd`
2054                  if test -z "$absdir"; then
2055                    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2056                    absdir="$dir"
2057                  fi
2058                  ;;
2059                esac
2060                if grep "^installed=no" $deplib > /dev/null; then
2061                  path="-L$absdir/$objdir"
2062                else
2063                  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2064                  if test -z "$libdir"; then
2065                    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2066                    exit 1
2067                  fi
2068                  if test "$absdir" != "$libdir"; then
2069                    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2070                  fi
2071                  path="-L$absdir"
2072                fi
2073                ;;
2074              *) continue ;;
2075              esac
2076              case " $deplibs " in
2077              *" $path "*) ;;
2078              *) deplibs="$deplibs $path" ;;
2079              esac
2080            done
2081          fi # link_all_deplibs != no
2082        fi # linkmode = lib
2083      done # for deplib in $libs
2084      if test $pass = dlpreopen; then
2085        # Link the dlpreopened libraries before other libraries
2086        for deplib in $save_deplibs; do
2087          deplibs="$deplib $deplibs"
2088        done
2089      fi
2090      if test $pass != dlopen; then
2091        test $pass != scan && dependency_libs="$newdependency_libs"
2092        if test $pass != conv; then
2093          # Make sure lib_search_path contains only unique directories.
2094          lib_search_path=
2095          for dir in $newlib_search_path; do
2096            case "$lib_search_path " in
2097            *" $dir "*) ;;
2098            *) lib_search_path="$lib_search_path $dir" ;;
2099            esac
2100          done
2101          newlib_search_path=
2102        fi
2103
2104        if test "$linkmode,$pass" != "prog,link"; then
2105          vars="deplibs"
2106        else
2107          vars="compile_deplibs finalize_deplibs"
2108        fi
2109        for var in $vars dependency_libs; do
2110          # Add libraries to $var in reverse order
2111          eval tmp_libs=\"\$$var\"
2112          new_libs=
2113          for deplib in $tmp_libs; do
2114            case $deplib in
2115            -L*) new_libs="$deplib $new_libs" ;;
2116            *)
2117              case " $specialdeplibs " in
2118              *" $deplib "*) new_libs="$deplib $new_libs" ;;
2119              *)
2120                case " $new_libs " in
2121                *" $deplib "*) ;;
2122                *) new_libs="$deplib $new_libs" ;;
2123                esac
2124                ;;
2125              esac
2126              ;;
2127            esac
2128          done
2129          tmp_libs=
2130          for deplib in $new_libs; do
2131            case $deplib in
2132            -L*)
2133              case " $tmp_libs " in
2134              *" $deplib "*) ;;
2135              *) tmp_libs="$tmp_libs $deplib" ;;
2136              esac
2137              ;;
2138            *) tmp_libs="$tmp_libs $deplib" ;;
2139            esac
2140          done
2141          eval $var=\"$tmp_libs\"
2142        done # for var
2143      fi
2144      if test "$pass" = "conv" &&
2145       { test "$linkmode" = "lib" || test "$linkmode" = "prog"; }; then
2146        libs="$deplibs" # reset libs
2147        deplibs=
2148      fi
2149    done # for pass
2150    if test $linkmode = prog; then
2151      dlfiles="$newdlfiles"
2152      dlprefiles="$newdlprefiles"
2153    fi
2154
2155    case $linkmode in
2156    oldlib)
2157      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2158        $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2159      fi
2160
2161      if test -n "$rpath"; then
2162        $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2163      fi
2164
2165      if test -n "$xrpath"; then
2166        $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2167      fi
2168
2169      if test -n "$vinfo"; then
2170        $echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2171      fi
2172
2173      if test -n "$release"; then
2174        $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2175      fi
2176
2177      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2178        $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2179      fi
2180
2181      # Now set the variables for building old libraries.
2182      build_libtool_libs=no
2183      oldlibs="$output"
2184      objs="$objs$old_deplibs"
2185      ;;
2186
2187    lib)
2188      # Make sure we only generate libraries of the form `libNAME.la'.
2189      case $outputname in
2190      lib*)
2191        name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2192        eval libname=\"$libname_spec\"
2193        ;;
2194      *)
2195        if test "$module" = no; then
2196          $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2197          $echo "$help" 1>&2
2198          exit 1
2199        fi
2200        if test "$need_lib_prefix" != no; then
2201          # Add the "lib" prefix for modules if required
2202          name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2203          eval libname=\"$libname_spec\"
2204        else
2205          libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2206        fi
2207        ;;
2208      esac
2209
2210      if test -n "$objs"; then
2211        if test "$deplibs_check_method" != pass_all; then
2212          $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2213          exit 1
2214        else
2215          echo
2216          echo "*** Warning: Linking the shared library $output against the non-libtool"
2217          echo "*** objects $objs is not portable!"
2218          libobjs="$libobjs $objs"
2219        fi
2220      fi
2221
2222      if test "$dlself" != no; then
2223        $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2224      fi
2225
2226      set dummy $rpath
2227      if test $# -gt 2; then
2228        $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2229      fi
2230      install_libdir="$2"
2231
2232      oldlibs=
2233      if test -z "$rpath"; then
2234        if test "$build_libtool_libs" = yes; then
2235          # Building a libtool convenience library.
2236          libext=al
2237          oldlibs="$output_objdir/$libname.$libext $oldlibs"
2238          build_libtool_libs=convenience
2239          build_old_libs=yes
2240        fi
2241
2242        if test -n "$vinfo"; then
2243          $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2244        fi
2245
2246        if test -n "$release"; then
2247          $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2248        fi
2249      else
2250
2251        # Parse the version information argument.
2252        save_ifs="$IFS"; IFS=':'
2253        set dummy $vinfo 0 0 0
2254        IFS="$save_ifs"
2255
2256        if test -n "$8"; then
2257          $echo "$modename: too many parameters to \`-version-info'" 1>&2
2258          $echo "$help" 1>&2
2259          exit 1
2260        fi
2261
2262        current="$2"
2263        revision="$3"
2264        age="$4"
2265
2266        # Check that each of the things are valid numbers.
2267        case $current in
2268        [0-9]*) ;;
2269        *)
2270          $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2271          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2272          exit 1
2273          ;;
2274        esac
2275
2276        case $revision in
2277        [0-9]*) ;;
2278        *)
2279          $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2280          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2281          exit 1
2282          ;;
2283        esac
2284
2285        case $age in
2286        [0-9]*) ;;
2287        *)
2288          $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2289          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2290          exit 1
2291          ;;
2292        esac
2293
2294        if test $age -gt $current; then
2295          $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2296          $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2297          exit 1
2298        fi
2299
2300        # Calculate the version variables.
2301        major=
2302        versuffix=
2303        verstring=
2304        case $version_type in
2305        none) ;;
2306
2307        darwin)
2308          # Like Linux, but with the current version available in
2309          # verstring for coding it into the library header
2310          major=.`expr $current - $age`
2311          versuffix="$major.$age.$revision"
2312          # Darwin ld doesn't like 0 for these options...
2313          minor_current=`expr $current + 1`
2314          verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2315          ;;
2316
2317        freebsd-aout)
2318          major=".$current"
2319          versuffix=".$current.$revision";
2320          ;;
2321
2322        freebsd-elf)
2323          major=".$current"
2324          versuffix=".$current";
2325          ;;
2326
2327        irix | nonstopux)
2328          major=`expr $current - $age + 1`
2329
2330          case $version_type in
2331            nonstopux) verstring_prefix=nonstopux ;;
2332            *)         verstring_prefix=sgi ;;
2333          esac
2334          verstring="$verstring_prefix$major.$revision"
2335
2336          # Add in all the interfaces that we are compatible with.
2337          loop=$revision
2338          while test $loop != 0; do
2339            iface=`expr $revision - $loop`
2340            loop=`expr $loop - 1`
2341            verstring="$verstring_prefix$major.$iface:$verstring"
2342          done
2343
2344          # Before this point, $major must not contain `.'.
2345          major=.$major
2346          versuffix="$major.$revision"
2347          ;;
2348
2349        linux)
2350          major=.`expr $current - $age`
2351          versuffix="$major.$age.$revision"
2352          ;;
2353
2354        osf)
2355          major=.`expr $current - $age`
2356          versuffix=".$current.$age.$revision"
2357          verstring="$current.$age.$revision"
2358
2359          # Add in all the interfaces that we are compatible with.
2360          loop=$age
2361          while test $loop != 0; do
2362            iface=`expr $current - $loop`
2363            loop=`expr $loop - 1`
2364            verstring="$verstring:${iface}.0"
2365          done
2366
2367          # Make executables depend on our current version.
2368          verstring="$verstring:${current}.0"
2369          ;;
2370
2371        sunos)
2372          major=".$current"
2373          versuffix=".$current.$revision"
2374          ;;
2375
2376        windows)
2377          # Use '-' rather than '.', since we only want one
2378          # extension on DOS 8.3 filesystems.
2379          major=`expr $current - $age`
2380          versuffix="-$major"
2381          ;;
2382
2383        *)
2384          $echo "$modename: unknown library version type \`$version_type'" 1>&2
2385          echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2386          exit 1
2387          ;;
2388        esac
2389
2390        # Clear the version info if we defaulted, and they specified a release.
2391        if test -z "$vinfo" && test -n "$release"; then
2392          major=
2393          verstring="0.0"
2394          case $version_type in
2395          darwin)
2396            # we can't check for "0.0" in archive_cmds due to quoting
2397            # problems, so we reset it completely
2398            verstring=""
2399            ;;
2400          *)
2401            verstring="0.0"
2402            ;;
2403          esac
2404          if test "$need_version" = no; then
2405            versuffix=
2406          else
2407            versuffix=".0.0"
2408          fi
2409        fi
2410
2411        # Remove version info from name if versioning should be avoided
2412        if test "$avoid_version" = yes && test "$need_version" = no; then
2413          major=
2414          versuffix=
2415          verstring=""
2416        fi
2417
2418        # Check to see if the archive will have undefined symbols.
2419        if test "$allow_undefined" = yes; then
2420          if test "$allow_undefined_flag" = unsupported; then
2421            $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2422            build_libtool_libs=no
2423            build_old_libs=yes
2424          fi
2425        else
2426          # Don't allow undefined symbols.
2427          allow_undefined_flag="$no_undefined_flag"
2428        fi
2429      fi
2430
2431      if test "$mode" != relink; then
2432        # Remove our outputs.
2433        $show "${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*"
2434        $run ${rm}r $output_objdir/$outputname $output_objdir/$libname.* $output_objdir/${libname}${release}.*
2435      fi
2436
2437      # Now set the variables for building old libraries.
2438      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2439        oldlibs="$oldlibs $output_objdir/$libname.$libext"
2440
2441        # Transform .lo files to .o files.
2442        oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2443      fi
2444
2445      # Eliminate all temporary directories.
2446      for path in $notinst_path; do
2447        lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2448        deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2449        dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2450      done
2451
2452      if test -n "$xrpath"; then
2453        # If the user specified any rpath flags, then add them.
2454        temp_xrpath=
2455        for libdir in $xrpath; do
2456          temp_xrpath="$temp_xrpath -R$libdir"
2457          case "$finalize_rpath " in
2458          *" $libdir "*) ;;
2459          *) finalize_rpath="$finalize_rpath $libdir" ;;
2460          esac
2461        done
2462        if test $hardcode_into_libs != yes || test $build_old_libs = yes; then
2463          dependency_libs="$temp_xrpath $dependency_libs"
2464        fi
2465      fi
2466
2467      # Make sure dlfiles contains only unique files that won't be dlpreopened
2468      old_dlfiles="$dlfiles"
2469      dlfiles=
2470      for lib in $old_dlfiles; do
2471        case " $dlprefiles $dlfiles " in
2472        *" $lib "*) ;;
2473        *) dlfiles="$dlfiles $lib" ;;
2474        esac
2475      done
2476
2477      # Make sure dlprefiles contains only unique files
2478      old_dlprefiles="$dlprefiles"
2479      dlprefiles=
2480      for lib in $old_dlprefiles; do
2481        case "$dlprefiles " in
2482        *" $lib "*) ;;
2483        *) dlprefiles="$dlprefiles $lib" ;;
2484        esac
2485      done
2486
2487      if test "$build_libtool_libs" = yes; then
2488        if test -n "$rpath"; then
2489          case $host in
2490          *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2491            # these systems don't actually have a c library (as such)!
2492            ;;
2493          *-*-rhapsody* | *-*-darwin1.[012])
2494            # Rhapsody C library is in the System framework
2495            deplibs="$deplibs -framework System"
2496            ;;
2497          *-*-netbsd*)
2498            # Don't link with libc until the a.out ld.so is fixed.
2499            ;;
2500          *-*-openbsd* | *-*-freebsd*)
2501            # Do not include libc due to us having libc/libc_r.
2502            ;;
2503          *)
2504            # Add libc to deplibs on all other systems if necessary.
2505            if test $build_libtool_need_lc = "yes"; then
2506              deplibs="$deplibs -lc"
2507            fi
2508            ;;
2509          esac
2510        fi
2511
2512        # Transform deplibs into only deplibs that can be linked in shared.
2513        name_save=$name
2514        libname_save=$libname
2515        release_save=$release
2516        versuffix_save=$versuffix
2517        major_save=$major
2518        # I'm not sure if I'm treating the release correctly.  I think
2519        # release should show up in the -l (ie -lgmp5) so we don't want to
2520        # add it in twice.  Is that correct?
2521        release=""
2522        versuffix=""
2523        major=""
2524        newdeplibs=
2525        droppeddeps=no
2526        case $deplibs_check_method in
2527        pass_all)
2528          # Don't check for shared/static.  Everything works.
2529          # This might be a little naive.  We might want to check
2530          # whether the library exists or not.  But this is on
2531          # osf3 & osf4 and I'm not really sure... Just
2532          # implementing what was already the behaviour.
2533          newdeplibs=$deplibs
2534          ;;
2535        test_compile)
2536          # This code stresses the "libraries are programs" paradigm to its
2537          # limits. Maybe even breaks it.  We compile a program, linking it
2538          # against the deplibs as a proxy for the library.  Then we can check
2539          # whether they linked in statically or dynamically with ldd.
2540          $rm conftest.c
2541          cat > conftest.c <<EOF
2542          int main() { return 0; }
2543EOF
2544          $rm conftest
2545          $CC -o conftest conftest.c $deplibs
2546          if test $? -eq 0 ; then
2547            ldd_output=`ldd conftest`
2548            for i in $deplibs; do
2549              name="`expr $i : '-l\(.*\)'`"
2550              # If $name is empty we are operating on a -L argument.
2551              if test -n "$name" && test "$name" != "0"; then
2552                libname=`eval \\$echo \"$libname_spec\"`
2553                deplib_matches=`eval \\$echo \"$library_names_spec\"`
2554                set dummy $deplib_matches
2555                deplib_match=$2
2556                if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2557                  newdeplibs="$newdeplibs $i"
2558                else
2559                  droppeddeps=yes
2560                  echo
2561                  echo "*** Warning: dynamic linker does not accept needed library $i."
2562                  echo "*** I have the capability to make that library automatically link in when"
2563                  echo "*** you link to this library.  But I can only do this if you have a"
2564                  echo "*** shared version of the library, which I believe you do not have"
2565                  echo "*** because a test_compile did reveal that the linker did not use it for"
2566                  echo "*** its dynamic dependency list that programs get resolved with at runtime."
2567                fi
2568              else
2569                newdeplibs="$newdeplibs $i"
2570              fi
2571            done
2572          else
2573            # Error occured in the first compile.  Let's try to salvage
2574            # the situation: Compile a separate program for each library.
2575            for i in $deplibs; do
2576              name="`expr $i : '-l\(.*\)'`"
2577             # If $name is empty we are operating on a -L argument.
2578              if test -n "$name" && test "$name" != "0"; then
2579                $rm conftest
2580                $CC -o conftest conftest.c $i
2581                # Did it work?
2582                if test $? -eq 0 ; then
2583                  ldd_output=`ldd conftest`
2584                  libname=`eval \\$echo \"$libname_spec\"`
2585                  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2586                  set dummy $deplib_matches
2587                  deplib_match=$2
2588                  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2589                    newdeplibs="$newdeplibs $i"
2590                  else
2591                    droppeddeps=yes
2592                    echo
2593                    echo "*** Warning: dynamic linker does not accept needed library $i."
2594                    echo "*** I have the capability to make that library automatically link in when"
2595                    echo "*** you link to this library.  But I can only do this if you have a"
2596                    echo "*** shared version of the library, which you do not appear to have"
2597                    echo "*** because a test_compile did reveal that the linker did not use this one"
2598                    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2599                  fi
2600                else
2601                  droppeddeps=yes
2602                  echo
2603                  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2604                  echo "***  make it link in!  You will probably need to install it or some"
2605                  echo "*** library that it depends on before this library will be fully"
2606                  echo "*** functional.  Installing it before continuing would be even better."
2607                fi
2608              else
2609                newdeplibs="$newdeplibs $i"
2610              fi
2611            done
2612          fi
2613          ;;
2614        file_magic*)
2615          set dummy $deplibs_check_method
2616          file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2617          for a_deplib in $deplibs; do
2618            name="`expr $a_deplib : '-l\(.*\)'`"
2619            # If $name is empty we are operating on a -L argument.
2620            if test -n "$name" && test "$name" != "0"; then
2621              libname=`eval \\$echo \"$libname_spec\"`
2622              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2623                    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2624                    for potent_lib in $potential_libs; do
2625                      # Follow soft links.
2626                      if ls -lLd "$potent_lib" 2>/dev/null \
2627                         | grep " -> " >/dev/null; then
2628                        continue
2629                      fi
2630                      # The statement above tries to avoid entering an
2631                      # endless loop below, in case of cyclic links.
2632                      # We might still enter an endless loop, since a link
2633                      # loop can be closed while we follow links,
2634                      # but so what?
2635                      potlib="$potent_lib"
2636                      while test -h "$potlib" 2>/dev/null; do
2637                        potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2638                        case $potliblink in
2639                        [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
2640                        *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
2641                        esac
2642                      done
2643                      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
2644                         | ${SED} 10q \
2645                         | egrep "$file_magic_regex" > /dev/null; then
2646                        newdeplibs="$newdeplibs $a_deplib"
2647                        a_deplib=""
2648                        break 2
2649                      fi
2650                    done
2651              done
2652              if test -n "$a_deplib" ; then
2653                droppeddeps=yes
2654                echo
2655                echo "*** Warning: linker path does not have real file for library $a_deplib."
2656                echo "*** I have the capability to make that library automatically link in when"
2657                echo "*** you link to this library.  But I can only do this if you have a"
2658                echo "*** shared version of the library, which you do not appear to have"
2659                echo "*** because I did check the linker path looking for a file starting"
2660                if test -z "$potlib" ; then
2661                  echo "*** with $libname but no candidates were found. (...for file magic test)"
2662                else
2663                  echo "*** with $libname and none of the candidates passed a file format test"
2664                  echo "*** using a file magic. Last file checked: $potlib"
2665                fi
2666              fi
2667            else
2668              # Add a -L argument.
2669              newdeplibs="$newdeplibs $a_deplib"
2670            fi
2671          done # Gone through all deplibs.
2672          ;;
2673        match_pattern*)
2674          set dummy $deplibs_check_method
2675          match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2676          for a_deplib in $deplibs; do
2677            name="`expr $a_deplib : '-l\(.*\)'`"
2678            # If $name is empty we are operating on a -L argument.
2679            if test -n "$name" && test "$name" != "0"; then
2680              libname=`eval \\$echo \"$libname_spec\"`
2681              for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2682                potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2683                for potent_lib in $potential_libs; do
2684                  potlib="$potent_lib" # see symlink-check below in file_magic test
2685                  if eval echo \"$potent_lib\" 2>/dev/null \
2686                      | ${SED} 10q \
2687                      | egrep "$match_pattern_regex" > /dev/null; then
2688                    newdeplibs="$newdeplibs $a_deplib"
2689                    a_deplib=""
2690                    break 2
2691                  fi
2692                done
2693              done
2694              if test -n "$a_deplib" ; then
2695                droppeddeps=yes
2696                echo
2697                echo "*** Warning: linker path does not have real file for library $a_deplib."
2698                echo "*** I have the capability to make that library automatically link in when"
2699                echo "*** you link to this library.  But I can only do this if you have a"
2700                echo "*** shared version of the library, which you do not appear to have"
2701                echo "*** because I did check the linker path looking for a file starting"
2702                if test -z "$potlib" ; then
2703                  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
2704                else
2705                  echo "*** with $libname and none of the candidates passed a file format test"
2706                  echo "*** using a regex pattern. Last file checked: $potlib"
2707                fi
2708              fi
2709            else
2710              # Add a -L argument.
2711              newdeplibs="$newdeplibs $a_deplib"
2712            fi
2713          done # Gone through all deplibs.
2714          ;;
2715        none | unknown | *)
2716          newdeplibs=""
2717          if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
2718               -e 's/ -[LR][^ ]*//g' -e 's/[    ]//g' |
2719             grep . >/dev/null; then
2720            echo
2721            if test "X$deplibs_check_method" = "Xnone"; then
2722              echo "*** Warning: inter-library dependencies are not supported in this platform."
2723            else
2724              echo "*** Warning: inter-library dependencies are not known to be supported."
2725            fi
2726            echo "*** All declared inter-library dependencies are being dropped."
2727            droppeddeps=yes
2728          fi
2729          ;;
2730        esac
2731        versuffix=$versuffix_save
2732        major=$major_save
2733        release=$release_save
2734        libname=$libname_save
2735        name=$name_save
2736
2737        case $host in
2738        *-*-rhapsody* | *-*-darwin1.[012])
2739          # On Rhapsody replace the C library is the System framework
2740          newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
2741          ;;
2742        esac
2743
2744        if test "$droppeddeps" = yes; then
2745          if test "$module" = yes; then
2746            echo
2747            echo "*** Warning: libtool could not satisfy all declared inter-library"
2748            echo "*** dependencies of module $libname.  Therefore, libtool will create"
2749            echo "*** a static module, that should work as long as the dlopening"
2750            echo "*** application is linked with the -dlopen flag."
2751            if test -z "$global_symbol_pipe"; then
2752              echo
2753              echo "*** However, this would only work if libtool was able to extract symbol"
2754              echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2755              echo "*** not find such a program.  So, this module is probably useless."
2756              echo "*** \`nm' from GNU binutils and a full rebuild may help."
2757            fi
2758            if test "$build_old_libs" = no; then
2759              oldlibs="$output_objdir/$libname.$libext"
2760              build_libtool_libs=module
2761              build_old_libs=yes
2762            else
2763              build_libtool_libs=no
2764            fi
2765          else
2766            echo "*** The inter-library dependencies that have been dropped here will be"
2767            echo "*** automatically added whenever a program is linked with this library"
2768            echo "*** or is declared to -dlopen it."
2769
2770            if test $allow_undefined = no; then
2771              echo
2772              echo "*** Since this library must not contain undefined symbols,"
2773              echo "*** because either the platform does not support them or"
2774              echo "*** it was explicitly requested with -no-undefined,"
2775              echo "*** libtool will only create a static version of it."
2776              if test "$build_old_libs" = no; then
2777                oldlibs="$output_objdir/$libname.$libext"
2778                build_libtool_libs=module
2779                build_old_libs=yes
2780              else
2781                build_libtool_libs=no
2782              fi
2783            fi
2784          fi
2785        fi
2786        # Done checking deplibs!
2787        deplibs=$newdeplibs
2788      fi
2789
2790      # All the library-specific variables (install_libdir is set above).
2791      library_names=
2792      old_library=
2793      dlname=
2794
2795      # Test again, we may have decided not to build it any more
2796      if test "$build_libtool_libs" = yes; then
2797        if test $hardcode_into_libs = yes; then
2798          # Hardcode the library paths
2799          hardcode_libdirs=
2800          dep_rpath=
2801          rpath="$finalize_rpath"
2802          test "$mode" != relink && rpath="$compile_rpath$rpath"
2803          for libdir in $rpath; do
2804            if test -n "$hardcode_libdir_flag_spec"; then
2805              if test -n "$hardcode_libdir_separator"; then
2806                if test -z "$hardcode_libdirs"; then
2807                  hardcode_libdirs="$libdir"
2808                else
2809                  # Just accumulate the unique libdirs.
2810                  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
2811                  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
2812                    ;;
2813                  *)
2814                    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
2815                    ;;
2816                  esac
2817                fi
2818              else
2819                eval flag=\"$hardcode_libdir_flag_spec\"
2820                dep_rpath="$dep_rpath $flag"
2821              fi
2822            elif test -n "$runpath_var"; then
2823              case "$perm_rpath " in
2824              *" $libdir "*) ;;
2825              *) perm_rpath="$perm_rpath $libdir" ;;
2826              esac
2827            fi
2828          done
2829          # Substitute the hardcoded libdirs into the rpath.
2830          if test -n "$hardcode_libdir_separator" &&
2831             test -n "$hardcode_libdirs"; then
2832            libdir="$hardcode_libdirs"
2833            eval dep_rpath=\"$hardcode_libdir_flag_spec\"
2834          fi
2835          if test -n "$runpath_var" && test -n "$perm_rpath"; then
2836            # We should set the runpath_var.
2837            rpath=
2838            for dir in $perm_rpath; do
2839              rpath="$rpath$dir:"
2840            done
2841            eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
2842          fi
2843          test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
2844        fi
2845
2846        shlibpath="$finalize_shlibpath"
2847        test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
2848        if test -n "$shlibpath"; then
2849          eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
2850        fi
2851
2852        # Get the real and link names of the library.
2853        eval library_names=\"$library_names_spec\"
2854        set dummy $library_names
2855        realname="$2"
2856        shift; shift
2857
2858        if test -n "$soname_spec"; then
2859          eval soname=\"$soname_spec\"
2860        else
2861          soname="$realname"
2862        fi
2863        test -z "$dlname" && dlname=$soname
2864
2865        lib="$output_objdir/$realname"
2866        for link
2867        do
2868          linknames="$linknames $link"
2869        done
2870
2871        # Ensure that we have .o objects for linkers which dislike .lo
2872        # (e.g. aix) in case we are running --disable-static
2873        for obj in $libobjs; do
2874          xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
2875          if test "X$xdir" = "X$obj"; then
2876            xdir="."
2877          else
2878            xdir="$xdir"
2879          fi
2880          baseobj=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
2881          oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
2882          if test ! -f $xdir/$oldobj; then
2883            $show "(cd $xdir && ${LN_S} $baseobj $oldobj)"
2884            $run eval '(cd $xdir && ${LN_S} $baseobj $oldobj)' || exit $?
2885          fi
2886        done
2887
2888        # Use standard objects if they are pic
2889        test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
2890
2891        # Prepare the list of exported symbols
2892        if test -z "$export_symbols"; then
2893          if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
2894            $show "generating symbol list for \`$libname.la'"
2895            export_symbols="$output_objdir/$libname.exp"
2896            $run $rm $export_symbols
2897            eval cmds=\"$export_symbols_cmds\"
2898            save_ifs="$IFS"; IFS='~'
2899            for cmd in $cmds; do
2900              IFS="$save_ifs"
2901              $show "$cmd"
2902              $run eval "$cmd" || exit $?
2903            done
2904            IFS="$save_ifs"
2905            if test -n "$export_symbols_regex"; then
2906              $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
2907              $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
2908              $show "$mv \"${export_symbols}T\" \"$export_symbols\""
2909              $run eval '$mv "${export_symbols}T" "$export_symbols"'
2910            fi
2911          fi
2912        fi
2913
2914        if test -n "$export_symbols" && test -n "$include_expsyms"; then
2915          $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
2916        fi
2917
2918        if test -n "$convenience"; then
2919          if test -n "$whole_archive_flag_spec"; then
2920            eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
2921          else
2922            gentop="$output_objdir/${outputname}x"
2923            $show "${rm}r $gentop"
2924            $run ${rm}r "$gentop"
2925            $show "mkdir $gentop"
2926            $run mkdir "$gentop"
2927            status=$?
2928            if test $status -ne 0 && test ! -d "$gentop"; then
2929              exit $status
2930            fi
2931            generated="$generated $gentop"
2932
2933            for xlib in $convenience; do
2934              # Extract the objects.
2935              case $xlib in
2936              [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
2937              *) xabs=`pwd`"/$xlib" ;;
2938              esac
2939              xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
2940              xdir="$gentop/$xlib"
2941
2942              $show "${rm}r $xdir"
2943              $run ${rm}r "$xdir"
2944              $show "mkdir $xdir"
2945              $run mkdir "$xdir"
2946              status=$?
2947              if test $status -ne 0 && test ! -d "$xdir"; then
2948                exit $status
2949              fi
2950              $show "(cd $xdir && $AR x $xabs)"
2951              $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
2952
2953              libobjs="$libobjs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
2954            done
2955          fi
2956        fi
2957
2958        if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
2959          eval flag=\"$thread_safe_flag_spec\"
2960          linker_flags="$linker_flags $flag"
2961        fi
2962
2963        # Make a backup of the uninstalled library when relinking
2964        if test "$mode" = relink; then
2965          $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
2966        fi
2967
2968        # Do each of the archive commands.
2969        if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
2970          eval cmds=\"$archive_expsym_cmds\"
2971        else
2972          save_deplibs="$deplibs"
2973          for conv in $convenience; do
2974            tmp_deplibs=
2975            for test_deplib in $deplibs; do
2976              if test "$test_deplib" != "$conv"; then
2977                tmp_deplibs="$tmp_deplibs $test_deplib"
2978              fi
2979            done
2980            deplibs="$tmp_deplibs"
2981          done
2982          eval cmds=\"$archive_cmds\"
2983          deplibs="$save_deplibs"
2984        fi
2985        save_ifs="$IFS"; IFS='~'
2986        for cmd in $cmds; do
2987          IFS="$save_ifs"
2988          $show "$cmd"
2989          $run eval "$cmd" || exit $?
2990        done
2991        IFS="$save_ifs"
2992
2993        # Restore the uninstalled library and exit
2994        if test "$mode" = relink; then
2995          $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
2996          exit 0
2997        fi
2998
2999        # Create links to the real library.
3000        for linkname in $linknames; do
3001          if test "$realname" != "$linkname"; then
3002            $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3003            $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3004          fi
3005        done
3006
3007        # If -module or -export-dynamic was specified, set the dlname.
3008        if test "$module" = yes || test "$export_dynamic" = yes; then
3009          # On all known operating systems, these are identical.
3010          dlname="$soname"
3011        fi
3012      fi
3013      ;;
3014
3015    obj)
3016      if test -n "$deplibs"; then
3017        $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3018      fi
3019
3020      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3021        $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3022      fi
3023
3024      if test -n "$rpath"; then
3025        $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3026      fi
3027
3028      if test -n "$xrpath"; then
3029        $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3030      fi
3031
3032      if test -n "$vinfo"; then
3033        $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3034      fi
3035
3036      if test -n "$release"; then
3037        $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3038      fi
3039
3040      case $output in
3041      *.lo)
3042        if test -n "$objs$old_deplibs"; then
3043          $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3044          exit 1
3045        fi
3046        libobj="$output"
3047        obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3048        ;;
3049      *)
3050        libobj=
3051        obj="$output"
3052        ;;
3053      esac
3054
3055      # Delete the old objects.
3056      $run $rm $obj $libobj
3057
3058      # Objects from convenience libraries.  This assumes
3059      # single-version convenience libraries.  Whenever we create
3060      # different ones for PIC/non-PIC, this we'll have to duplicate
3061      # the extraction.
3062      reload_conv_objs=
3063      gentop=
3064      # reload_cmds runs $LD directly, so let us get rid of
3065      # -Wl from whole_archive_flag_spec
3066      wl=
3067
3068      if test -n "$convenience"; then
3069        if test -n "$whole_archive_flag_spec"; then
3070          eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3071        else
3072          gentop="$output_objdir/${obj}x"
3073          $show "${rm}r $gentop"
3074          $run ${rm}r "$gentop"
3075          $show "mkdir $gentop"
3076          $run mkdir "$gentop"
3077          status=$?
3078          if test $status -ne 0 && test ! -d "$gentop"; then
3079            exit $status
3080          fi
3081          generated="$generated $gentop"
3082
3083          for xlib in $convenience; do
3084            # Extract the objects.
3085            case $xlib in
3086            [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3087            *) xabs=`pwd`"/$xlib" ;;
3088            esac
3089            xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3090            xdir="$gentop/$xlib"
3091
3092            $show "${rm}r $xdir"
3093            $run ${rm}r "$xdir"
3094            $show "mkdir $xdir"
3095            $run mkdir "$xdir"
3096            status=$?
3097            if test $status -ne 0 && test ! -d "$xdir"; then
3098              exit $status
3099            fi
3100            $show "(cd $xdir && $AR x $xabs)"
3101            $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3102
3103            reload_conv_objs="$reload_objs "`find $xdir -name \*.o -print -o -name \*.lo -print | $NL2SP`
3104          done
3105        fi
3106      fi
3107
3108      # Create the old-style object.
3109      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
3110
3111      output="$obj"
3112      eval cmds=\"$reload_cmds\"
3113      save_ifs="$IFS"; IFS='~'
3114      for cmd in $cmds; do
3115        IFS="$save_ifs"
3116        $show "$cmd"
3117        $run eval "$cmd" || exit $?
3118      done
3119      IFS="$save_ifs"
3120
3121      # Exit if we aren't doing a library object file.
3122      if test -z "$libobj"; then
3123        if test -n "$gentop"; then
3124          $show "${rm}r $gentop"
3125          $run ${rm}r $gentop
3126        fi
3127
3128        exit 0
3129      fi
3130
3131      if test "$build_libtool_libs" != yes; then
3132        if test -n "$gentop"; then
3133          $show "${rm}r $gentop"
3134          $run ${rm}r $gentop
3135        fi
3136
3137        # Create an invalid libtool object if no PIC, so that we don't
3138        # accidentally link it into a program.
3139        $show "echo timestamp > $libobj"
3140        $run eval "echo timestamp > $libobj" || exit $?
3141        exit 0
3142      fi
3143
3144      if test -n "$pic_flag" || test "$pic_mode" != default; then
3145        # Only do commands if we really have different PIC objects.
3146        reload_objs="$libobjs $reload_conv_objs"
3147        output="$libobj"
3148        eval cmds=\"$reload_cmds\"
3149        save_ifs="$IFS"; IFS='~'
3150        for cmd in $cmds; do
3151          IFS="$save_ifs"
3152          $show "$cmd"
3153          $run eval "$cmd" || exit $?
3154        done
3155        IFS="$save_ifs"
3156      else
3157        # Just create a symlink.
3158        $show $rm $libobj
3159        $run $rm $libobj
3160        xdir=`$echo "X$libobj" | $Xsed -e 's%/[^/]*$%%'`
3161        if test "X$xdir" = "X$libobj"; then
3162          xdir="."
3163        else
3164          xdir="$xdir"
3165        fi
3166        baseobj=`$echo "X$libobj" | $Xsed -e 's%^.*/%%'`
3167        oldobj=`$echo "X$baseobj" | $Xsed -e "$lo2o"`
3168        $show "(cd $xdir && $LN_S $oldobj $baseobj)"
3169        $run eval '(cd $xdir && $LN_S $oldobj $baseobj)' || exit $?
3170      fi
3171
3172      if test -n "$gentop"; then
3173        $show "${rm}r $gentop"
3174        $run ${rm}r $gentop
3175      fi
3176
3177      exit 0
3178      ;;
3179
3180    prog)
3181      case $host in
3182        *cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3183      esac
3184      if test -n "$vinfo"; then
3185        $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3186      fi
3187
3188      if test -n "$release"; then
3189        $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3190      fi
3191
3192      if test "$preload" = yes; then
3193        if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3194           test "$dlopen_self_static" = unknown; then
3195          $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3196        fi
3197      fi
3198
3199      case $host in
3200      *-*-rhapsody* | *-*-darwin1.[012])
3201        # On Rhapsody replace the C library is the System framework
3202        compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3203        finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3204        case $host in
3205        *darwin*)
3206          # Don't allow lazy linking, it breaks C++ global constructors
3207          compile_command="$compile_command ${wl}-bind_at_load"
3208          finalize_command="$finalize_command ${wl}-bind_at_load"
3209          ;;
3210        esac
3211        ;;
3212      esac
3213
3214      compile_command="$compile_command $compile_deplibs"
3215      finalize_command="$finalize_command $finalize_deplibs"
3216
3217      if test -n "$rpath$xrpath"; then
3218        # If the user specified any rpath flags, then add them.
3219        for libdir in $rpath $xrpath; do
3220          # This is the magic to use -rpath.
3221          case "$finalize_rpath " in
3222          *" $libdir "*) ;;
3223          *) finalize_rpath="$finalize_rpath $libdir" ;;
3224          esac
3225        done
3226      fi
3227
3228      # Now hardcode the library paths
3229      rpath=
3230      hardcode_libdirs=
3231      for libdir in $compile_rpath $finalize_rpath; do
3232        if test -n "$hardcode_libdir_flag_spec"; then
3233          if test -n "$hardcode_libdir_separator"; then
3234            if test -z "$hardcode_libdirs"; then
3235              hardcode_libdirs="$libdir"
3236            else
3237              # Just accumulate the unique libdirs.
3238              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3239              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3240                ;;
3241              *)
3242                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3243                ;;
3244              esac
3245            fi
3246          else
3247            eval flag=\"$hardcode_libdir_flag_spec\"
3248            rpath="$rpath $flag"
3249          fi
3250        elif test -n "$runpath_var"; then
3251          case "$perm_rpath " in
3252          *" $libdir "*) ;;
3253          *) perm_rpath="$perm_rpath $libdir" ;;
3254          esac
3255        fi
3256        case $host in
3257        *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3258          case :$dllsearchpath: in
3259          *":$libdir:"*) ;;
3260          *) dllsearchpath="$dllsearchpath:$libdir";;
3261          esac
3262          ;;
3263        esac
3264      done
3265      # Substitute the hardcoded libdirs into the rpath.
3266      if test -n "$hardcode_libdir_separator" &&
3267         test -n "$hardcode_libdirs"; then
3268        libdir="$hardcode_libdirs"
3269        eval rpath=\" $hardcode_libdir_flag_spec\"
3270      fi
3271      compile_rpath="$rpath"
3272
3273      rpath=
3274      hardcode_libdirs=
3275      for libdir in $finalize_rpath; do
3276        if test -n "$hardcode_libdir_flag_spec"; then
3277          if test -n "$hardcode_libdir_separator"; then
3278            if test -z "$hardcode_libdirs"; then
3279              hardcode_libdirs="$libdir"
3280            else
3281              # Just accumulate the unique libdirs.
3282              case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3283              *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3284                ;;
3285              *)
3286                hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3287                ;;
3288              esac
3289            fi
3290          else
3291            eval flag=\"$hardcode_libdir_flag_spec\"
3292            rpath="$rpath $flag"
3293          fi
3294        elif test -n "$runpath_var"; then
3295          case "$finalize_perm_rpath " in
3296          *" $libdir "*) ;;
3297          *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3298          esac
3299        fi
3300      done
3301      # Substitute the hardcoded libdirs into the rpath.
3302      if test -n "$hardcode_libdir_separator" &&
3303         test -n "$hardcode_libdirs"; then
3304        libdir="$hardcode_libdirs"
3305        eval rpath=\" $hardcode_libdir_flag_spec\"
3306      fi
3307      finalize_rpath="$rpath"
3308
3309      if test -n "$libobjs" && test "$build_old_libs" = yes; then
3310        # Transform all the library objects into standard objects.
3311        compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3312        finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3313      fi
3314
3315      dlsyms=
3316      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3317        if test -n "$NM" && test -n "$global_symbol_pipe"; then
3318          dlsyms="${outputname}S.c"
3319        else
3320          $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3321        fi
3322      fi
3323
3324      if test -n "$dlsyms"; then
3325        case $dlsyms in
3326        "") ;;
3327        *.c)
3328          # Discover the nlist of each of the dlfiles.
3329          nlist="$output_objdir/${outputname}.nm"
3330
3331          $show "$rm $nlist ${nlist}S ${nlist}T"
3332          $run $rm "$nlist" "${nlist}S" "${nlist}T"
3333
3334          # Parse the name list into a source file.
3335          $show "creating $output_objdir/$dlsyms"
3336
3337          test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3338/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3339/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3340
3341#ifdef __cplusplus
3342extern \"C\" {
3343#endif
3344
3345/* Prevent the only kind of declaration conflicts we can make. */
3346#define lt_preloaded_symbols some_other_symbol
3347
3348/* External symbol declarations for the compiler. */\
3349"
3350
3351          if test "$dlself" = yes; then
3352            $show "generating symbol list for \`$output'"
3353
3354            test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3355
3356            # Add our own program objects to the symbol list.
3357            progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3358            for arg in $progfiles; do
3359              $show "extracting global C symbols from \`$arg'"
3360              $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3361            done
3362
3363            if test -n "$exclude_expsyms"; then
3364              $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3365              $run eval '$mv "$nlist"T "$nlist"'
3366            fi
3367
3368            if test -n "$export_symbols_regex"; then
3369              $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3370              $run eval '$mv "$nlist"T "$nlist"'
3371            fi
3372
3373            # Prepare the list of exported symbols
3374            if test -z "$export_symbols"; then
3375              export_symbols="$output_objdir/$output.exp"
3376              $run $rm $export_symbols
3377              $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3378            else
3379              $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3380              $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3381              $run eval 'mv "$nlist"T "$nlist"'
3382            fi
3383          fi
3384
3385          for arg in $dlprefiles; do
3386            $show "extracting global C symbols from \`$arg'"
3387            name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3388            $run eval 'echo ": $name " >> "$nlist"'
3389            $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3390          done
3391
3392          if test -z "$run"; then
3393            # Make sure we have at least an empty file.
3394            test -f "$nlist" || : > "$nlist"
3395
3396            if test -n "$exclude_expsyms"; then
3397              egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3398              $mv "$nlist"T "$nlist"
3399            fi
3400
3401            # Try sorting and uniquifying the output.
3402            if grep -v "^: " < "$nlist" |
3403                if sort -k 3 </dev/null >/dev/null 2>&1; then
3404                  sort -k 3
3405                else
3406                  sort +2
3407                fi |
3408                uniq > "$nlist"S; then
3409              :
3410            else
3411              grep -v "^: " < "$nlist" > "$nlist"S
3412            fi
3413
3414            if test -f "$nlist"S; then
3415              eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3416            else
3417              echo '/* NONE */' >> "$output_objdir/$dlsyms"
3418            fi
3419
3420            $echo >> "$output_objdir/$dlsyms" "\
3421
3422#undef lt_preloaded_symbols
3423
3424#if defined (__STDC__) && __STDC__
3425# define lt_ptr void *
3426#else
3427# define lt_ptr char *
3428# define const
3429#endif
3430
3431/* The mapping between symbol names and symbols. */
3432const struct {
3433  const char *name;
3434  lt_ptr address;
3435}
3436lt_preloaded_symbols[] =
3437{\
3438"
3439
3440            eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3441
3442            $echo >> "$output_objdir/$dlsyms" "\
3443  {0, (lt_ptr) 0}
3444};
3445
3446/* This works around a problem in FreeBSD linker */
3447#ifdef FREEBSD_WORKAROUND
3448static const void *lt_preloaded_setup() {
3449  return lt_preloaded_symbols;
3450}
3451#endif
3452
3453#ifdef __cplusplus
3454}
3455#endif\
3456"
3457          fi
3458
3459          pic_flag_for_symtable=
3460          case $host in
3461          # compiling the symbol table file with pic_flag works around
3462          # a FreeBSD bug that causes programs to crash when -lm is
3463          # linked before any other PIC object.  But we must not use
3464          # pic_flag when linking with -static.  The problem exists in
3465          # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3466          *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3467            case "$compile_command " in
3468            *" -static "*) ;;
3469            *) pic_flag_for_symtable=" $pic_flag -DPIC -DFREEBSD_WORKAROUND";;
3470            esac;;
3471          *-*-hpux*)
3472            case "$compile_command " in
3473            *" -static "*) ;;
3474            *) pic_flag_for_symtable=" $pic_flag -DPIC";;
3475            esac
3476          esac
3477
3478          # Now compile the dynamic symbol file.
3479          $show "(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3480          $run eval '(cd $output_objdir && $CC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3481
3482          # Clean up the generated files.
3483          $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3484          $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3485
3486          # Transform the symbol file into the correct name.
3487          compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3488          finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3489          ;;
3490        *)
3491          $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3492          exit 1
3493          ;;
3494        esac
3495      else
3496        # We keep going just in case the user didn't refer to
3497        # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
3498        # really was required.
3499
3500        # Nullify the symbol file.
3501        compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3502        finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3503      fi
3504
3505      if test $need_relink = no || test "$build_libtool_libs" != yes; then
3506        # Replace the output file specification.
3507        compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3508        link_command="$compile_command$compile_rpath"
3509
3510        # We have no uninstalled library dependencies, so finalize right now.
3511        $show "$link_command"
3512        $run eval "$link_command"
3513        status=$?
3514
3515        # Delete the generated files.
3516        if test -n "$dlsyms"; then
3517          $show "$rm $output_objdir/${outputname}S.${objext}"
3518          $run $rm "$output_objdir/${outputname}S.${objext}"
3519        fi
3520
3521        exit $status
3522      fi
3523
3524      if test -n "$shlibpath_var"; then
3525        # We should set the shlibpath_var
3526        rpath=
3527        for dir in $temp_rpath; do
3528          case $dir in
3529          [\\/]* | [A-Za-z]:[\\/]*)
3530            # Absolute path.
3531            rpath="$rpath$dir:"
3532            ;;
3533          *)
3534            # Relative path: add a thisdir entry.
3535            rpath="$rpath\$thisdir/$dir:"
3536            ;;
3537          esac
3538        done
3539        temp_rpath="$rpath"
3540      fi
3541
3542      if test -n "$compile_shlibpath$finalize_shlibpath"; then
3543        compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3544      fi
3545      if test -n "$finalize_shlibpath"; then
3546        finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3547      fi
3548
3549      compile_var=
3550      finalize_var=
3551      if test -n "$runpath_var"; then
3552        if test -n "$perm_rpath"; then
3553          # We should set the runpath_var.
3554          rpath=
3555          for dir in $perm_rpath; do
3556            rpath="$rpath$dir:"
3557          done
3558          compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3559        fi
3560        if test -n "$finalize_perm_rpath"; then
3561          # We should set the runpath_var.
3562          rpath=
3563          for dir in $finalize_perm_rpath; do
3564            rpath="$rpath$dir:"
3565          done
3566          finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3567        fi
3568      fi
3569
3570      if test "$no_install" = yes; then
3571        # We don't need to create a wrapper script.
3572        link_command="$compile_var$compile_command$compile_rpath"
3573        # Replace the output file specification.
3574        link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3575        # Delete the old output file.
3576        $run $rm $output
3577        # Link the executable and exit
3578        $show "$link_command"
3579        $run eval "$link_command" || exit $?
3580        exit 0
3581      fi
3582
3583      if test "$hardcode_action" = relink; then
3584        # Fast installation is not supported
3585        link_command="$compile_var$compile_command$compile_rpath"
3586        relink_command="$finalize_var$finalize_command$finalize_rpath"
3587
3588        $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
3589        $echo "$modename: \`$output' will be relinked during installation" 1>&2
3590      else
3591        if test "$fast_install" != no; then
3592          link_command="$finalize_var$compile_command$finalize_rpath"
3593          if test "$fast_install" = yes; then
3594            relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
3595          else
3596            # fast_install is set to needless
3597            relink_command=
3598          fi
3599        else
3600          link_command="$compile_var$compile_command$compile_rpath"
3601          relink_command="$finalize_var$finalize_command$finalize_rpath"
3602        fi
3603      fi
3604
3605      # Replace the output file specification.
3606      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
3607
3608      # Delete the old output files.
3609      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
3610
3611      $show "$link_command"
3612      $run eval "$link_command" || exit $?
3613
3614      # Now create the wrapper script.
3615      $show "creating $output"
3616
3617      # Quote the relink command for shipping.
3618      if test -n "$relink_command"; then
3619        # Preserve any variables that may affect compiler behavior
3620        for var in $variables_saved_for_relink; do
3621          if eval test -z \"\${$var+set}\"; then
3622            relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3623          elif eval var_value=\$$var; test -z "$var_value"; then
3624            relink_command="$var=; export $var; $relink_command"
3625          else
3626            var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3627            relink_command="$var=\"$var_value\"; export $var; $relink_command"
3628          fi
3629        done
3630        relink_command="(cd `pwd`; $relink_command)"
3631        relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3632      fi
3633
3634      # Quote $echo for shipping.
3635      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
3636        case $0 in
3637        [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
3638        *) qecho="$SHELL `pwd`/$0 --fallback-echo";;
3639        esac
3640        qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
3641      else
3642        qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
3643      fi
3644
3645      # Only actually do things if our run command is non-null.
3646      if test -z "$run"; then
3647        # win32 will think the script is a binary if it has
3648        # a .exe suffix, so we strip it off here.
3649        case $output in
3650          *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
3651        esac
3652        # test for cygwin because mv fails w/o .exe extensions
3653        case $host in
3654          *cygwin*) exeext=.exe ;;
3655          *) exeext= ;;
3656        esac
3657        $rm $output
3658        trap "$rm $output; exit 1" 1 2 15
3659
3660        $echo > $output "\
3661#! $SHELL
3662
3663# $output - temporary wrapper script for $objdir/$outputname
3664# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
3665#
3666# The $output program cannot be directly executed until all the libtool
3667# libraries that it depends on are installed.
3668#
3669# This wrapper script should never be moved out of the build directory.
3670# If it is, it will not operate correctly.
3671
3672# Sed substitution that helps us do robust quoting.  It backslashifies
3673# metacharacters that are still active within double-quoted strings.
3674Xsed="${SED}"' -e 1s/^X//'
3675sed_quote_subst='$sed_quote_subst'
3676
3677# The HP-UX ksh and POSIX shell print the target directory to stdout
3678# if CDPATH is set.
3679if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
3680
3681relink_command=\"$relink_command\"
3682
3683# This environment variable determines our operation mode.
3684if test \"\$libtool_install_magic\" = \"$magic\"; then
3685  # install mode needs the following variable:
3686  notinst_deplibs='$notinst_deplibs'
3687else
3688  # When we are sourced in execute mode, \$file and \$echo are already set.
3689  if test \"\$libtool_execute_magic\" != \"$magic\"; then
3690    echo=\"$qecho\"
3691    file=\"\$0\"
3692    # Make sure echo works.
3693    if test \"X\$1\" = X--no-reexec; then
3694      # Discard the --no-reexec flag, and continue.
3695      shift
3696    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
3697      # Yippee, \$echo works!
3698      :
3699    else
3700      # Restart under the correct shell, and then maybe \$echo will work.
3701      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
3702    fi
3703  fi\
3704"
3705        $echo >> $output "\
3706
3707  # Find the directory that this script lives in.
3708  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
3709  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
3710
3711  # Follow symbolic links until we get to the real thisdir.
3712  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
3713  while test -n \"\$file\"; do
3714    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
3715
3716    # If there was a directory component, then change thisdir.
3717    if test \"x\$destdir\" != \"x\$file\"; then
3718      case \"\$destdir\" in
3719      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
3720      *) thisdir=\"\$thisdir/\$destdir\" ;;
3721      esac
3722    fi
3723
3724    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
3725    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
3726  done
3727
3728  # Try to get the absolute directory name.
3729  absdir=\`cd \"\$thisdir\" && pwd\`
3730  test -n \"\$absdir\" && thisdir=\"\$absdir\"
3731"
3732
3733        if test "$fast_install" = yes; then
3734          echo >> $output "\
3735  program=lt-'$outputname'$exeext
3736  progdir=\"\$thisdir/$objdir\"
3737
3738  if test ! -f \"\$progdir/\$program\" || \\
3739     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
3740       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
3741
3742    file=\"\$\$-\$program\"
3743
3744    if test ! -d \"\$progdir\"; then
3745      $mkdir \"\$progdir\"
3746    else
3747      $rm \"\$progdir/\$file\"
3748    fi"
3749
3750          echo >> $output "\
3751
3752    # relink executable if necessary
3753    if test -n \"\$relink_command\"; then
3754      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
3755      else
3756        $echo \"\$relink_command_output\" >&2
3757        $rm \"\$progdir/\$file\"
3758        exit 1
3759      fi
3760    fi
3761
3762    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
3763    { $rm \"\$progdir/\$program\";
3764      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
3765    $rm \"\$progdir/\$file\"
3766  fi"
3767        else
3768          echo >> $output "\
3769  program='$outputname'
3770  progdir=\"\$thisdir/$objdir\"
3771"
3772        fi
3773
3774        echo >> $output "\
3775
3776  if test -f \"\$progdir/\$program\"; then"
3777
3778        # Export our shlibpath_var if we have one.
3779        if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
3780          $echo >> $output "\
3781    # Add our own library path to $shlibpath_var
3782    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
3783
3784    # Some systems cannot cope with colon-terminated $shlibpath_var
3785    # The second colon is a workaround for a bug in BeOS R4 ${SED}
3786    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
3787
3788    export $shlibpath_var
3789"
3790        fi
3791
3792        # fixup the dll searchpath if we need to.
3793        if test -n "$dllsearchpath"; then
3794          $echo >> $output "\
3795    # Add the dll search path components to the executable PATH
3796    PATH=$dllsearchpath:\$PATH
3797"
3798        fi
3799
3800        $echo >> $output "\
3801    if test \"\$libtool_execute_magic\" != \"$magic\"; then
3802      # Run the actual program with our arguments.
3803"
3804        case $host in
3805        # win32 systems need to use the prog path for dll
3806        # lookup to work
3807        *-*-cygwin* | *-*-pw32*)
3808          $echo >> $output "\
3809      exec \$progdir/\$program \${1+\"\$@\"}
3810"
3811          ;;
3812
3813        # Backslashes separate directories on plain windows
3814        *-*-mingw | *-*-os2*)
3815          $echo >> $output "\
3816      exec \$progdir\\\\\$program \${1+\"\$@\"}
3817"
3818          ;;
3819
3820        *)
3821          $echo >> $output "\
3822      # Export the path to the program.
3823      PATH=\"\$progdir:\$PATH\"
3824      export PATH
3825
3826      exec \$program \${1+\"\$@\"}
3827"
3828          ;;
3829        esac
3830        $echo >> $output "\
3831      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
3832      exit 1
3833    fi
3834  else
3835    # The program doesn't exist.
3836    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
3837    \$echo \"This script is just a wrapper for \$program.\" 1>&2
3838    echo \"See the $PACKAGE documentation for more information.\" 1>&2
3839    exit 1
3840  fi
3841fi\
3842"
3843        chmod +x $output
3844      fi
3845      exit 0
3846      ;;
3847    esac
3848
3849    # See if we need to build an old-fashioned archive.
3850    for oldlib in $oldlibs; do
3851
3852      if test "$build_libtool_libs" = convenience; then
3853        oldobjs="$libobjs_save"
3854        addlibs="$convenience"
3855        build_libtool_libs=no
3856      else
3857        if test "$build_libtool_libs" = module; then
3858          oldobjs="$libobjs_save"
3859          build_libtool_libs=no
3860        else
3861          oldobjs="$objs$old_deplibs "`$echo "X$libobjs_save" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`
3862        fi
3863        addlibs="$old_convenience"
3864      fi
3865
3866      if test -n "$addlibs"; then
3867        gentop="$output_objdir/${outputname}x"
3868        $show "${rm}r $gentop"
3869        $run ${rm}r "$gentop"
3870        $show "mkdir $gentop"
3871        $run mkdir "$gentop"
3872        status=$?
3873        if test $status -ne 0 && test ! -d "$gentop"; then
3874          exit $status
3875        fi
3876        generated="$generated $gentop"
3877
3878        # Add in members from convenience archives.
3879        for xlib in $addlibs; do
3880          # Extract the objects.
3881          case $xlib in
3882          [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3883          *) xabs=`pwd`"/$xlib" ;;
3884          esac
3885          xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3886          xdir="$gentop/$xlib"
3887
3888          $show "${rm}r $xdir"
3889          $run ${rm}r "$xdir"
3890          $show "mkdir $xdir"
3891          $run mkdir "$xdir"
3892          status=$?
3893          if test $status -ne 0 && test ! -d "$xdir"; then
3894            exit $status
3895          fi
3896          $show "(cd $xdir && $AR x $xabs)"
3897          $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3898
3899          oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
3900        done
3901      fi
3902
3903      # Do each command in the archive commands.
3904      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
3905        eval cmds=\"$old_archive_from_new_cmds\"
3906      else
3907        # Ensure that we have .o objects in place in case we decided
3908        # not to build a shared library, and have fallen back to building
3909        # static libs even though --disable-static was passed!
3910        for oldobj in $oldobjs; do
3911          if test ! -f $oldobj; then
3912            xdir=`$echo "X$oldobj" | $Xsed -e 's%/[^/]*$%%'`
3913            if test "X$xdir" = "X$oldobj"; then
3914              xdir="."
3915            else
3916              xdir="$xdir"
3917            fi
3918            baseobj=`$echo "X$oldobj" | $Xsed -e 's%^.*/%%'`
3919            obj=`$echo "X$baseobj" | $Xsed -e "$o2lo"`
3920            $show "(cd $xdir && ${LN_S} $obj $baseobj)"
3921            $run eval '(cd $xdir && ${LN_S} $obj $baseobj)' || exit $?
3922          fi
3923        done
3924
3925        eval cmds=\"$old_archive_cmds\"
3926      fi
3927      save_ifs="$IFS"; IFS='~'
3928      for cmd in $cmds; do
3929        IFS="$save_ifs"
3930        $show "$cmd"
3931        $run eval "$cmd" || exit $?
3932      done
3933      IFS="$save_ifs"
3934    done
3935
3936    if test -n "$generated"; then
3937      $show "${rm}r$generated"
3938      $run ${rm}r$generated
3939    fi
3940
3941    # Now create the libtool archive.
3942    case $output in
3943    *.la)
3944      old_library=
3945      test "$build_old_libs" = yes && old_library="$libname.$libext"
3946      $show "creating $output"
3947
3948      # Preserve any variables that may affect compiler behavior
3949      for var in $variables_saved_for_relink; do
3950        if eval test -z \"\${$var+set}\"; then
3951          relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
3952        elif eval var_value=\$$var; test -z "$var_value"; then
3953          relink_command="$var=; export $var; $relink_command"
3954        else
3955          var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
3956          relink_command="$var=\"$var_value\"; export $var; $relink_command"
3957        fi
3958      done
3959      # Quote the link command for shipping.
3960      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
3961      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
3962
3963      # Only create the output if not a dry run.
3964      if test -z "$run"; then
3965        for installed in no yes; do
3966          if test "$installed" = yes; then
3967            if test -z "$install_libdir"; then
3968              break
3969            fi
3970            output="$output_objdir/$outputname"i
3971            # Replace all uninstalled libtool libraries with the installed ones
3972            newdependency_libs=
3973            for deplib in $dependency_libs; do
3974              case $deplib in
3975              *.la)
3976                name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
3977                eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
3978                if test -z "$libdir"; then
3979                  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
3980                  exit 1
3981                fi
3982                newdependency_libs="$newdependency_libs $libdir/$name"
3983                ;;
3984              *) newdependency_libs="$newdependency_libs $deplib" ;;
3985              esac
3986            done
3987            dependency_libs="$newdependency_libs"
3988            newdlfiles=
3989            for lib in $dlfiles; do
3990              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
3991              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
3992              if test -z "$libdir"; then
3993                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
3994                exit 1
3995              fi
3996              newdlfiles="$newdlfiles $libdir/$name"
3997            done
3998            dlfiles="$newdlfiles"
3999            newdlprefiles=
4000            for lib in $dlprefiles; do
4001              name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4002              eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4003              if test -z "$libdir"; then
4004                $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4005                exit 1
4006              fi
4007              newdlprefiles="$newdlprefiles $libdir/$name"
4008            done
4009            dlprefiles="$newdlprefiles"
4010          fi
4011          $rm $output
4012          # place dlname in correct position for cygwin
4013          tdlname=$dlname
4014          case $host,$output,$installed,$module,$dlname in
4015            *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4016          esac
4017          $echo > $output "\
4018# $outputname - a libtool library file
4019# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4020#
4021# Please DO NOT delete this file!
4022# It is necessary for linking the library.
4023
4024# The name that we can dlopen(3).
4025dlname='$tdlname'
4026
4027# Names of this library.
4028library_names='$library_names'
4029
4030# The name of the static archive.
4031old_library='$old_library'
4032
4033# Libraries that this one depends upon.
4034dependency_libs='$dependency_libs'
4035
4036# Version information for $libname.
4037current=$current
4038age=$age
4039revision=$revision
4040
4041# Is this an already installed library?
4042installed=$installed
4043
4044# Files to dlopen/dlpreopen
4045dlopen='$dlfiles'
4046dlpreopen='$dlprefiles'
4047
4048# Directory that this library needs to be installed in:
4049libdir='$install_libdir'"
4050          if test "$installed" = no && test $need_relink = yes; then
4051            $echo >> $output "\
4052relink_command=\"$relink_command\""
4053          fi
4054        done
4055      fi
4056
4057      # Do a symbolic link so that the libtool archive can be found in
4058      # LD_LIBRARY_PATH before the program is installed.
4059      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4060      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4061      ;;
4062    esac
4063    exit 0
4064    ;;
4065
4066  # libtool install mode
4067  install)
4068    modename="$modename: install"
4069
4070    # There may be an optional sh(1) argument at the beginning of
4071    # install_prog (especially on Windows NT).
4072    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4073       # Allow the use of GNU shtool's install command.
4074       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4075      # Aesthetically quote it.
4076      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4077      case $arg in
4078      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
4079        arg="\"$arg\""
4080        ;;
4081      esac
4082      install_prog="$arg "
4083      arg="$1"
4084      shift
4085    else
4086      install_prog=
4087      arg="$nonopt"
4088    fi
4089
4090    # The real first argument should be the name of the installation program.
4091    # Aesthetically quote it.
4092    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4093    case $arg in
4094    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \       ]*|*]*)
4095      arg="\"$arg\""
4096      ;;
4097    esac
4098    install_prog="$install_prog$arg"
4099
4100    # We need to accept at least all the BSD install flags.
4101    dest=
4102    files=
4103    opts=
4104    prev=
4105    install_type=
4106    isdir=no
4107    stripme=
4108    for arg
4109    do
4110      if test -n "$dest"; then
4111        files="$files $dest"
4112        dest="$arg"
4113        continue
4114      fi
4115
4116      case $arg in
4117      -d) isdir=yes ;;
4118      -f) prev="-f" ;;
4119      -g) prev="-g" ;;
4120      -m) prev="-m" ;;
4121      -o) prev="-o" ;;
4122      -s)
4123        stripme=" -s"
4124        continue
4125        ;;
4126      -*) ;;
4127
4128      *)
4129        # If the previous option needed an argument, then skip it.
4130        if test -n "$prev"; then
4131          prev=
4132        else
4133          dest="$arg"
4134          continue
4135        fi
4136        ;;
4137      esac
4138
4139      # Aesthetically quote the argument.
4140      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4141      case $arg in
4142      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \     ]*|*]*)
4143        arg="\"$arg\""
4144        ;;
4145      esac
4146      install_prog="$install_prog $arg"
4147    done
4148
4149    if test -z "$install_prog"; then
4150      $echo "$modename: you must specify an install program" 1>&2
4151      $echo "$help" 1>&2
4152      exit 1
4153    fi
4154
4155    if test -n "$prev"; then
4156      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4157      $echo "$help" 1>&2
4158      exit 1
4159    fi
4160
4161    if test -z "$files"; then
4162      if test -z "$dest"; then
4163        $echo "$modename: no file or destination specified" 1>&2
4164      else
4165        $echo "$modename: you must specify a destination" 1>&2
4166      fi
4167      $echo "$help" 1>&2
4168      exit 1
4169    fi
4170
4171    # Strip any trailing slash from the destination.
4172    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4173
4174    # Check to see that the destination is a directory.
4175    test -d "$dest" && isdir=yes
4176    if test "$isdir" = yes; then
4177      destdir="$dest"
4178      destname=
4179    else
4180      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4181      test "X$destdir" = "X$dest" && destdir=.
4182      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4183
4184      # Not a directory, so check to see that there is only one file specified.
4185      set dummy $files
4186      if test $# -gt 2; then
4187        $echo "$modename: \`$dest' is not a directory" 1>&2
4188        $echo "$help" 1>&2
4189        exit 1
4190      fi
4191    fi
4192    case $destdir in
4193    [\\/]* | [A-Za-z]:[\\/]*) ;;
4194    *)
4195      for file in $files; do
4196        case $file in
4197        *.lo) ;;
4198        *)
4199          $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4200          $echo "$help" 1>&2
4201          exit 1
4202          ;;
4203        esac
4204      done
4205      ;;
4206    esac
4207
4208    # This variable tells wrapper scripts just to set variables rather
4209    # than running their programs.
4210    libtool_install_magic="$magic"
4211
4212    staticlibs=
4213    future_libdirs=
4214    current_libdirs=
4215    for file in $files; do
4216
4217      # Do each installation.
4218      case $file in
4219      *.$libext)
4220        # Do the static libraries later.
4221        staticlibs="$staticlibs $file"
4222        ;;
4223
4224      *.la)
4225        # Check to see that this really is a libtool archive.
4226        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4227        else
4228          $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4229          $echo "$help" 1>&2
4230          exit 1
4231        fi
4232
4233        library_names=
4234        old_library=
4235        relink_command=
4236        # If there is no directory component, then add one.
4237        case $file in
4238        */* | *\\*) . $file ;;
4239        *) . ./$file ;;
4240        esac
4241
4242        # Add the libdir to current_libdirs if it is the destination.
4243        if test "X$destdir" = "X$libdir"; then
4244          case "$current_libdirs " in
4245          *" $libdir "*) ;;
4246          *) current_libdirs="$current_libdirs $libdir" ;;
4247          esac
4248        else
4249          # Note the libdir as a future libdir.
4250          case "$future_libdirs " in
4251          *" $libdir "*) ;;
4252          *) future_libdirs="$future_libdirs $libdir" ;;
4253          esac
4254        fi
4255
4256        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4257        test "X$dir" = "X$file/" && dir=
4258        dir="$dir$objdir"
4259
4260        if test -n "$relink_command"; then
4261          # Determine the prefix the user has applied to our future dir.
4262          inst_prefix_dir=`$echo "$destdir" | sed "s%$libdir\$%%"`
4263
4264          # Don't allow the user to place us outside of our expected
4265          # location b/c this prevents finding dependent libraries that
4266          # are installed to the same prefix.
4267          if test "$inst_prefix_dir" = "$destdir"; then
4268            $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
4269            exit 1
4270          fi
4271
4272          if test -n "$inst_prefix_dir"; then
4273            # Stick the inst_prefix_dir data into the link command.
4274            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
4275          else
4276            relink_command=`$echo "$relink_command" | sed "s%@inst_prefix_dir@%%"`
4277          fi
4278
4279          $echo "$modename: warning: relinking \`$file'" 1>&2
4280          $show "$relink_command"
4281          if $run eval "$relink_command"; then :
4282          else
4283            $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4284            exit 1
4285          fi
4286        fi
4287
4288        # See the names of the shared library.
4289        set dummy $library_names
4290        if test -n "$2"; then
4291          realname="$2"
4292          shift
4293          shift
4294
4295          srcname="$realname"
4296          test -n "$relink_command" && srcname="$realname"T
4297
4298          # Install the shared library and build the symlinks.
4299          $show "$install_prog $dir/$srcname $destdir/$realname"
4300          $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4301          if test -n "$stripme" && test -n "$striplib"; then
4302            $show "$striplib $destdir/$realname"
4303            $run eval "$striplib $destdir/$realname" || exit $?
4304          fi
4305
4306          if test $# -gt 0; then
4307            # Delete the old symlinks, and create new ones.
4308            for linkname
4309            do
4310              if test "$linkname" != "$realname"; then
4311                $show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4312                $run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4313              fi
4314            done
4315          fi
4316
4317          # Do each command in the postinstall commands.
4318          lib="$destdir/$realname"
4319          eval cmds=\"$postinstall_cmds\"
4320          save_ifs="$IFS"; IFS='~'
4321          for cmd in $cmds; do
4322            IFS="$save_ifs"
4323            $show "$cmd"
4324            $run eval "$cmd" || exit $?
4325          done
4326          IFS="$save_ifs"
4327        fi
4328
4329        # Install the pseudo-library for information purposes.
4330        name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4331        instname="$dir/$name"i
4332        $show "$install_prog $instname $destdir/$name"
4333        $run eval "$install_prog $instname $destdir/$name" || exit $?
4334
4335        # Maybe install the static library, too.
4336        test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4337        ;;
4338
4339      *.lo)
4340        # Install (i.e. copy) a libtool object.
4341
4342        # Figure out destination file name, if it wasn't already specified.
4343        if test -n "$destname"; then
4344          destfile="$destdir/$destname"
4345        else
4346          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4347          destfile="$destdir/$destfile"
4348        fi
4349
4350        # Deduce the name of the destination old-style object file.
4351        case $destfile in
4352        *.lo)
4353          staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4354          ;;
4355        *.$objext)
4356          staticdest="$destfile"
4357          destfile=
4358          ;;
4359        *)
4360          $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4361          $echo "$help" 1>&2
4362          exit 1
4363          ;;
4364        esac
4365
4366        # Install the libtool object if requested.
4367        if test -n "$destfile"; then
4368          $show "$install_prog $file $destfile"
4369          $run eval "$install_prog $file $destfile" || exit $?
4370        fi
4371
4372        # Install the old object if enabled.
4373        if test "$build_old_libs" = yes; then
4374          # Deduce the name of the old-style object file.
4375          staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4376
4377          $show "$install_prog $staticobj $staticdest"
4378          $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4379        fi
4380        exit 0
4381        ;;
4382
4383      *)
4384        # Figure out destination file name, if it wasn't already specified.
4385        if test -n "$destname"; then
4386          destfile="$destdir/$destname"
4387        else
4388          destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4389          destfile="$destdir/$destfile"
4390        fi
4391
4392        # Do a test to see if this is really a libtool program.
4393        case $host in
4394        *cygwin*|*mingw*)
4395            wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
4396            ;;
4397        *)
4398            wrapper=$file
4399            ;;
4400        esac
4401        if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4402          notinst_deplibs=
4403          relink_command=
4404
4405          # If there is no directory component, then add one.
4406          case $file in
4407          */* | *\\*) . $wrapper ;;
4408          *) . ./$wrapper ;;
4409          esac
4410
4411          # Check the variables that should have been set.
4412          if test -z "$notinst_deplibs"; then
4413            $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4414            exit 1
4415          fi
4416
4417          finalize=yes
4418          for lib in $notinst_deplibs; do
4419            # Check to see that each library is installed.
4420            libdir=
4421            if test -f "$lib"; then
4422              # If there is no directory component, then add one.
4423              case $lib in
4424              */* | *\\*) . $lib ;;
4425              *) . ./$lib ;;
4426              esac
4427            fi
4428            libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4429            if test -n "$libdir" && test ! -f "$libfile"; then
4430              $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4431              finalize=no
4432            fi
4433          done
4434
4435          relink_command=
4436          # If there is no directory component, then add one.
4437          case $file in
4438          */* | *\\*) . $wrapper ;;
4439          *) . ./$wrapper ;;
4440          esac
4441
4442          outputname=
4443          if test "$fast_install" = no && test -n "$relink_command"; then
4444            if test "$finalize" = yes && test -z "$run"; then
4445              tmpdir="/tmp"
4446              test -n "$TMPDIR" && tmpdir="$TMPDIR"
4447              tmpdir=`mktemp -d $tmpdir/libtool-XXXXXX 2> /dev/null`
4448              if test $? = 0 ; then :
4449              else
4450                tmpdir="$tmpdir/libtool-$$"
4451              fi
4452              if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4453              else
4454                $echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4455                continue
4456              fi
4457              file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4458              outputname="$tmpdir/$file"
4459              # Replace the output file specification.
4460              relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4461
4462              $show "$relink_command"
4463              if $run eval "$relink_command"; then :
4464              else
4465                $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4466                ${rm}r "$tmpdir"
4467                continue
4468              fi
4469              file="$outputname"
4470            else
4471              $echo "$modename: warning: cannot relink \`$file'" 1>&2
4472            fi
4473          else
4474            # Install the binary that we compiled earlier.
4475            file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4476          fi
4477        fi
4478
4479        # remove .exe since cygwin /usr/bin/install will append another
4480        # one anyways
4481        case $install_prog,$host in
4482        /usr/bin/install*,*cygwin*)
4483          case $file:$destfile in
4484          *.exe:*.exe)
4485            # this is ok
4486            ;;
4487          *.exe:*)
4488            destfile=$destfile.exe
4489            ;;
4490          *:*.exe)
4491            destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
4492            ;;
4493          esac
4494          ;;
4495        esac
4496        $show "$install_prog$stripme $file $destfile"
4497        $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4498        test -n "$outputname" && ${rm}r "$tmpdir"
4499        ;;
4500      esac
4501    done
4502
4503    for file in $staticlibs; do
4504      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4505
4506      # Set up the ranlib parameters.
4507      oldlib="$destdir/$name"
4508
4509      $show "$install_prog $file $oldlib"
4510      $run eval "$install_prog \$file \$oldlib" || exit $?
4511
4512      if test -n "$stripme" && test -n "$striplib"; then
4513        $show "$old_striplib $oldlib"
4514        $run eval "$old_striplib $oldlib" || exit $?
4515      fi
4516
4517      # Do each command in the postinstall commands.
4518      eval cmds=\"$old_postinstall_cmds\"
4519      save_ifs="$IFS"; IFS='~'
4520      for cmd in $cmds; do
4521        IFS="$save_ifs"
4522        $show "$cmd"
4523        $run eval "$cmd" || exit $?
4524      done
4525      IFS="$save_ifs"
4526    done
4527
4528    if test -n "$future_libdirs"; then
4529      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4530    fi
4531
4532    if test -n "$current_libdirs"; then
4533      # Maybe just do a dry run.
4534      test -n "$run" && current_libdirs=" -n$current_libdirs"
4535      exec_cmd='$SHELL $0 --finish$current_libdirs'
4536    else
4537      exit 0
4538    fi
4539    ;;
4540
4541  # libtool finish mode
4542  finish)
4543    modename="$modename: finish"
4544    libdirs="$nonopt"
4545    admincmds=
4546
4547    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4548      for dir
4549      do
4550        libdirs="$libdirs $dir"
4551      done
4552
4553      for libdir in $libdirs; do
4554        if test -n "$finish_cmds"; then
4555          # Do each command in the finish commands.
4556          eval cmds=\"$finish_cmds\"
4557          save_ifs="$IFS"; IFS='~'
4558          for cmd in $cmds; do
4559            IFS="$save_ifs"
4560            $show "$cmd"
4561            $run eval "$cmd" || admincmds="$admincmds
4562       $cmd"
4563          done
4564          IFS="$save_ifs"
4565        fi
4566        if test -n "$finish_eval"; then
4567          # Do the single finish_eval.
4568          eval cmds=\"$finish_eval\"
4569          $run eval "$cmds" || admincmds="$admincmds
4570       $cmds"
4571        fi
4572      done
4573    fi
4574
4575    # Exit here if they wanted silent mode.
4576    test "$show" = ":" && exit 0
4577
4578    echo "----------------------------------------------------------------------"
4579    echo "Libraries have been installed in:"
4580    for libdir in $libdirs; do
4581      echo "   $libdir"
4582    done
4583    echo
4584    echo "If you ever happen to want to link against installed libraries"
4585    echo "in a given directory, LIBDIR, you must either use libtool, and"
4586    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
4587    echo "flag during linking and do at least one of the following:"
4588    if test -n "$shlibpath_var"; then
4589      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
4590      echo "     during execution"
4591    fi
4592    if test -n "$runpath_var"; then
4593      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
4594      echo "     during linking"
4595    fi
4596    if test -n "$hardcode_libdir_flag_spec"; then
4597      libdir=LIBDIR
4598      eval flag=\"$hardcode_libdir_flag_spec\"
4599
4600      echo "   - use the \`$flag' linker flag"
4601    fi
4602    if test -n "$admincmds"; then
4603      echo "   - have your system administrator run these commands:$admincmds"
4604    fi
4605    if test -f /etc/ld.so.conf; then
4606      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
4607    fi
4608    echo
4609    echo "See any operating system documentation about shared libraries for"
4610    echo "more information, such as the ld(1) and ld.so(8) manual pages."
4611    echo "----------------------------------------------------------------------"
4612    exit 0
4613    ;;
4614
4615  # libtool execute mode
4616  execute)
4617    modename="$modename: execute"
4618
4619    # The first argument is the command name.
4620    cmd="$nonopt"
4621    if test -z "$cmd"; then
4622      $echo "$modename: you must specify a COMMAND" 1>&2
4623      $echo "$help"
4624      exit 1
4625    fi
4626
4627    # Handle -dlopen flags immediately.
4628    for file in $execute_dlfiles; do
4629      if test ! -f "$file"; then
4630        $echo "$modename: \`$file' is not a file" 1>&2
4631        $echo "$help" 1>&2
4632        exit 1
4633      fi
4634
4635      dir=
4636      case $file in
4637      *.la)
4638        # Check to see that this really is a libtool archive.
4639        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4640        else
4641          $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4642          $echo "$help" 1>&2
4643          exit 1
4644        fi
4645
4646        # Read the libtool library.
4647        dlname=
4648        library_names=
4649
4650        # If there is no directory component, then add one.
4651        case $file in
4652        */* | *\\*) . $file ;;
4653        *) . ./$file ;;
4654        esac
4655
4656        # Skip this library if it cannot be dlopened.
4657        if test -z "$dlname"; then
4658          # Warn if it was a shared library.
4659          test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
4660          continue
4661        fi
4662
4663        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4664        test "X$dir" = "X$file" && dir=.
4665
4666        if test -f "$dir/$objdir/$dlname"; then
4667          dir="$dir/$objdir"
4668        else
4669          $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
4670          exit 1
4671        fi
4672        ;;
4673
4674      *.lo)
4675        # Just add the directory containing the .lo file.
4676        dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4677        test "X$dir" = "X$file" && dir=.
4678        ;;
4679
4680      *)
4681        $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
4682        continue
4683        ;;
4684      esac
4685
4686      # Get the absolute pathname.
4687      absdir=`cd "$dir" && pwd`
4688      test -n "$absdir" && dir="$absdir"
4689
4690      # Now add the directory to shlibpath_var.
4691      if eval "test -z \"\$$shlibpath_var\""; then
4692        eval "$shlibpath_var=\"\$dir\""
4693      else
4694        eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
4695      fi
4696    done
4697
4698    # This variable tells wrapper scripts just to set shlibpath_var
4699    # rather than running their programs.
4700    libtool_execute_magic="$magic"
4701
4702    # Check if any of the arguments is a wrapper script.
4703    args=
4704    for file
4705    do
4706      case $file in
4707      -*) ;;
4708      *)
4709        # Do a test to see if this is really a libtool program.
4710        if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4711          # If there is no directory component, then add one.
4712          case $file in
4713          */* | *\\*) . $file ;;
4714          *) . ./$file ;;
4715          esac
4716
4717          # Transform arg to wrapped name.
4718          file="$progdir/$program"
4719        fi
4720        ;;
4721      esac
4722      # Quote arguments (to preserve shell metacharacters).
4723      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
4724      args="$args \"$file\""
4725    done
4726
4727    if test -z "$run"; then
4728      if test -n "$shlibpath_var"; then
4729        # Export the shlibpath_var.
4730        eval "export $shlibpath_var"
4731      fi
4732
4733      # Restore saved enviroment variables
4734      if test "${save_LC_ALL+set}" = set; then
4735        LC_ALL="$save_LC_ALL"; export LC_ALL
4736      fi
4737      if test "${save_LANG+set}" = set; then
4738        LANG="$save_LANG"; export LANG
4739      fi
4740
4741      # Now prepare to actually exec the command.
4742      exec_cmd="\$cmd$args"
4743    else
4744      # Display what would be done.
4745      if test -n "$shlibpath_var"; then
4746        eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
4747        $echo "export $shlibpath_var"
4748      fi
4749      $echo "$cmd$args"
4750      exit 0
4751    fi
4752    ;;
4753
4754  # libtool clean and uninstall mode
4755  clean | uninstall)
4756    modename="$modename: $mode"
4757    rm="$nonopt"
4758    files=
4759    rmforce=
4760    exit_status=0
4761
4762    # This variable tells wrapper scripts just to set variables rather
4763    # than running their programs.
4764    libtool_install_magic="$magic"
4765
4766    for arg
4767    do
4768      case $arg in
4769      -f) rm="$rm $arg"; rmforce=yes ;;
4770      -*) rm="$rm $arg" ;;
4771      *) files="$files $arg" ;;
4772      esac
4773    done
4774
4775    if test -z "$rm"; then
4776      $echo "$modename: you must specify an RM program" 1>&2
4777      $echo "$help" 1>&2
4778      exit 1
4779    fi
4780
4781    rmdirs=
4782
4783    for file in $files; do
4784      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
4785      if test "X$dir" = "X$file"; then
4786        dir=.
4787        objdir="$objdir"
4788      else
4789        objdir="$dir/$objdir"
4790      fi
4791      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4792      test $mode = uninstall && objdir="$dir"
4793
4794      # Remember objdir for removal later, being careful to avoid duplicates
4795      if test $mode = clean; then
4796        case " $rmdirs " in
4797          *" $objdir "*) ;;
4798          *) rmdirs="$rmdirs $objdir" ;;
4799        esac
4800      fi
4801
4802      # Don't error if the file doesn't exist and rm -f was used.
4803      if (test -L "$file") >/dev/null 2>&1 \
4804        || (test -h "$file") >/dev/null 2>&1 \
4805        || test -f "$file"; then
4806        :
4807      elif test -d "$file"; then
4808        exit_status=1
4809        continue
4810      elif test "$rmforce" = yes; then
4811        continue
4812      fi
4813
4814      rmfiles="$file"
4815
4816      case $name in
4817      *.la)
4818        # Possibly a libtool archive, so verify it.
4819        if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4820          . $dir/$name
4821
4822          # Delete the libtool libraries and symlinks.
4823          for n in $library_names; do
4824            rmfiles="$rmfiles $objdir/$n"
4825          done
4826          test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
4827          test $mode = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
4828
4829          if test $mode = uninstall; then
4830            if test -n "$library_names"; then
4831              # Do each command in the postuninstall commands.
4832              eval cmds=\"$postuninstall_cmds\"
4833              save_ifs="$IFS"; IFS='~'
4834              for cmd in $cmds; do
4835                IFS="$save_ifs"
4836                $show "$cmd"
4837                $run eval "$cmd"
4838                if test $? != 0 && test "$rmforce" != yes; then
4839                  exit_status=1
4840                fi
4841              done
4842              IFS="$save_ifs"
4843            fi
4844
4845            if test -n "$old_library"; then
4846              # Do each command in the old_postuninstall commands.
4847              eval cmds=\"$old_postuninstall_cmds\"
4848              save_ifs="$IFS"; IFS='~'
4849              for cmd in $cmds; do
4850                IFS="$save_ifs"
4851                $show "$cmd"
4852                $run eval "$cmd"
4853                if test $? != 0 && test "$rmforce" != yes; then
4854                  exit_status=1
4855                fi
4856              done
4857              IFS="$save_ifs"
4858            fi
4859            # FIXME: should reinstall the best remaining shared library.
4860          fi
4861        fi
4862        ;;
4863
4864      *.lo)
4865        if test "$build_old_libs" = yes; then
4866          oldobj=`$echo "X$name" | $Xsed -e "$lo2o"`
4867          rmfiles="$rmfiles $dir/$oldobj"
4868        fi
4869        ;;
4870
4871      *)
4872        # Do a test to see if this is a libtool program.
4873        if test $mode = clean &&
4874           (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
4875          relink_command=
4876          . $dir/$file
4877
4878          rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
4879          if test "$fast_install" = yes && test -n "$relink_command"; then
4880            rmfiles="$rmfiles $objdir/lt-$name"
4881          fi
4882        fi
4883        ;;
4884      esac
4885      $show "$rm $rmfiles"
4886      $run $rm $rmfiles || exit_status=1
4887    done
4888
4889    # Try to remove the ${objdir}s in the directories where we deleted files
4890    for dir in $rmdirs; do
4891      if test -d "$dir"; then
4892        $show "rmdir $dir"
4893        $run rmdir $dir >/dev/null 2>&1
4894      fi
4895    done
4896
4897    exit $exit_status
4898    ;;
4899
4900  "")
4901    $echo "$modename: you must specify a MODE" 1>&2
4902    $echo "$generic_help" 1>&2
4903    exit 1
4904    ;;
4905  esac
4906
4907  if test -z "$exec_cmd"; then
4908    $echo "$modename: invalid operation mode \`$mode'" 1>&2
4909    $echo "$generic_help" 1>&2
4910    exit 1
4911  fi
4912fi # test -z "$show_help"
4913
4914if test -n "$exec_cmd"; then
4915  eval exec $exec_cmd
4916  exit 1
4917fi
4918
4919# We need to display help for each of the modes.
4920case $mode in
4921"") $echo \
4922"Usage: $modename [OPTION]... [MODE-ARG]...
4923
4924Provide generalized library-building support services.
4925
4926    --config          show all configuration variables
4927    --debug           enable verbose shell tracing
4928-n, --dry-run         display commands without modifying any files
4929    --features        display basic configuration information and exit
4930    --finish          same as \`--mode=finish'
4931    --help            display this help message and exit
4932    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
4933    --quiet           same as \`--silent'
4934    --silent          don't print informational messages
4935    --version         print version information
4936
4937MODE must be one of the following:
4938
4939      clean           remove files from the build directory
4940      compile         compile a source file into a libtool object
4941      execute         automatically set library path, then run a program
4942      finish          complete the installation of libtool libraries
4943      install         install libraries or executables
4944      link            create a library or an executable
4945      uninstall       remove libraries from an installed directory
4946
4947MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
4948a more detailed description of MODE."
4949  exit 0
4950  ;;
4951
4952clean)
4953  $echo \
4954"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
4955
4956Remove files from the build directory.
4957
4958RM is the name of the program to use to delete files associated with each FILE
4959(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
4960to RM.
4961
4962If FILE is a libtool library, object or program, all the files associated
4963with it are deleted. Otherwise, only FILE itself is deleted using RM."
4964  ;;
4965
4966compile)
4967  $echo \
4968"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
4969
4970Compile a source file into a libtool library object.
4971
4972This mode accepts the following additional options:
4973
4974  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
4975  -prefer-pic       try to building PIC objects only
4976  -prefer-non-pic   try to building non-PIC objects only
4977  -static           always build a \`.o' file suitable for static linking
4978
4979COMPILE-COMMAND is a command to be used in creating a \`standard' object file
4980from the given SOURCEFILE.
4981
4982The output file name is determined by removing the directory component from
4983SOURCEFILE, then substituting the C source code suffix \`.c' with the
4984library object suffix, \`.lo'."
4985  ;;
4986
4987execute)
4988  $echo \
4989"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
4990
4991Automatically set library path, then run a program.
4992
4993This mode accepts the following additional options:
4994
4995  -dlopen FILE      add the directory containing FILE to the library path
4996
4997This mode sets the library path environment variable according to \`-dlopen'
4998flags.
4999
5000If any of the ARGS are libtool executable wrappers, then they are translated
5001into their corresponding uninstalled binary, and any of their required library
5002directories are added to the library path.
5003
5004Then, COMMAND is executed, with ARGS as arguments."
5005  ;;
5006
5007finish)
5008  $echo \
5009"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5010
5011Complete the installation of libtool libraries.
5012
5013Each LIBDIR is a directory that contains libtool libraries.
5014
5015The commands that this mode executes may require superuser privileges.  Use
5016the \`--dry-run' option if you just want to see what would be executed."
5017  ;;
5018
5019install)
5020  $echo \
5021"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5022
5023Install executables or libraries.
5024
5025INSTALL-COMMAND is the installation command.  The first component should be
5026either the \`install' or \`cp' program.
5027
5028The rest of the components are interpreted as arguments to that command (only
5029BSD-compatible install options are recognized)."
5030  ;;
5031
5032link)
5033  $echo \
5034"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5035
5036Link object files or libraries together to form another library, or to
5037create an executable program.
5038
5039LINK-COMMAND is a command using the C compiler that you would use to create
5040a program from several object files.
5041
5042The following components of LINK-COMMAND are treated specially:
5043
5044  -all-static       do not do any dynamic linking at all
5045  -avoid-version    do not add a version suffix if possible
5046  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
5047  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
5048  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5049  -export-symbols SYMFILE
5050                    try to export only the symbols listed in SYMFILE
5051  -export-symbols-regex REGEX
5052                    try to export only the symbols matching REGEX
5053  -LLIBDIR          search LIBDIR for required installed libraries
5054  -lNAME            OUTPUT-FILE requires the installed library libNAME
5055  -module           build a library that can dlopened
5056  -no-fast-install  disable the fast-install mode
5057  -no-install       link a not-installable executable
5058  -no-undefined     declare that a library does not refer to external symbols
5059  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
5060  -release RELEASE  specify package release information
5061  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
5062  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5063  -static           do not do any dynamic linking of libtool libraries
5064  -version-info CURRENT[:REVISION[:AGE]]
5065                    specify library version info [each variable defaults to 0]
5066
5067All other options (arguments beginning with \`-') are ignored.
5068
5069Every other argument is treated as a filename.  Files ending in \`.la' are
5070treated as uninstalled libtool libraries, other files are standard or library
5071object files.
5072
5073If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5074only library objects (\`.lo' files) may be specified, and \`-rpath' is
5075required, except when creating a convenience library.
5076
5077If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5078using \`ar' and \`ranlib', or on Windows using \`lib'.
5079
5080If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5081is created, otherwise an executable program is created."
5082  ;;
5083
5084uninstall)
5085  $echo \
5086"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5087
5088Remove libraries from an installation directory.
5089
5090RM is the name of the program to use to delete files associated with each FILE
5091(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
5092to RM.
5093
5094If FILE is a libtool library, all the files associated with it are deleted.
5095Otherwise, only FILE itself is deleted using RM."
5096  ;;
5097
5098*)
5099  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5100  $echo "$help" 1>&2
5101  exit 1
5102  ;;
5103esac
5104
5105echo
5106$echo "Try \`$modename --help' for more information about other modes."
5107
5108exit 0
5109
5110# Local Variables:
5111# mode:shell-script
5112# sh-indentation:2
5113# End:
Note: See TracBrowser for help on using the repository browser.