source: OGRE/trunk/ogrenew/ltmain.sh @ 657

Revision 657, 141.4 KB checked in by mattausch, 18 years ago (diff)

added ogre dependencies and patched ogre sources

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