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