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		  if test "$absdir" != "$libdir"; then
2387		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2388		  fi
2389		  path="-L$absdir"
2390		fi
2391		;;
2392	      *) continue ;;
2393	      esac
2394	      case " $deplibs " in
2395	      *" $path "*) ;;
2396	      *) deplibs="$deplibs $path" ;;
2397	      esac
2398	    done
2399	  fi # link_all_deplibs != no
2400	fi # linkmode = lib
2401      done # for deplib in $libs
2402      dependency_libs="$newdependency_libs"
2403      if test "$pass" = dlpreopen; then
2404	# Link the dlpreopened libraries before other libraries
2405	for deplib in $save_deplibs; do
2406	  deplibs="$deplib $deplibs"
2407	done
2408      fi
2409      if test "$pass" != dlopen; then
2410	if test "$pass" != conv; then
2411	  # Make sure lib_search_path contains only unique directories.
2412	  lib_search_path=
2413	  for dir in $newlib_search_path; do
2414	    case "$lib_search_path " in
2415	    *" $dir "*) ;;
2416	    *) lib_search_path="$lib_search_path $dir" ;;
2417	    esac
2418	  done
2419	  newlib_search_path=
2420	fi
2421
2422	if test "$linkmode,$pass" != "prog,link"; then
2423	  vars="deplibs"
2424	else
2425	  vars="compile_deplibs finalize_deplibs"
2426	fi
2427	for var in $vars dependency_libs; do
2428	  # Add libraries to $var in reverse order
2429	  eval tmp_libs=\"\$$var\"
2430	  new_libs=
2431	  for deplib in $tmp_libs; do
2432	    # FIXME: Pedantically, this is the right thing to do, so
2433	    #        that some nasty dependency loop isn't accidentally
2434	    #        broken:
2435	    #new_libs="$deplib $new_libs"
2436	    # Pragmatically, this seems to cause very few problems in
2437	    # practice:
2438	    case $deplib in
2439	    -L*) new_libs="$deplib $new_libs" ;;
2440	    *)
2441	      # And here is the reason: when a library appears more
2442	      # than once as an explicit dependence of a library, or
2443	      # is implicitly linked in more than once by the
2444	      # compiler, it is considered special, and multiple
2445	      # occurrences thereof are not removed.  Compare this
2446	      # with having the same library being listed as a
2447	      # dependency of multiple other libraries: in this case,
2448	      # we know (pedantically, we assume) the library does not
2449	      # need to be listed more than once, so we keep only the
2450	      # last copy.  This is not always right, but it is rare
2451	      # enough that we require users that really mean to play
2452	      # such unportable linking tricks to link the library
2453	      # using -Wl,-lname, so that libtool does not consider it
2454	      # for duplicate removal.
2455	      case " $specialdeplibs " in
2456	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
2457	      *)
2458		case " $new_libs " in
2459		*" $deplib "*) ;;
2460		*) new_libs="$deplib $new_libs" ;;
2461		esac
2462		;;
2463	      esac
2464	      ;;
2465	    esac
2466	  done
2467	  tmp_libs=
2468	  for deplib in $new_libs; do
2469	    case $deplib in
2470	    -L*)
2471	      case " $tmp_libs " in
2472	      *" $deplib "*) ;;
2473	      *) tmp_libs="$tmp_libs $deplib" ;;
2474	      esac
2475	      ;;
2476	    -R*)
2477	      temp_xrpath=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2478	      case " $xrpath " in
2479	      *" $temp_xrpath "*) ;;
2480	      *) xrpath="$xrpath $temp_xrpath";;
2481	      esac;;
2482	    *) tmp_libs="$tmp_libs $deplib" ;;
2483	    esac
2484	  done
2485	  eval $var=\"$tmp_libs\"
2486	done # for var
2487      fi
2488    done # for pass
2489    if test "$linkmode" = prog; then
2490      dlfiles="$newdlfiles"
2491      dlprefiles="$newdlprefiles"
2492    fi
2493
2494    case $linkmode in
2495    oldlib)
2496      if test -n "$deplibs"; then
2497	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2498      fi
2499
2500      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2501	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2502      fi
2503
2504      if test -n "$rpath"; then
2505	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2506      fi
2507
2508      if test -n "$xrpath"; then
2509	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2510      fi
2511
2512      if test -n "$vinfo"; then
2513	$echo "$modename: warning: \`-version-info' is ignored for archives" 1>&2
2514      fi
2515
2516      if test -n "$release"; then
2517	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2518      fi
2519
2520      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2521	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2522      fi
2523
2524      # Now set the variables for building old libraries.
2525      build_libtool_libs=no
2526      oldlibs="$output"
2527      objs="$objs$old_deplibs"
2528      ;;
2529
2530    lib)
2531      # Make sure we only generate libraries of the form `libNAME.la'.
2532      case $outputname in
2533      lib*)
2534	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2535	eval libname=\"$libname_spec\"
2536	;;
2537      *)
2538	if test "$module" = no; then
2539	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2540	  $echo "$help" 1>&2
2541	  exit 1
2542	fi
2543	if test "$need_lib_prefix" != no; then
2544	  # Add the "lib" prefix for modules if required
2545	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2546	  eval libname=\"$libname_spec\"
2547	else
2548	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2549	fi
2550	;;
2551      esac
2552
2553      if test -n "$objs"; then
2554	if test "$deplibs_check_method" != pass_all; then
2555	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2556	  exit 1
2557	else
2558	  echo
2559	  echo "*** Warning: Linking the shared library $output against the non-libtool"
2560	  echo "*** objects $objs is not portable!"
2561	  libobjs="$libobjs $objs"
2562	fi
2563      fi
2564
2565      if test "$dlself" != no; then
2566	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2567      fi
2568
2569      set dummy $rpath
2570      if test "$#" -gt 2; then
2571	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2572      fi
2573      install_libdir="$2"
2574
2575      oldlibs=
2576      if test -z "$rpath"; then
2577	if test "$build_libtool_libs" = yes; then
2578	  # Building a libtool convenience library.
2579	  # Some compilers have problems with a `.al' extension so
2580	  # convenience libraries should have the same extension an
2581	  # archive normally would.
2582	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
2583	  build_libtool_libs=convenience
2584	  build_old_libs=yes
2585	fi
2586
2587	if test -n "$vinfo"; then
2588	  $echo "$modename: warning: \`-version-info' is ignored for convenience libraries" 1>&2
2589	fi
2590
2591	if test -n "$release"; then
2592	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2593	fi
2594      else
2595
2596	# Parse the version information argument.
2597	save_ifs="$IFS"; IFS=':'
2598	set dummy $vinfo 0 0 0
2599	IFS="$save_ifs"
2600
2601	if test -n "$8"; then
2602	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
2603	  $echo "$help" 1>&2
2604	  exit 1
2605	fi
2606
2607	current="$2"
2608	revision="$3"
2609	age="$4"
2610
2611	# Check that each of the things are valid numbers.
2612	case $current in
2613	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2614	*)
2615	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2616	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2617	  exit 1
2618	  ;;
2619	esac
2620
2621	case $revision in
2622	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2623	*)
2624	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2625	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2626	  exit 1
2627	  ;;
2628	esac
2629
2630	case $age in
2631	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2632	*)
2633	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2634	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2635	  exit 1
2636	  ;;
2637	esac
2638
2639	if test "$age" -gt "$current"; then
2640	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2641	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2642	  exit 1
2643	fi
2644
2645	# Calculate the version variables.
2646	major=
2647	versuffix=
2648	verstring=
2649	case $version_type in
2650	none) ;;
2651
2652	darwin)
2653	  # Like Linux, but with the current version available in
2654	  # verstring for coding it into the library header
2655	  major=.`expr $current - $age`
2656	  versuffix="$major.$age.$revision"
2657	  # Darwin ld doesn't like 0 for these options...
2658	  minor_current=`expr $current + 1`
2659	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2660	  ;;
2661
2662	freebsd-aout)
2663	  major=".$current"
2664	  versuffix=".$current.$revision";
2665	  ;;
2666
2667	freebsd-elf)
2668	  major=".$current"
2669	  versuffix=".$current";
2670	  ;;
2671
2672	irix | nonstopux)
2673	  case $version_type in
2674	    nonstopux) verstring_prefix=nonstopux ;;
2675	    *)         verstring_prefix=sgi ;;
2676	  esac
2677	  verstring="$verstring_prefix$major.$revision"
2678
2679	  major=`expr $current - $age + 1`
2680
2681	  # Add in all the interfaces that we are compatible with.
2682	  loop=$revision
2683	  while test "$loop" -ne 0; do
2684	    iface=`expr $revision - $loop`
2685	    loop=`expr $loop - 1`
2686	    verstring="$verstring_prefix$major.$iface:$verstring"
2687	  done
2688
2689	  # Before this point, $major must not contain `.'.
2690	  major=.$major
2691	  versuffix="$major.$revision"
2692	  ;;
2693
2694	linux)
2695	  major=.`expr $current - $age`
2696	  versuffix="$major.$age.$revision"
2697	  ;;
2698
2699	osf)
2700	  major=`expr $current - $age`
2701	  versuffix=".$current.$age.$revision"
2702	  verstring="$current.$age.$revision"
2703
2704	  # Add in all the interfaces that we are compatible with.
2705	  loop=$age
2706	  while test "$loop" -ne 0; do
2707	    iface=`expr $current - $loop`
2708	    loop=`expr $loop - 1`
2709	    verstring="$verstring:${iface}.0"
2710	  done
2711
2712	  # Make executables depend on our current version.
2713	  verstring="$verstring:${current}.0"
2714	  ;;
2715
2716	sunos)
2717	  major=".$current"
2718	  versuffix=".$current.$revision"
2719	  ;;
2720
2721	windows)
2722	  # Use '-' rather than '.', since we only want one
2723	  # extension on DOS 8.3 filesystems.
2724	  major=`expr $current - $age`
2725	  versuffix="-$major"
2726	  ;;
2727
2728	*)
2729	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
2730	  echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
2731	  exit 1
2732	  ;;
2733	esac
2734
2735	# Clear the version info if we defaulted, and they specified a release.
2736	if test -z "$vinfo" && test -n "$release"; then
2737	  major=
2738	  case $version_type in
2739	  darwin)
2740	    # we can't check for "0.0" in archive_cmds due to quoting
2741	    # problems, so we reset it completely
2742	    verstring=
2743	    ;;
2744	  *)
2745	    verstring="0.0"
2746	    ;;
2747	  esac
2748	  if test "$need_version" = no; then
2749	    versuffix=
2750	  else
2751	    versuffix=".0.0"
2752	  fi
2753	fi
2754
2755	# Remove version info from name if versioning should be avoided
2756	if test "$avoid_version" = yes && test "$need_version" = no; then
2757	  major=
2758	  versuffix=
2759	  verstring=""
2760	fi
2761
2762	# Check to see if the archive will have undefined symbols.
2763	if test "$allow_undefined" = yes; then
2764	  if test "$allow_undefined_flag" = unsupported; then
2765	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
2766	    build_libtool_libs=no
2767	    build_old_libs=yes
2768	  fi
2769	else
2770	  # Don't allow undefined symbols.
2771	  allow_undefined_flag="$no_undefined_flag"
2772	fi
2773      fi
2774
2775      if test "$mode" != relink; then
2776	# Remove our outputs, but don't remove object files since they
2777	# may have been created when compiling PIC objects.
2778	removelist=
2779	tempremovelist=`echo "$output_objdir/*"`
2780	for p in $tempremovelist; do
2781	  case $p in
2782	    *.$objext)
2783	       ;;
2784	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
2785	       removelist="$removelist $p"
2786	       ;;
2787	    *) ;;
2788	  esac
2789	done
2790	if test -n "$removelist"; then
2791	  $show "${rm}r $removelist"
2792	  $run ${rm}r $removelist
2793	fi
2794      fi
2795
2796      # Now set the variables for building old libraries.
2797      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
2798	oldlibs="$oldlibs $output_objdir/$libname.$libext"
2799
2800	# Transform .lo files to .o files.
2801	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
2802      fi
2803
2804      # Eliminate all temporary directories.
2805      for path in $notinst_path; do
2806	lib_search_path=`echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
2807	deplibs=`echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
2808	dependency_libs=`echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
2809      done
2810
2811      if test -n "$xrpath"; then
2812	# If the user specified any rpath flags, then add them.
2813	temp_xrpath=
2814	for libdir in $xrpath; do
2815	  temp_xrpath="$temp_xrpath -R$libdir"
2816	  case "$finalize_rpath " in
2817	  *" $libdir "*) ;;
2818	  *) finalize_rpath="$finalize_rpath $libdir" ;;
2819	  esac
2820	done
2821	if true || test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
2822	  dependency_libs="$temp_xrpath $dependency_libs"
2823	fi
2824      fi
2825
2826      # Make sure dlfiles contains only unique files that won't be dlpreopened
2827      old_dlfiles="$dlfiles"
2828      dlfiles=
2829      for lib in $old_dlfiles; do
2830	case " $dlprefiles $dlfiles " in
2831	*" $lib "*) ;;
2832	*) dlfiles="$dlfiles $lib" ;;
2833	esac
2834      done
2835
2836      # Make sure dlprefiles contains only unique files
2837      old_dlprefiles="$dlprefiles"
2838      dlprefiles=
2839      for lib in $old_dlprefiles; do
2840	case "$dlprefiles " in
2841	*" $lib "*) ;;
2842	*) dlprefiles="$dlprefiles $lib" ;;
2843	esac
2844      done
2845
2846      if test "$build_libtool_libs" = yes; then
2847	if test -n "$rpath"; then
2848	  case $host in
2849	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
2850	    # these systems don't actually have a c library (as such)!
2851	    ;;
2852	  *-*-rhapsody* | *-*-darwin1.[012])
2853	    # Rhapsody C library is in the System framework
2854	    deplibs="$deplibs -framework System"
2855	    ;;
2856	  *-*-netbsd*)
2857	    # Don't link with libc until the a.out ld.so is fixed.
2858	    ;;
2859	  *-*-openbsd* | *-*-freebsd*)
2860	    # Do not include libc due to us having libc/libc_r.
2861	    test "X$arg" = "X-lc" && continue
2862	    ;;
2863 	  *)
2864	    # Add libc to deplibs on all other systems if necessary.
2865	    if test "$build_libtool_need_lc" = "yes"; then
2866	      deplibs="$deplibs -lc"
2867	    fi
2868	    ;;
2869	  esac
2870	fi
2871
2872	# Transform deplibs into only deplibs that can be linked in shared.
2873	name_save=$name
2874	libname_save=$libname
2875	release_save=$release
2876	versuffix_save=$versuffix
2877	major_save=$major
2878	# I'm not sure if I'm treating the release correctly.  I think
2879	# release should show up in the -l (ie -lgmp5) so we don't want to
2880	# add it in twice.  Is that correct?
2881	release=""
2882	versuffix=""
2883	major=""
2884	newdeplibs=
2885	droppeddeps=no
2886	case $deplibs_check_method in
2887	pass_all)
2888	  # Don't check for shared/static.  Everything works.
2889	  # This might be a little naive.  We might want to check
2890	  # whether the library exists or not.  But this is on
2891	  # osf3 & osf4 and I'm not really sure... Just
2892	  # implementing what was already the behaviour.
2893	  newdeplibs=$deplibs
2894	  ;;
2895	test_compile)
2896	  # This code stresses the "libraries are programs" paradigm to its
2897	  # limits. Maybe even breaks it.  We compile a program, linking it
2898	  # against the deplibs as a proxy for the library.  Then we can check
2899	  # whether they linked in statically or dynamically with ldd.
2900	  $rm conftest.c
2901	  cat > conftest.c <<EOF
2902	  int main() { return 0; }
2903EOF
2904	  $rm conftest
2905	  $LTCC -o conftest conftest.c $deplibs
2906	  if test "$?" -eq 0 ; then
2907	    ldd_output=`ldd conftest`
2908	    for i in $deplibs; do
2909	      name="`expr $i : '-l\(.*\)'`"
2910	      # If $name is empty we are operating on a -L argument.
2911             if test "$name" != "" && test "$name" -ne "0"; then
2912		libname=`eval \\$echo \"$libname_spec\"`
2913		deplib_matches=`eval \\$echo \"$library_names_spec\"`
2914		set dummy $deplib_matches
2915		deplib_match=$2
2916		if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2917		  newdeplibs="$newdeplibs $i"
2918		else
2919		  droppeddeps=yes
2920		  echo
2921		  echo "*** Warning: dynamic linker does not accept needed library $i."
2922		  echo "*** I have the capability to make that library automatically link in when"
2923		  echo "*** you link to this library.  But I can only do this if you have a"
2924		  echo "*** shared version of the library, which I believe you do not have"
2925		  echo "*** because a test_compile did reveal that the linker did not use it for"
2926		  echo "*** its dynamic dependency list that programs get resolved with at runtime."
2927		fi
2928	      else
2929		newdeplibs="$newdeplibs $i"
2930	      fi
2931	    done
2932	  else
2933	    # Error occured in the first compile.  Let's try to salvage
2934	    # the situation: Compile a separate program for each library.
2935	    for i in $deplibs; do
2936	      name="`expr $i : '-l\(.*\)'`"
2937	     # If $name is empty we are operating on a -L argument.
2938             if test "$name" != "" && test "$name" != "0"; then
2939		$rm conftest
2940		$LTCC -o conftest conftest.c $i
2941		# Did it work?
2942		if test "$?" -eq 0 ; then
2943		  ldd_output=`ldd conftest`
2944		  libname=`eval \\$echo \"$libname_spec\"`
2945		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
2946		  set dummy $deplib_matches
2947		  deplib_match=$2
2948		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
2949		    newdeplibs="$newdeplibs $i"
2950		  else
2951		    droppeddeps=yes
2952		    echo
2953		    echo "*** Warning: dynamic linker does not accept needed library $i."
2954		    echo "*** I have the capability to make that library automatically link in when"
2955		    echo "*** you link to this library.  But I can only do this if you have a"
2956		    echo "*** shared version of the library, which you do not appear to have"
2957		    echo "*** because a test_compile did reveal that the linker did not use this one"
2958		    echo "*** as a dynamic dependency that programs can get resolved with at runtime."
2959		  fi
2960		else
2961		  droppeddeps=yes
2962		  echo
2963		  echo "*** Warning!  Library $i is needed by this library but I was not able to"
2964		  echo "***  make it link in!  You will probably need to install it or some"
2965		  echo "*** library that it depends on before this library will be fully"
2966		  echo "*** functional.  Installing it before continuing would be even better."
2967		fi
2968	      else
2969		newdeplibs="$newdeplibs $i"
2970	      fi
2971	    done
2972	  fi
2973	  ;;
2974	file_magic*)
2975	  set dummy $deplibs_check_method
2976	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2977	  for a_deplib in $deplibs; do
2978	    name="`expr $a_deplib : '-l\(.*\)'`"
2979	    # If $name is empty we are operating on a -L argument.
2980           if test "$name" != "" && test  "$name" != "0"; then
2981	      libname=`eval \\$echo \"$libname_spec\"`
2982	      for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
2983		    potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
2984		    for potent_lib in $potential_libs; do
2985		      # Follow soft links.
2986		      if ls -lLd "$potent_lib" 2>/dev/null \
2987			 | grep " -> " >/dev/null; then
2988			continue
2989		      fi
2990		      # The statement above tries to avoid entering an
2991		      # endless loop below, in case of cyclic links.
2992		      # We might still enter an endless loop, since a link
2993		      # loop can be closed while we follow links,
2994		      # but so what?
2995		      potlib="$potent_lib"
2996		      while test -h "$potlib" 2>/dev/null; do
2997			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
2998			case $potliblink in
2999			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3000			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3001			esac
3002		      done
3003		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3004			 | ${SED} 10q \
3005			 | egrep "$file_magic_regex" > /dev/null; then
3006			newdeplibs="$newdeplibs $a_deplib"
3007			a_deplib=""
3008			break 2
3009		      fi
3010		    done
3011	      done
3012	      if test -n "$a_deplib" ; then
3013		droppeddeps=yes
3014		echo
3015		echo "*** Warning: linker path does not have real file for library $a_deplib."
3016		echo "*** I have the capability to make that library automatically link in when"
3017		echo "*** you link to this library.  But I can only do this if you have a"
3018		echo "*** shared version of the library, which you do not appear to have"
3019		echo "*** because I did check the linker path looking for a file starting"
3020		if test -z "$potlib" ; then
3021		  echo "*** with $libname but no candidates were found. (...for file magic test)"
3022		else
3023		  echo "*** with $libname and none of the candidates passed a file format test"
3024		  echo "*** using a file magic. Last file checked: $potlib"
3025		fi
3026	      fi
3027	    else
3028	      # Add a -L argument.
3029	      newdeplibs="$newdeplibs $a_deplib"
3030	    fi
3031	  done # Gone through all deplibs.
3032	  ;;
3033	match_pattern*)
3034	  set dummy $deplibs_check_method
3035	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3036	  for a_deplib in $deplibs; do
3037	    name="`expr $a_deplib : '-l\(.*\)'`"
3038	    # If $name is empty we are operating on a -L argument.
3039	    if test -n "$name" && test "$name" != "0"; then
3040	      libname=`eval \\$echo \"$libname_spec\"`
3041	      for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3042		potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3043		for potent_lib in $potential_libs; do
3044		  potlib="$potent_lib" # see symlink-check above in file_magic test
3045		  if eval echo \"$potent_lib\" 2>/dev/null \
3046		      | ${SED} 10q \
3047		      | egrep "$match_pattern_regex" > /dev/null; then
3048		    newdeplibs="$newdeplibs $a_deplib"
3049		    a_deplib=""
3050		    break 2
3051		  fi
3052		done
3053	      done
3054	      if test -n "$a_deplib" ; then
3055		droppeddeps=yes
3056		echo
3057		echo "*** Warning: linker path does not have real file for library $a_deplib."
3058		echo "*** I have the capability to make that library automatically link in when"
3059		echo "*** you link to this library.  But I can only do this if you have a"
3060		echo "*** shared version of the library, which you do not appear to have"
3061		echo "*** because I did check the linker path looking for a file starting"
3062		if test -z "$potlib" ; then
3063		  echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3064		else
3065		  echo "*** with $libname and none of the candidates passed a file format test"
3066		  echo "*** using a regex pattern. Last file checked: $potlib"
3067		fi
3068	      fi
3069	    else
3070	      # Add a -L argument.
3071	      newdeplibs="$newdeplibs $a_deplib"
3072	    fi
3073	  done # Gone through all deplibs.
3074	  ;;
3075	none | unknown | *)
3076	  newdeplibs=""
3077	  if $echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3078	       -e 's/ -[LR][^ ]*//g' -e 's/[ 	]//g' |
3079	     grep . >/dev/null; then
3080	    echo
3081	    if test "X$deplibs_check_method" = "Xnone"; then
3082	      echo "*** Warning: inter-library dependencies are not supported in this platform."
3083	    else
3084	      echo "*** Warning: inter-library dependencies are not known to be supported."
3085	    fi
3086	    echo "*** All declared inter-library dependencies are being dropped."
3087	    droppeddeps=yes
3088	  fi
3089	  ;;
3090	esac
3091	versuffix=$versuffix_save
3092	major=$major_save
3093	release=$release_save
3094	libname=$libname_save
3095	name=$name_save
3096
3097	case $host in
3098	*-*-rhapsody* | *-*-darwin1.[012])
3099	  # On Rhapsody replace the C library is the System framework
3100	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3101	  ;;
3102	esac
3103
3104	if test "$droppeddeps" = yes; then
3105	  if test "$module" = yes; then
3106	    echo
3107	    echo "*** Warning: libtool could not satisfy all declared inter-library"
3108	    echo "*** dependencies of module $libname.  Therefore, libtool will create"
3109	    echo "*** a static module, that should work as long as the dlopening"
3110	    echo "*** application is linked with the -dlopen flag."
3111	    if test -z "$global_symbol_pipe"; then
3112	      echo
3113	      echo "*** However, this would only work if libtool was able to extract symbol"
3114	      echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3115	      echo "*** not find such a program.  So, this module is probably useless."
3116	      echo "*** \`nm' from GNU binutils and a full rebuild may help."
3117	    fi
3118	    if test "$build_old_libs" = no; then
3119	      oldlibs="$output_objdir/$libname.$libext"
3120	      build_libtool_libs=module
3121	      build_old_libs=yes
3122	    else
3123	      build_libtool_libs=no
3124	    fi
3125	  else
3126	    echo "*** The inter-library dependencies that have been dropped here will be"
3127	    echo "*** automatically added whenever a program is linked with this library"
3128	    echo "*** or is declared to -dlopen it."
3129
3130	    if test "$allow_undefined" = no; then
3131	      echo
3132	      echo "*** Since this library must not contain undefined symbols,"
3133	      echo "*** because either the platform does not support them or"
3134	      echo "*** it was explicitly requested with -no-undefined,"
3135	      echo "*** libtool will only create a static version of it."
3136	      if test "$build_old_libs" = no; then
3137		oldlibs="$output_objdir/$libname.$libext"
3138		build_libtool_libs=module
3139		build_old_libs=yes
3140	      else
3141		build_libtool_libs=no
3142	      fi
3143	    fi
3144	  fi
3145	fi
3146	# Done checking deplibs!
3147	deplibs=$newdeplibs
3148      fi
3149
3150      # All the library-specific variables (install_libdir is set above).
3151      library_names=
3152      old_library=
3153      dlname=
3154
3155      # Test again, we may have decided not to build it any more
3156      if test "$build_libtool_libs" = yes; then
3157	if test "$hardcode_into_libs" = yes; then
3158	  # Hardcode the library paths
3159	  hardcode_libdirs=
3160	  dep_rpath=
3161	  rpath="$finalize_rpath"
3162	  test "$mode" != relink && test "$fast_install" = no && rpath="$compile_rpath$rpath"
3163	  for libdir in $rpath; do
3164	    if test -n "$hardcode_libdir_flag_spec"; then
3165	      if test -n "$hardcode_libdir_separator"; then
3166		if test -z "$hardcode_libdirs"; then
3167		  hardcode_libdirs="$libdir"
3168		else
3169		  # Just accumulate the unique libdirs.
3170		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3171		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3172		    ;;
3173		  *)
3174		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3175		    ;;
3176		  esac
3177		fi
3178	      else
3179		eval flag=\"$hardcode_libdir_flag_spec\"
3180		dep_rpath="$dep_rpath $flag"
3181	      fi
3182	    elif test -n "$runpath_var"; then
3183	      case "$perm_rpath " in
3184	      *" $libdir "*) ;;
3185	      *) perm_rpath="$perm_rpath $libdir" ;;
3186	      esac
3187	    fi
3188	  done
3189	  # Substitute the hardcoded libdirs into the rpath.
3190	  if test -n "$hardcode_libdir_separator" &&
3191	     test -n "$hardcode_libdirs"; then
3192	    libdir="$hardcode_libdirs"
3193	    eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3194	  fi
3195	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
3196	    # We should set the runpath_var.
3197	    rpath=
3198	    for dir in $perm_rpath; do
3199	      rpath="$rpath$dir:"
3200	    done
3201	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3202	  fi
3203	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3204	fi
3205
3206	shlibpath="$finalize_shlibpath"
3207	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3208	if test -n "$shlibpath"; then
3209	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3210	fi
3211
3212	# Get the real and link names of the library.
3213	eval library_names=\"$library_names_spec\"
3214	set dummy $library_names
3215	realname="$2"
3216	shift; shift
3217
3218	if test -n "$soname_spec"; then
3219	  eval soname=\"$soname_spec\"
3220	else
3221	  soname="$realname"
3222	fi
3223	if test -z "$dlname"; then
3224	  dlname=$soname
3225	fi
3226
3227	lib="$output_objdir/$realname"
3228	for link
3229	do
3230	  linknames="$linknames $link"
3231	done
3232
3233	# Use standard objects if they are pic
3234	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3235
3236	# Prepare the list of exported symbols
3237	if test -z "$export_symbols"; then
3238	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3239	    $show "generating symbol list for \`$libname.la'"
3240	    export_symbols="$output_objdir/$libname.exp"
3241	    $run $rm $export_symbols
3242	    eval cmds=\"$export_symbols_cmds\"
3243	    save_ifs="$IFS"; IFS='~'
3244	    for cmd in $cmds; do
3245	      IFS="$save_ifs"
3246	      $show "$cmd"
3247	      $run eval "$cmd" || exit $?
3248	    done
3249	    IFS="$save_ifs"
3250	    if test -n "$export_symbols_regex"; then
3251	      $show "egrep -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3252	      $run eval 'egrep -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3253	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3254	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
3255	    fi
3256	  fi
3257	fi
3258
3259	if test -n "$export_symbols" && test -n "$include_expsyms"; then
3260	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3261	fi
3262
3263	if test -n "$convenience"; then
3264	  if test -n "$whole_archive_flag_spec"; then
3265	    save_libobjs=$libobjs
3266	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3267	  else
3268	    gentop="$output_objdir/${outputname}x"
3269	    $show "${rm}r $gentop"
3270	    $run ${rm}r "$gentop"
3271	    $show "$mkdir $gentop"
3272	    $run $mkdir "$gentop"
3273	    status=$?
3274	    if test "$status" -ne 0 && test ! -d "$gentop"; then
3275	      exit $status
3276	    fi
3277	    generated="$generated $gentop"
3278
3279	    for xlib in $convenience; do
3280	      # Extract the objects.
3281	      case $xlib in
3282	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3283	      *) xabs=`pwd`"/$xlib" ;;
3284	      esac
3285	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3286	      xdir="$gentop/$xlib"
3287
3288	      $show "${rm}r $xdir"
3289	      $run ${rm}r "$xdir"
3290	      $show "$mkdir $xdir"
3291	      $run $mkdir "$xdir"
3292	      status=$?
3293	      if test "$status" -ne 0 && test ! -d "$xdir"; then
3294		exit $status
3295	      fi
3296	      $show "(cd $xdir && $AR x $xabs)"
3297	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3298
3299	      libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3300	    done
3301	  fi
3302	fi
3303
3304	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3305	  eval flag=\"$thread_safe_flag_spec\"
3306	  linker_flags="$linker_flags $flag"
3307	fi
3308
3309	# Make a backup of the uninstalled library when relinking
3310	if test "$mode" = relink; then
3311	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3312	fi
3313
3314	# Add all flags from the command line.  We here create a library,
3315	# but those flags were only added to compile_command and
3316	# finalize_command, which are only used when creating executables.
3317	# So do it by hand here.
3318	compiler_flags="$compiler_flags $add_flags"
3319	# Only add it to commands which use CC, instead of LD, i.e.
3320	# only to $compiler_flags
3321	#linker_flags="$linker_flags $add_flags"
3322
3323	# Do each of the archive commands.
3324	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3325	  eval cmds=\"$archive_expsym_cmds\"
3326	else
3327	  eval cmds=\"$archive_cmds\"
3328	fi
3329
3330	if len=`expr "X$cmds" : ".*"` &&
3331	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3332	  :
3333	else
3334	  # The command line is too long to link in one step, link piecewise.
3335	  $echo "creating reloadable object files..."
3336
3337	  # Save the value of $output and $libobjs because we want to
3338	  # use them later.  If we have whole_archive_flag_spec, we
3339	  # want to use save_libobjs as it was before
3340	  # whole_archive_flag_spec was expanded, because we can't
3341	  # assume the linker understands whole_archive_flag_spec.
3342	  # This may have to be revisited, in case too many
3343	  # convenience libraries get linked in and end up exceeding
3344	  # the spec.
3345	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3346	    save_libobjs=$libobjs
3347	  fi
3348	  save_output=$output
3349
3350	  # Clear the reloadable object creation command queue and
3351	  # initialize k to one.
3352	  test_cmds=
3353	  concat_cmds=
3354	  objlist=
3355	  delfiles=
3356	  last_robj=
3357	  k=1
3358	  output=$output_objdir/$save_output-${k}.$objext
3359	  # Loop over the list of objects to be linked.
3360	  for obj in $save_libobjs
3361	  do
3362	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3363	    if test "X$objlist" = X ||
3364	       { len=`expr "X$test_cmds" : ".*"` &&
3365		 test "$len" -le "$max_cmd_len"; }; then
3366	      objlist="$objlist $obj"
3367	    else
3368	      # The command $test_cmds is almost too long, add a
3369	      # command to the queue.
3370	      if test "$k" -eq 1 ; then
3371		# The first file doesn't have a previous command to add.
3372		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3373	      else
3374		# All subsequent reloadable object files will link in
3375		# the last one created.
3376		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3377	      fi
3378	      last_robj=$output_objdir/$save_output-${k}.$objext
3379	      k=`expr $k + 1`
3380	      output=$output_objdir/$save_output-${k}.$objext
3381	      objlist=$obj
3382	      len=1
3383	    fi
3384	  done
3385	  # Handle the remaining objects by creating one last
3386	  # reloadable object file.  All subsequent reloadable object
3387	  # files will link in the last one created.
3388	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3389	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3390
3391	  # Set up a command to remove the reloadale object files
3392	  # after they are used.
3393	  i=0
3394	  while test "$i" -lt "$k"
3395	  do
3396	    i=`expr $i + 1`
3397	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3398	  done
3399
3400	  $echo "creating a temporary reloadable object file: $output"
3401
3402	  # Loop through the commands generated above and execute them.
3403	  save_ifs="$IFS"; IFS='~'
3404	  for cmd in $concat_cmds; do
3405	    IFS="$save_ifs"
3406	    $show "$cmd"
3407	    $run eval "$cmd" || exit $?
3408	  done
3409	  IFS="$save_ifs"
3410
3411	  libobjs=$output
3412	  # Restore the value of output.
3413	  output=$save_output
3414
3415	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3416	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3417	  fi
3418	  # Expand the library linking commands again to reset the
3419	  # value of $libobjs for piecewise linking.
3420
3421	  # Do each of the archive commands.
3422	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3423	    eval cmds=\"$archive_expsym_cmds\"
3424	  else
3425	    eval cmds=\"$archive_cmds\"
3426	  fi
3427
3428	  # Append the command to remove the reloadable object files
3429	  # to the just-reset $cmds.
3430	  eval cmds=\"\$cmds~$rm $delfiles\"
3431	fi
3432	save_ifs="$IFS"; IFS='~'
3433	for cmd in $cmds; do
3434	  IFS="$save_ifs"
3435	  $show "$cmd"
3436	  $run eval "$cmd" || exit $?
3437	done
3438	IFS="$save_ifs"
3439
3440	# Restore the uninstalled library and exit
3441	if test "$mode" = relink; then
3442	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3443	  exit 0
3444	fi
3445
3446	# Create links to the real library.
3447	for linkname in $linknames; do
3448	  if test "$realname" != "$linkname"; then
3449	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3450	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3451	  fi
3452	done
3453
3454	# If -module or -export-dynamic was specified, set the dlname.
3455	if test "$module" = yes || test "$export_dynamic" = yes; then
3456	  # On all known operating systems, these are identical.
3457	  dlname="$soname"
3458	fi
3459      fi
3460      ;;
3461
3462    obj)
3463      if test -n "$deplibs"; then
3464	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3465      fi
3466
3467      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3468	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3469      fi
3470
3471      if test -n "$rpath"; then
3472	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3473      fi
3474
3475      if test -n "$xrpath"; then
3476	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3477      fi
3478
3479      if test -n "$vinfo"; then
3480	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3481      fi
3482
3483      if test -n "$release"; then
3484	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3485      fi
3486
3487      case $output in
3488      *.lo)
3489	if test -n "$objs$old_deplibs"; then
3490	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3491	  exit 1
3492	fi
3493	libobj="$output"
3494	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3495	;;
3496      *)
3497	libobj=
3498	obj="$output"
3499	;;
3500      esac
3501
3502      # Delete the old objects.
3503      $run $rm $obj $libobj
3504
3505      # Objects from convenience libraries.  This assumes
3506      # single-version convenience libraries.  Whenever we create
3507      # different ones for PIC/non-PIC, this we'll have to duplicate
3508      # the extraction.
3509      reload_conv_objs=
3510      gentop=
3511      # reload_cmds runs $LD directly, so let us get rid of
3512      # -Wl from whole_archive_flag_spec
3513      wl=
3514
3515      if test -n "$convenience"; then
3516	if test -n "$whole_archive_flag_spec"; then
3517	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3518	else
3519	  gentop="$output_objdir/${obj}x"
3520	  $show "${rm}r $gentop"
3521	  $run ${rm}r "$gentop"
3522	  $show "$mkdir $gentop"
3523	  $run $mkdir "$gentop"
3524	  status=$?
3525	  if test "$status" -ne 0 && test ! -d "$gentop"; then
3526	    exit $status
3527	  fi
3528	  generated="$generated $gentop"
3529
3530	  for xlib in $convenience; do
3531	    # Extract the objects.
3532	    case $xlib in
3533	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3534	    *) xabs=`pwd`"/$xlib" ;;
3535	    esac
3536	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3537	    xdir="$gentop/$xlib"
3538
3539	    $show "${rm}r $xdir"
3540	    $run ${rm}r "$xdir"
3541	    $show "$mkdir $xdir"
3542	    $run $mkdir "$xdir"
3543	    status=$?
3544	    if test "$status" -ne 0 && test ! -d "$xdir"; then
3545	      exit $status
3546	    fi
3547	    $show "(cd $xdir && $AR x $xabs)"
3548	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3549
3550	    reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3551	  done
3552	fi
3553      fi
3554
3555      # Create the old-style object.
3556      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
3557
3558      output="$obj"
3559      eval cmds=\"$reload_cmds\"
3560      save_ifs="$IFS"; IFS='~'
3561      for cmd in $cmds; do
3562	IFS="$save_ifs"
3563	$show "$cmd"
3564	$run eval "$cmd" || exit $?
3565      done
3566      IFS="$save_ifs"
3567
3568      # Exit if we aren't doing a library object file.
3569      if test -z "$libobj"; then
3570	if test -n "$gentop"; then
3571	  $show "${rm}r $gentop"
3572	  $run ${rm}r $gentop
3573	fi
3574
3575	exit 0
3576      fi
3577
3578      if test "$build_libtool_libs" != yes; then
3579	if test -n "$gentop"; then
3580	  $show "${rm}r $gentop"
3581	  $run ${rm}r $gentop
3582	fi
3583
3584	# Create an invalid libtool object if no PIC, so that we don't
3585	# accidentally link it into a program.
3586	# $show "echo timestamp > $libobj"
3587	# $run eval "echo timestamp > $libobj" || exit $?
3588	exit 0
3589      fi
3590
3591      if test -n "$pic_flag" || test "$pic_mode" != default; then
3592	# Only do commands if we really have different PIC objects.
3593	reload_objs="$libobjs $reload_conv_objs"
3594	output="$libobj"
3595	eval cmds=\"$reload_cmds\"
3596	save_ifs="$IFS"; IFS='~'
3597	for cmd in $cmds; do
3598	  IFS="$save_ifs"
3599	  $show "$cmd"
3600	  $run eval "$cmd" || exit $?
3601	done
3602	IFS="$save_ifs"
3603      fi
3604
3605      if test -n "$gentop"; then
3606	$show "${rm}r $gentop"
3607	$run ${rm}r $gentop
3608      fi
3609
3610      exit 0
3611      ;;
3612
3613    prog)
3614      case $host in
3615	*cygwin*) output=`echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
3616      esac
3617      if test -n "$vinfo"; then
3618	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
3619      fi
3620
3621      if test -n "$release"; then
3622	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
3623      fi
3624
3625      if test "$preload" = yes; then
3626	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
3627	   test "$dlopen_self_static" = unknown; then
3628	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
3629	fi
3630      fi
3631
3632      case $host in
3633      *-*-rhapsody* | *-*-darwin1.[012])
3634	# On Rhapsody replace the C library is the System framework
3635	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3636	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
3637	;;
3638      esac
3639
3640      compile_command="$compile_command $compile_deplibs"
3641      finalize_command="$finalize_command $finalize_deplibs"
3642
3643      if test -n "$rpath$xrpath"; then
3644	# If the user specified any rpath flags, then add them.
3645	for libdir in $rpath $xrpath; do
3646	  # This is the magic to use -rpath.
3647	  case "$finalize_rpath " in
3648	  *" $libdir "*) ;;
3649	  *) finalize_rpath="$finalize_rpath $libdir" ;;
3650	  esac
3651	done
3652      fi
3653
3654      # Now hardcode the library paths
3655      rpath=
3656      hardcode_libdirs=
3657      for libdir in $compile_rpath $finalize_rpath; do
3658	if test -n "$hardcode_libdir_flag_spec"; then
3659	  if test -n "$hardcode_libdir_separator"; then
3660	    if test -z "$hardcode_libdirs"; then
3661	      hardcode_libdirs="$libdir"
3662	    else
3663	      # Just accumulate the unique libdirs.
3664	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3665	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3666		;;
3667	      *)
3668		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3669		;;
3670	      esac
3671	    fi
3672	  else
3673	    eval flag=\"$hardcode_libdir_flag_spec\"
3674	    rpath="$rpath $flag"
3675	  fi
3676	elif test -n "$runpath_var"; then
3677	  case "$perm_rpath " in
3678	  *" $libdir "*) ;;
3679	  *) perm_rpath="$perm_rpath $libdir" ;;
3680	  esac
3681	fi
3682	case $host in
3683	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
3684	  case :$dllsearchpath: in
3685	  *":$libdir:"*) ;;
3686	  *) dllsearchpath="$dllsearchpath:$libdir";;
3687	  esac
3688	  ;;
3689	esac
3690      done
3691      # Substitute the hardcoded libdirs into the rpath.
3692      if test -n "$hardcode_libdir_separator" &&
3693	 test -n "$hardcode_libdirs"; then
3694	libdir="$hardcode_libdirs"
3695	eval rpath=\" $hardcode_libdir_flag_spec\"
3696      fi
3697      compile_rpath="$rpath"
3698
3699      rpath=
3700      hardcode_libdirs=
3701      for libdir in $finalize_rpath; do
3702	if test -n "$hardcode_libdir_flag_spec"; then
3703	  if test -n "$hardcode_libdir_separator"; then
3704	    if test -z "$hardcode_libdirs"; then
3705	      hardcode_libdirs="$libdir"
3706	    else
3707	      # Just accumulate the unique libdirs.
3708	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3709	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3710		;;
3711	      *)
3712		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3713		;;
3714	      esac
3715	    fi
3716	  else
3717	    eval flag=\"$hardcode_libdir_flag_spec\"
3718	    rpath="$rpath $flag"
3719	  fi
3720	elif test -n "$runpath_var"; then
3721	  case "$finalize_perm_rpath " in
3722	  *" $libdir "*) ;;
3723	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
3724	  esac
3725	fi
3726      done
3727      # Substitute the hardcoded libdirs into the rpath.
3728      if test -n "$hardcode_libdir_separator" &&
3729	 test -n "$hardcode_libdirs"; then
3730	libdir="$hardcode_libdirs"
3731	eval rpath=\" $hardcode_libdir_flag_spec\"
3732      fi
3733      finalize_rpath="$rpath"
3734
3735      if test -n "$libobjs" && test "$build_old_libs" = yes; then
3736	# Transform all the library objects into standard objects.
3737	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3738	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3739      fi
3740
3741      dlsyms=
3742      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3743	if test -n "$NM" && test -n "$global_symbol_pipe"; then
3744	  dlsyms="${outputname}S.c"
3745	else
3746	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
3747	fi
3748      fi
3749
3750      if test -n "$dlsyms"; then
3751	case $dlsyms in
3752	"") ;;
3753	*.c)
3754	  # Discover the nlist of each of the dlfiles.
3755	  nlist="$output_objdir/${outputname}.nm"
3756
3757	  $show "$rm $nlist ${nlist}S ${nlist}T"
3758	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
3759
3760	  # Parse the name list into a source file.
3761	  $show "creating $output_objdir/$dlsyms"
3762
3763	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
3764/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
3765/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
3766
3767#ifdef __cplusplus
3768extern \"C\" {
3769#endif
3770
3771/* Prevent the only kind of declaration conflicts we can make. */
3772#define lt_preloaded_symbols some_other_symbol
3773
3774/* External symbol declarations for the compiler. */\
3775"
3776
3777	  if test "$dlself" = yes; then
3778	    $show "generating symbol list for \`$output'"
3779
3780	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
3781
3782	    # Add our own program objects to the symbol list.
3783	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3784	    for arg in $progfiles; do
3785	      $show "extracting global C symbols from \`$arg'"
3786	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3787	    done
3788
3789	    if test -n "$exclude_expsyms"; then
3790	      $run eval 'egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
3791	      $run eval '$mv "$nlist"T "$nlist"'
3792	    fi
3793
3794	    if test -n "$export_symbols_regex"; then
3795	      $run eval 'egrep -e "$export_symbols_regex" "$nlist" > "$nlist"T'
3796	      $run eval '$mv "$nlist"T "$nlist"'
3797	    fi
3798
3799	    # Prepare the list of exported symbols
3800	    if test -z "$export_symbols"; then
3801	      export_symbols="$output_objdir/$output.exp"
3802	      $run $rm $export_symbols
3803	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
3804	    else
3805	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
3806	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
3807	      $run eval 'mv "$nlist"T "$nlist"'
3808	    fi
3809	  fi
3810
3811	  for arg in $dlprefiles; do
3812	    $show "extracting global C symbols from \`$arg'"
3813	    name=`echo "$arg" | ${SED} -e 's%^.*/%%'`
3814	    $run eval 'echo ": $name " >> "$nlist"'
3815	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
3816	  done
3817
3818	  if test -z "$run"; then
3819	    # Make sure we have at least an empty file.
3820	    test -f "$nlist" || : > "$nlist"
3821
3822	    if test -n "$exclude_expsyms"; then
3823	      egrep -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
3824	      $mv "$nlist"T "$nlist"
3825	    fi
3826
3827	    # Try sorting and uniquifying the output.
3828	    if grep -v "^: " < "$nlist" | sort +2 | uniq > "$nlist"S; then
3829	      :
3830	    else
3831	      grep -v "^: " < "$nlist" > "$nlist"S
3832	    fi
3833
3834	    if test -f "$nlist"S; then
3835	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
3836	    else
3837	      echo '/* NONE */' >> "$output_objdir/$dlsyms"
3838	    fi
3839
3840	    $echo >> "$output_objdir/$dlsyms" "\
3841
3842#undef lt_preloaded_symbols
3843
3844#if defined (__STDC__) && __STDC__
3845# define lt_ptr void *
3846#else
3847# define lt_ptr char *
3848# define const
3849#endif
3850
3851/* The mapping between symbol names and symbols. */
3852const struct {
3853  const char *name;
3854  lt_ptr address;
3855}
3856lt_preloaded_symbols[] =
3857{\
3858"
3859
3860	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
3861
3862	    $echo >> "$output_objdir/$dlsyms" "\
3863  {0, (lt_ptr) 0}
3864};
3865
3866/* This works around a problem in FreeBSD linker */
3867#ifdef FREEBSD_WORKAROUND
3868static const void *lt_preloaded_setup() {
3869  return lt_preloaded_symbols;
3870}
3871#endif
3872
3873#ifdef __cplusplus
3874}
3875#endif\
3876"
3877	  fi
3878
3879	  pic_flag_for_symtable=
3880	  case $host in
3881	  # compiling the symbol table file with pic_flag works around
3882	  # a FreeBSD bug that causes programs to crash when -lm is
3883	  # linked before any other PIC object.  But we must not use
3884	  # pic_flag when linking with -static.  The problem exists in
3885	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
3886	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
3887	    case "$compile_command " in
3888	    *" -static "*) ;;
3889	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
3890	    esac;;
3891	  *-*-hpux*)
3892	    case "$compile_command " in
3893	    *" -static "*) ;;
3894	    *) pic_flag_for_symtable=" $pic_flag";;
3895	    esac
3896	  esac
3897
3898	  # Now compile the dynamic symbol file.
3899	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
3900	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
3901
3902	  # Clean up the generated files.
3903	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
3904	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
3905
3906	  # Transform the symbol file into the correct name.
3907	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3908	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
3909	  ;;
3910	*)
3911	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
3912	  exit 1
3913	  ;;
3914	esac
3915      else
3916	# We keep going just in case the user didn't refer to
3917	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
3918	# really was required.
3919
3920	# Nullify the symbol file.
3921	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
3922	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
3923      fi
3924
3925      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
3926	# Replace the output file specification.
3927	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3928	link_command="$compile_command$compile_rpath"
3929
3930	# We have no uninstalled library dependencies, so finalize right now.
3931	$show "$link_command"
3932	$run eval "$link_command"
3933	status=$?
3934
3935	# Delete the generated files.
3936	if test -n "$dlsyms"; then
3937	  $show "$rm $output_objdir/${outputname}S.${objext}"
3938	  $run $rm "$output_objdir/${outputname}S.${objext}"
3939	fi
3940
3941	exit $status
3942      fi
3943
3944      if test -n "$shlibpath_var"; then
3945	# We should set the shlibpath_var
3946	rpath=
3947	for dir in $temp_rpath; do
3948	  case $dir in
3949	  [\\/]* | [A-Za-z]:[\\/]*)
3950	    # Absolute path.
3951	    rpath="$rpath$dir:"
3952	    ;;
3953	  *)
3954	    # Relative path: add a thisdir entry.
3955	    rpath="$rpath\$thisdir/$dir:"
3956	    ;;
3957	  esac
3958	done
3959	temp_rpath="$rpath"
3960      fi
3961
3962      if test -n "$compile_shlibpath$finalize_shlibpath"; then
3963	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
3964      fi
3965      if test -n "$finalize_shlibpath"; then
3966	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
3967      fi
3968
3969      compile_var=
3970      finalize_var=
3971      if test -n "$runpath_var"; then
3972	if test -n "$perm_rpath"; then
3973	  # We should set the runpath_var.
3974	  rpath=
3975	  for dir in $perm_rpath; do
3976	    rpath="$rpath$dir:"
3977	  done
3978	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
3979	fi
3980	if test -n "$finalize_perm_rpath"; then
3981	  # We should set the runpath_var.
3982	  rpath=
3983	  for dir in $finalize_perm_rpath; do
3984	    rpath="$rpath$dir:"
3985	  done
3986	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
3987	fi
3988      fi
3989
3990      if test "$no_install" = yes; then
3991	# We don't need to create a wrapper script.
3992	link_command="$compile_var$compile_command$compile_rpath"
3993	# Replace the output file specification.
3994	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
3995	# Delete the old output file.
3996	$run $rm $output
3997	# Link the executable and exit
3998	$show "$link_command"
3999	$run eval "$link_command" || exit $?
4000	exit 0
4001      fi
4002
4003      if test "$hardcode_action" = relink; then
4004	# Fast installation is not supported
4005	link_command="$compile_var$compile_command$compile_rpath"
4006	relink_command="$finalize_var$finalize_command$finalize_rpath"
4007
4008	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4009	$echo "$modename: \`$output' will be relinked during installation" 1>&2
4010      else
4011	if test "$fast_install" != no; then
4012	  link_command="$finalize_var$compile_command$finalize_rpath"
4013	  if test "$fast_install" = yes; then
4014	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4015	  else
4016	    # fast_install is set to needless
4017	    relink_command=
4018	  fi
4019	else
4020	  link_command="$compile_var$compile_command$compile_rpath"
4021	  relink_command="$finalize_var$finalize_command$finalize_rpath"
4022	fi
4023      fi
4024
4025      # Replace the output file specification.
4026      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4027
4028      # Delete the old output files.
4029      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4030
4031      $show "$link_command"
4032      $run eval "$link_command" || exit $?
4033
4034      # Now create the wrapper script.
4035      $show "creating $output"
4036
4037      # Quote the relink command for shipping.
4038      if test -n "$relink_command"; then
4039	# Preserve any variables that may affect compiler behavior
4040	for var in $variables_saved_for_relink; do
4041	  if eval test -z \"\${$var+set}\"; then
4042	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4043	  elif eval var_value=\$$var; test -z "$var_value"; then
4044	    relink_command="$var=; export $var; $relink_command"
4045	  else
4046	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4047	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
4048	  fi
4049	done
4050	relink_command="(cd `pwd`; $relink_command)"
4051	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4052      fi
4053
4054      # Quote $echo for shipping.
4055      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4056	case $0 in
4057	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4058	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4059	esac
4060	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4061      else
4062	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4063      fi
4064
4065      # Only actually do things if our run command is non-null.
4066      if test -z "$run"; then
4067	# win32 will think the script is a binary if it has
4068	# a .exe suffix, so we strip it off here.
4069	case $output in
4070	  *.exe) output=`echo $output|${SED} 's,.exe$,,'` ;;
4071	esac
4072	# test for cygwin because mv fails w/o .exe extensions
4073	case $host in
4074	  *cygwin*) exeext=.exe ;;
4075	  *) exeext= ;;
4076	esac
4077	$rm $output
4078	trap "$rm $output; exit 1" 1 2 15
4079
4080	$echo > $output "\
4081#! $SHELL
4082
4083# $output - temporary wrapper script for $objdir/$outputname
4084# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4085#
4086# The $output program cannot be directly executed until all the libtool
4087# libraries that it depends on are installed.
4088#
4089# This wrapper script should never be moved out of the build directory.
4090# If it is, it will not operate correctly.
4091
4092# Sed substitution that helps us do robust quoting.  It backslashifies
4093# metacharacters that are still active within double-quoted strings.
4094Xsed='${SED} -e 1s/^X//'
4095sed_quote_subst='$sed_quote_subst'
4096
4097# The HP-UX ksh and POSIX shell print the target directory to stdout
4098# if CDPATH is set.
4099if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4100
4101relink_command=\"$relink_command\"
4102
4103# This environment variable determines our operation mode.
4104if test \"\$libtool_install_magic\" = \"$magic\"; then
4105  # install mode needs the following variable:
4106  notinst_deplibs='$notinst_deplibs'
4107else
4108  # When we are sourced in execute mode, \$file and \$echo are already set.
4109  if test \"\$libtool_execute_magic\" != \"$magic\"; then
4110    echo=\"$qecho\"
4111    file=\"\$0\"
4112    # Make sure echo works.
4113    if test \"X\$1\" = X--no-reexec; then
4114      # Discard the --no-reexec flag, and continue.
4115      shift
4116    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4117      # Yippee, \$echo works!
4118      :
4119    else
4120      # Restart under the correct shell, and then maybe \$echo will work.
4121      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4122    fi
4123  fi\
4124"
4125	$echo >> $output "\
4126
4127  # Find the directory that this script lives in.
4128  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4129  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4130
4131  # Follow symbolic links until we get to the real thisdir.
4132  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4133  while test -n \"\$file\"; do
4134    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4135
4136    # If there was a directory component, then change thisdir.
4137    if test \"x\$destdir\" != \"x\$file\"; then
4138      case \"\$destdir\" in
4139      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4140      *) thisdir=\"\$thisdir/\$destdir\" ;;
4141      esac
4142    fi
4143
4144    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4145    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4146  done
4147
4148  # Try to get the absolute directory name.
4149  absdir=\`cd \"\$thisdir\" && pwd\`
4150  test -n \"\$absdir\" && thisdir=\"\$absdir\"
4151"
4152
4153	if test "$fast_install" = yes; then
4154	  echo >> $output "\
4155  program=lt-'$outputname'$exeext
4156  progdir=\"\$thisdir/$objdir\"
4157
4158  if test ! -f \"\$progdir/\$program\" || \\
4159     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4160       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4161
4162    file=\"\$\$-\$program\"
4163
4164    if test ! -d \"\$progdir\"; then
4165      $mkdir \"\$progdir\"
4166    else
4167      $rm \"\$progdir/\$file\"
4168    fi"
4169
4170	  echo >> $output "\
4171
4172    # relink executable if necessary
4173    if test -n \"\$relink_command\"; then
4174      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4175      else
4176	$echo \"\$relink_command_output\" >&2
4177	$rm \"\$progdir/\$file\"
4178	exit 1
4179      fi
4180    fi
4181
4182    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4183    { $rm \"\$progdir/\$program\";
4184      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4185    $rm \"\$progdir/\$file\"
4186  fi"
4187	else
4188	  echo >> $output "\
4189  program='$outputname'
4190  progdir=\"\$thisdir/$objdir\"
4191"
4192	fi
4193
4194	echo >> $output "\
4195
4196  if test -f \"\$progdir/\$program\"; then"
4197
4198	# Export our shlibpath_var if we have one.
4199	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4200	  $echo >> $output "\
4201    # Add our own library path to $shlibpath_var
4202    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4203
4204    # Some systems cannot cope with colon-terminated $shlibpath_var
4205    # The second colon is a workaround for a bug in BeOS R4 sed
4206    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4207
4208    export $shlibpath_var
4209"
4210	fi
4211
4212	# fixup the dll searchpath if we need to.
4213	if test -n "$dllsearchpath"; then
4214	  $echo >> $output "\
4215    # Add the dll search path components to the executable PATH
4216    PATH=$dllsearchpath:\$PATH
4217"
4218	fi
4219
4220	$echo >> $output "\
4221    if test \"\$libtool_execute_magic\" != \"$magic\"; then
4222      # Run the actual program with our arguments.
4223"
4224	case $host in
4225	# win32 systems need to use the prog path for dll
4226	# lookup to work
4227	*-*-cygwin* | *-*-pw32*)
4228	  $echo >> $output "\
4229      exec \$progdir/\$program \${1+\"\$@\"}
4230"
4231	  ;;
4232
4233	# Backslashes separate directories on plain windows
4234	*-*-mingw | *-*-os2*)
4235	  $echo >> $output "\
4236      exec \$progdir\\\\\$program \${1+\"\$@\"}
4237"
4238	  ;;
4239
4240	*)
4241	  $echo >> $output "\
4242      # Export the path to the program.
4243      PATH=\"\$progdir:\$PATH\"
4244      export PATH
4245
4246      exec \$program \${1+\"\$@\"}
4247"
4248	  ;;
4249	esac
4250	$echo >> $output "\
4251      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4252      exit 1
4253    fi
4254  else
4255    # The program doesn't exist.
4256    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4257    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4258    echo \"See the $PACKAGE documentation for more information.\" 1>&2
4259    exit 1
4260  fi
4261fi\
4262"
4263	chmod +x $output
4264      fi
4265      exit 0
4266      ;;
4267    esac
4268
4269    # See if we need to build an old-fashioned archive.
4270    for oldlib in $oldlibs; do
4271
4272      if test "$build_libtool_libs" = convenience; then
4273	oldobjs="$libobjs_save"
4274	addlibs="$convenience"
4275	build_libtool_libs=no
4276      else
4277	if test "$build_libtool_libs" = module; then
4278	  oldobjs="$libobjs_save"
4279	  build_libtool_libs=no
4280	else
4281	  #oldobjs="$oldobjs$old_deplibs $non_pic_objects"
4282	  oldobjs="$old_deplibs $non_pic_objects"
4283	fi
4284	addlibs="$old_convenience"
4285      fi
4286
4287      if test -n "$addlibs"; then
4288	gentop="$output_objdir/${outputname}x"
4289	$show "${rm}r $gentop"
4290	$run ${rm}r "$gentop"
4291	$show "$mkdir $gentop"
4292	$run $mkdir "$gentop"
4293	status=$?
4294	if test "$status" -ne 0 && test ! -d "$gentop"; then
4295	  exit $status
4296	fi
4297	generated="$generated $gentop"
4298
4299	# Add in members from convenience archives.
4300	for xlib in $addlibs; do
4301	  # Extract the objects.
4302	  case $xlib in
4303	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4304	  *) xabs=`pwd`"/$xlib" ;;
4305	  esac
4306	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4307	  xdir="$gentop/$xlib"
4308
4309	  $show "${rm}r $xdir"
4310	  $run ${rm}r "$xdir"
4311	  $show "$mkdir $xdir"
4312	  $run $mkdir "$xdir"
4313	  status=$?
4314	  if test "$status" -ne 0 && test ! -d "$xdir"; then
4315	    exit $status
4316	  fi
4317	  $show "(cd $xdir && $AR x $xabs)"
4318	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4319
4320	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
4321	done
4322      fi
4323
4324      compiler_flags="$compiler_flags $add_flags"
4325
4326      # Do each command in the archive commands.
4327      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
4328	eval cmds=\"$old_archive_from_new_cmds\"
4329      else
4330	eval cmds=\"$old_archive_cmds\"
4331
4332	if len=`expr "X$cmds" : ".*"` &&
4333	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
4334	  :
4335	else
4336	  # the command line is too long to link in one step, link in parts
4337	  $echo "using piecewise archive linking..."
4338	  save_RANLIB=$RANLIB
4339	  RANLIB=:
4340	  objlist=
4341	  concat_cmds=
4342	  save_oldobjs=$oldobjs
4343	  for obj in $save_oldobjs
4344	  do
4345	    oldobjs="$objlist $obj"
4346	    objlist="$objlist $obj"
4347	    eval test_cmds=\"$old_archive_cmds\"
4348	    if len=`expr "X$test_cmds" : ".*"` &&
4349	       test "$len" -le "$max_cmd_len"; then
4350	      :
4351	    else
4352	      # the above command should be used before it gets too long
4353	      oldobjs=$objlist
4354	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
4355	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
4356	      objlist=
4357	    fi
4358	  done
4359	  RANLIB=$save_RANLIB
4360	  oldobjs=$objlist
4361	  eval cmds=\"\$concat_cmds~$old_archive_cmds\"
4362	fi
4363      fi
4364      save_ifs="$IFS"; IFS='~'
4365      for cmd in $cmds; do
4366	IFS="$save_ifs"
4367	$show "$cmd"
4368	$run eval "$cmd" || exit $?
4369      done
4370      IFS="$save_ifs"
4371    done
4372
4373    if test -n "$generated"; then
4374      $show "${rm}r$generated"
4375      $run ${rm}r$generated
4376    fi
4377
4378    # Now create the libtool archive.
4379    case $output in
4380    *.la)
4381      old_library=
4382      test "$build_old_libs" = yes && old_library="$libname.$libext"
4383      $show "creating $output"
4384
4385      # Preserve any variables that may affect compiler behavior
4386      for var in $variables_saved_for_relink; do
4387	if eval test -z \"\${$var+set}\"; then
4388	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4389	elif eval var_value=\$$var; test -z "$var_value"; then
4390	  relink_command="$var=; export $var; $relink_command"
4391	else
4392	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4393	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
4394	fi
4395      done
4396      # Quote the link command for shipping.
4397      relink_command="($relink_command; cd `pwd`; $SHELL $0 --mode=relink $libtool_args)"
4398      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4399
4400      # Only create the output if not a dry run.
4401      if test -z "$run"; then
4402	for installed in no yes; do
4403	  if test "$installed" = yes; then
4404	    if test -z "$install_libdir"; then
4405	      break
4406	    fi
4407	    output="$output_objdir/$outputname"i
4408	    # Replace all uninstalled libtool libraries with the installed ones
4409	    newdependency_libs=
4410	    for deplib in $dependency_libs; do
4411	      case $deplib in
4412	      *.la)
4413		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
4414		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
4415		if test -z "$libdir"; then
4416		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
4417		  exit 1
4418		fi
4419		newdependency_libs="$newdependency_libs $libdir/$name"
4420		;;
4421	      *) newdependency_libs="$newdependency_libs $deplib" ;;
4422	      esac
4423	    done
4424	    dependency_libs="$newdependency_libs"
4425	    newdlfiles=
4426	    for lib in $dlfiles; do
4427	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4428	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4429	      if test -z "$libdir"; then
4430		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4431		exit 1
4432	      fi
4433	      newdlfiles="$newdlfiles $libdir/$name"
4434	    done
4435	    dlfiles="$newdlfiles"
4436	    newdlprefiles=
4437	    for lib in $dlprefiles; do
4438	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
4439	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
4440	      if test -z "$libdir"; then
4441		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
4442		exit 1
4443	      fi
4444	      newdlprefiles="$newdlprefiles $libdir/$name"
4445	    done
4446	    dlprefiles="$newdlprefiles"
4447	  fi
4448	  $rm $output
4449	  # place dlname in correct position for cygwin
4450	  tdlname=$dlname
4451	  case $host,$output,$installed,$module,$dlname in
4452	    *cygwin*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
4453	  esac
4454	  $echo > $output "\
4455# $outputname - a libtool library file
4456# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4457#
4458# Please DO NOT delete this file!
4459# It is necessary for linking the library.
4460
4461# The name that we can dlopen(3).
4462dlname='$tdlname'
4463
4464# Names of this library.
4465library_names='$library_names'
4466
4467# The name of the static archive.
4468old_library='$old_library'
4469
4470# Libraries that this one depends upon.
4471dependency_libs='$dependency_libs'
4472
4473# Version information for $libname.
4474current=$current
4475age=$age
4476revision=$revision
4477
4478# Is this an already installed library?
4479installed=$installed
4480
4481# Files to dlopen/dlpreopen
4482dlopen='$dlfiles'
4483dlpreopen='$dlprefiles'
4484
4485# Directory that this library needs to be installed in:
4486libdir='$install_libdir'"
4487	  if test "$installed" = no && test "$need_relink" = yes && test "$fast_install" = no; then
4488	    $echo >> $output "\
4489relink_command=\"$relink_command\""
4490	  fi
4491	done
4492      fi
4493
4494      # Do a symbolic link so that the libtool archive can be found in
4495      # LD_LIBRARY_PATH before the program is installed.
4496      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
4497      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
4498      ;;
4499    esac
4500    exit 0
4501    ;;
4502
4503  # libtool install mode
4504  install)
4505    modename="$modename: install"
4506
4507    # There may be an optional sh(1) argument at the beginning of
4508    # install_prog (especially on Windows NT).
4509    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
4510       # Allow the use of GNU shtool's install command.
4511       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
4512      # Aesthetically quote it.
4513      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
4514      case $arg in
4515      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
4516	arg="\"$arg\""
4517	;;
4518      esac
4519      install_prog="$arg "
4520      arg="$1"
4521      shift
4522    else
4523      install_prog=
4524      arg="$nonopt"
4525    fi
4526
4527    # The real first argument should be the name of the installation program.
4528    # Aesthetically quote it.
4529    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4530    case $arg in
4531    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
4532      arg="\"$arg\""
4533      ;;
4534    esac
4535    install_prog="$install_prog$arg"
4536
4537    # We need to accept at least all the BSD install flags.
4538    dest=
4539    files=
4540    opts=
4541    prev=
4542    install_type=
4543    isdir=no
4544    stripme=
4545    for arg
4546    do
4547      if test -n "$dest"; then
4548	files="$files $dest"
4549	dest="$arg"
4550	continue
4551      fi
4552
4553      case $arg in
4554      -d) isdir=yes ;;
4555      -f) prev="-f" ;;
4556      -g) prev="-g" ;;
4557      -m) prev="-m" ;;
4558      -o) prev="-o" ;;
4559      -s)
4560	stripme=" -s"
4561	continue
4562	;;
4563      -*) ;;
4564
4565      *)
4566	# If the previous option needed an argument, then skip it.
4567	if test -n "$prev"; then
4568	  prev=
4569	else
4570	  dest="$arg"
4571	  continue
4572	fi
4573	;;
4574      esac
4575
4576      # Aesthetically quote the argument.
4577      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
4578      case $arg in
4579      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
4580	arg="\"$arg\""
4581	;;
4582      esac
4583      install_prog="$install_prog $arg"
4584    done
4585
4586    if test -z "$install_prog"; then
4587      $echo "$modename: you must specify an install program" 1>&2
4588      $echo "$help" 1>&2
4589      exit 1
4590    fi
4591
4592    if test -n "$prev"; then
4593      $echo "$modename: the \`$prev' option requires an argument" 1>&2
4594      $echo "$help" 1>&2
4595      exit 1
4596    fi
4597
4598    if test -z "$files"; then
4599      if test -z "$dest"; then
4600	$echo "$modename: no file or destination specified" 1>&2
4601      else
4602	$echo "$modename: you must specify a destination" 1>&2
4603      fi
4604      $echo "$help" 1>&2
4605      exit 1
4606    fi
4607
4608    # Strip any trailing slash from the destination.
4609    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
4610
4611    # Check to see that the destination is a directory.
4612    test -d "$dest" && isdir=yes
4613    if test "$isdir" = yes; then
4614      destdir="$dest"
4615      destname=
4616    else
4617      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
4618      test "X$destdir" = "X$dest" && destdir=.
4619      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
4620
4621      # Not a directory, so check to see that there is only one file specified.
4622      set dummy $files
4623      if test "$#" -gt 2; then
4624	$echo "$modename: \`$dest' is not a directory" 1>&2
4625	$echo "$help" 1>&2
4626	exit 1
4627      fi
4628    fi
4629    case $destdir in
4630    [\\/]* | [A-Za-z]:[\\/]*) ;;
4631    *)
4632      for file in $files; do
4633	case $file in
4634	*.lo) ;;
4635	*)
4636	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
4637	  $echo "$help" 1>&2
4638	  exit 1
4639	  ;;
4640	esac
4641      done
4642      ;;
4643    esac
4644
4645    # This variable tells wrapper scripts just to set variables rather
4646    # than running their programs.
4647    libtool_install_magic="$magic"
4648
4649    staticlibs=
4650    future_libdirs=
4651    current_libdirs=
4652    for file in $files; do
4653
4654      # Do each installation.
4655      case $file in
4656      *.$libext)
4657	# Do the static libraries later.
4658	staticlibs="$staticlibs $file"
4659	;;
4660
4661      *.la)
4662	# Check to see that this really is a libtool archive.
4663	if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
4664	else
4665	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
4666	  $echo "$help" 1>&2
4667	  exit 1
4668	fi
4669
4670	library_names=
4671	old_library=
4672	relink_command=
4673	# If there is no directory component, then add one.
4674	case $file in
4675	*/* | *\\*) . $file ;;
4676	*) . ./$file ;;
4677	esac
4678
4679	# Add the libdir to current_libdirs if it is the destination.
4680	if test "X$destdir" = "X$libdir"; then
4681	  case "$current_libdirs " in
4682	  *" $libdir "*) ;;
4683	  *) current_libdirs="$current_libdirs $libdir" ;;
4684	  esac
4685	else
4686	  # Note the libdir as a future libdir.
4687	  case "$future_libdirs " in
4688	  *" $libdir "*) ;;
4689	  *) future_libdirs="$future_libdirs $libdir" ;;
4690	  esac
4691	fi
4692
4693	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
4694	test "X$dir" = "X$file/" && dir=
4695	dir="$dir$objdir"
4696
4697	if test -n "$relink_command"; then
4698	  $echo "$modename: warning: relinking \`$file'" 1>&2
4699	  $show "$relink_command"
4700	  if $run eval "$relink_command"; then :
4701	  else
4702	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4703	    continue
4704	  fi
4705	fi
4706
4707	# See the names of the shared library.
4708	set dummy $library_names
4709	if test -n "$2"; then
4710	  realname="$2"
4711	  shift
4712	  shift
4713
4714	  srcname="$realname"
4715	  test -n "$relink_command" && srcname="$realname"T
4716
4717	  # Install the shared library and build the symlinks.
4718	  $show "$install_prog $dir/$srcname $destdir/$realname"
4719	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
4720	  if test -n "$stripme" && test -n "$striplib"; then
4721	    $show "$striplib $destdir/$realname"
4722	    $run eval "$striplib $destdir/$realname" || exit $?
4723	  fi
4724
4725	  if test "$#" -gt 0; then
4726	    # Delete the old symlinks, and create new ones.
4727	    for linkname
4728	    do
4729	      if test "$linkname" != "$realname"; then
4730		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4731		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
4732	      fi
4733	    done
4734	  fi
4735
4736	  # Do each command in the postinstall commands.
4737	  lib="$destdir/$realname"
4738	  eval cmds=\"$postinstall_cmds\"
4739	  save_ifs="$IFS"; IFS='~'
4740	  for cmd in $cmds; do
4741	    IFS="$save_ifs"
4742	    $show "$cmd"
4743	    $run eval "$cmd" || exit $?
4744	  done
4745	  IFS="$save_ifs"
4746	fi
4747
4748	# Install the pseudo-library for information purposes.
4749	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4750	instname="$dir/$name"i
4751	$show "$install_prog $instname $destdir/$name"
4752	$run eval "$install_prog $instname $destdir/$name" || exit $?
4753
4754	# Maybe install the static library, too.
4755	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
4756	;;
4757
4758      *.lo)
4759	# Install (i.e. copy) a libtool object.
4760
4761	# Figure out destination file name, if it wasn't already specified.
4762	if test -n "$destname"; then
4763	  destfile="$destdir/$destname"
4764	else
4765	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4766	  destfile="$destdir/$destfile"
4767	fi
4768
4769	# Deduce the name of the destination old-style object file.
4770	case $destfile in
4771	*.lo)
4772	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
4773	  ;;
4774	*.$objext)
4775	  staticdest="$destfile"
4776	  destfile=
4777	  ;;
4778	*)
4779	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
4780	  $echo "$help" 1>&2
4781	  exit 1
4782	  ;;
4783	esac
4784
4785	# Install the libtool object if requested.
4786	if test -n "$destfile"; then
4787	  $show "$install_prog $file $destfile"
4788	  $run eval "$install_prog $file $destfile" || exit $?
4789	fi
4790
4791	# Install the old object if enabled.
4792	if test "$build_old_libs" = yes; then
4793	  # Deduce the name of the old-style object file.
4794	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
4795
4796	  $show "$install_prog $staticobj $staticdest"
4797	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
4798	fi
4799	exit 0
4800	;;
4801
4802      *)
4803	# Figure out destination file name, if it wasn't already specified.
4804	if test -n "$destname"; then
4805	  destfile="$destdir/$destname"
4806	else
4807	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4808	  destfile="$destdir/$destfile"
4809	fi
4810
4811	# Do a test to see if this is really a libtool program.
4812	case $host in
4813	*cygwin*|*mingw*)
4814	    wrapper=`echo $file | ${SED} -e 's,.exe$,,'`
4815	    ;;
4816	*)
4817	    wrapper=$file
4818	    ;;
4819	esac
4820	if (${SED} -e '4q' $wrapper | egrep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
4821	  notinst_deplibs=
4822	  relink_command=
4823
4824	  # If there is no directory component, then add one.
4825	  case $file in
4826	  */* | *\\*) . $wrapper ;;
4827	  *) . ./$wrapper ;;
4828	  esac
4829
4830	  # Check the variables that should have been set.
4831	  if test -z "$notinst_deplibs"; then
4832	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
4833	    exit 1
4834	  fi
4835
4836	  finalize=yes
4837	  for lib in $notinst_deplibs; do
4838	    # Check to see that each library is installed.
4839	    libdir=
4840	    if test -f "$lib"; then
4841	      # If there is no directory component, then add one.
4842	      case $lib in
4843	      */* | *\\*) . $lib ;;
4844	      *) . ./$lib ;;
4845	      esac
4846	    fi
4847	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
4848	    if test -n "$libdir" && test ! -f "$libfile"; then
4849	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
4850	      finalize=no
4851	    fi
4852	  done
4853
4854	  relink_command=
4855	  # If there is no directory component, then add one.
4856	  case $file in
4857	  */* | *\\*) . $file ;;
4858	  *) . ./$file ;;
4859	  esac
4860
4861	  outputname=
4862	  if test "$fast_install" = no && test -n "$relink_command"; then
4863	    if test "$finalize" = yes && test -z "$run"; then
4864	      tmpdir="/tmp"
4865	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
4866	      tmpdir="$tmpdir/libtool-$$"
4867	      if $mkdir -p "$tmpdir" && chmod 700 "$tmpdir"; then :
4868	      else
4869		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
4870		continue
4871	      fi
4872	      file=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4873	      outputname="$tmpdir/$file"
4874	      # Replace the output file specification.
4875	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
4876
4877	      $show "$relink_command"
4878	      if $run eval "$relink_command"; then :
4879	      else
4880		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
4881		${rm}r "$tmpdir"
4882		continue
4883	      fi
4884	      file="$outputname"
4885	    else
4886	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
4887	    fi
4888	  else
4889	    # Install the binary that we compiled earlier.
4890	    file=`$echo "X$file" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
4891	  fi
4892	fi
4893
4894	# remove .exe since cygwin /usr/bin/install will append another
4895	# one anyways
4896	case $install_prog,$host in
4897	*/usr/bin/install*,*cygwin*)
4898	  case $file:$destfile in
4899	  *.exe:*.exe)
4900	    # this is ok
4901	    ;;
4902	  *.exe:*)
4903	    destfile=$destfile.exe
4904	    ;;
4905	  *:*.exe)
4906	    destfile=`echo $destfile | ${SED} -e 's,.exe$,,'`
4907	    ;;
4908	  esac
4909	  ;;
4910	esac
4911	$show "$install_prog$stripme $file $destfile"
4912	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
4913	test -n "$outputname" && ${rm}r "$tmpdir"
4914	;;
4915      esac
4916    done
4917
4918    for file in $staticlibs; do
4919      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
4920
4921      # Set up the ranlib parameters.
4922      oldlib="$destdir/$name"
4923
4924      $show "$install_prog $file $oldlib"
4925      $run eval "$install_prog \$file \$oldlib" || exit $?
4926
4927      if test -n "$stripme" && test -n "$striplib"; then
4928	$show "$old_striplib $oldlib"
4929	$run eval "$old_striplib $oldlib" || exit $?
4930      fi
4931
4932      # Do each command in the postinstall commands.
4933      eval cmds=\"$old_postinstall_cmds\"
4934      save_ifs="$IFS"; IFS='~'
4935      for cmd in $cmds; do
4936	IFS="$save_ifs"
4937	$show "$cmd"
4938	$run eval "$cmd" || exit $?
4939      done
4940      IFS="$save_ifs"
4941    done
4942
4943    if test -n "$future_libdirs"; then
4944      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
4945    fi
4946
4947    if test -n "$current_libdirs"; then
4948      # Maybe just do a dry run.
4949      test -n "$run" && current_libdirs=" -n$current_libdirs"
4950      exec_cmd='$SHELL $0 --finish$current_libdirs'
4951    else
4952      exit 0
4953    fi
4954    ;;
4955
4956  # libtool finish mode
4957  finish)
4958    modename="$modename: finish"
4959    libdirs="$nonopt"
4960    admincmds=
4961
4962    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
4963      for dir
4964      do
4965	libdirs="$libdirs $dir"
4966      done
4967
4968      for libdir in $libdirs; do
4969	if test -n "$finish_cmds"; then
4970	  # Do each command in the finish commands.
4971	  eval cmds=\"$finish_cmds\"
4972	  save_ifs="$IFS"; IFS='~'
4973	  for cmd in $cmds; do
4974	    IFS="$save_ifs"
4975	    $show "$cmd"
4976	    $run eval "$cmd" || admincmds="$admincmds
4977       $cmd"
4978	  done
4979	  IFS="$save_ifs"
4980	fi
4981	if test -n "$finish_eval"; then
4982	  # Do the single finish_eval.
4983	  eval cmds=\"$finish_eval\"
4984	  $run eval "$cmds" || admincmds="$admincmds
4985       $cmds"
4986	fi
4987      done
4988    fi
4989
4990    # Exit here if they wanted silent mode.
4991    exit 0
4992
4993    echo "----------------------------------------------------------------------"
4994    echo "Libraries have been installed in:"
4995    for libdir in $libdirs; do
4996      echo "   $libdir"
4997    done
4998    echo
4999    echo "If you ever happen to want to link against installed libraries"
5000    echo "in a given directory, LIBDIR, you must either use libtool, and"
5001    echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5002    echo "flag during linking and do at least one of the following:"
5003    if test -n "$shlibpath_var"; then
5004      echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
5005      echo "     during execution"
5006    fi
5007    if test -n "$runpath_var"; then
5008      echo "   - add LIBDIR to the \`$runpath_var' environment variable"
5009      echo "     during linking"
5010    fi
5011    if test -n "$hardcode_libdir_flag_spec"; then
5012      libdir=LIBDIR
5013      eval flag=\"$hardcode_libdir_flag_spec\"
5014
5015      echo "   - use the \`$flag' linker flag"
5016    fi
5017    if test -n "$admincmds"; then
5018      echo "   - have your system administrator run these commands:$admincmds"
5019    fi
5020    if test -f /etc/ld.so.conf; then
5021      echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5022    fi
5023    echo
5024    echo "See any operating system documentation about shared libraries for"
5025    echo "more information, such as the ld(1) and ld.so(8) manual pages."
5026    echo "----------------------------------------------------------------------"
5027    exit 0
5028    ;;
5029
5030  # libtool execute mode
5031  execute)
5032    modename="$modename: execute"
5033
5034    # The first argument is the command name.
5035    cmd="$nonopt"
5036    if test -z "$cmd"; then
5037      $echo "$modename: you must specify a COMMAND" 1>&2
5038      $echo "$help"
5039      exit 1
5040    fi
5041
5042    # Handle -dlopen flags immediately.
5043    for file in $execute_dlfiles; do
5044      if test ! -f "$file"; then
5045	$echo "$modename: \`$file' is not a file" 1>&2
5046	$echo "$help" 1>&2
5047	exit 1
5048      fi
5049
5050      dir=
5051      case $file in
5052      *.la)
5053	# Check to see that this really is a libtool archive.
5054	if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5055	else
5056	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5057	  $echo "$help" 1>&2
5058	  exit 1
5059	fi
5060
5061	# Read the libtool library.
5062	dlname=
5063	library_names=
5064
5065	# If there is no directory component, then add one.
5066	case $file in
5067	*/* | *\\*) . $file ;;
5068	*) . ./$file ;;
5069	esac
5070
5071	# Skip this library if it cannot be dlopened.
5072	if test -z "$dlname"; then
5073	  # Warn if it was a shared library.
5074	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5075	  continue
5076	fi
5077
5078	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5079	test "X$dir" = "X$file" && dir=.
5080
5081	if test -f "$dir/$objdir/$dlname"; then
5082	  dir="$dir/$objdir"
5083	else
5084	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5085	  exit 1
5086	fi
5087	;;
5088
5089      *.lo)
5090	# Just add the directory containing the .lo file.
5091	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5092	test "X$dir" = "X$file" && dir=.
5093	;;
5094
5095      *)
5096	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5097	continue
5098	;;
5099      esac
5100
5101      # Get the absolute pathname.
5102      absdir=`cd "$dir" && pwd`
5103      test -n "$absdir" && dir="$absdir"
5104
5105      # Now add the directory to shlibpath_var.
5106      if eval "test -z \"\$$shlibpath_var\""; then
5107	eval "$shlibpath_var=\"\$dir\""
5108      else
5109	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5110      fi
5111    done
5112
5113    # This variable tells wrapper scripts just to set shlibpath_var
5114    # rather than running their programs.
5115    libtool_execute_magic="$magic"
5116
5117    # Check if any of the arguments is a wrapper script.
5118    args=
5119    for file
5120    do
5121      case $file in
5122      -*) ;;
5123      *)
5124	# Do a test to see if this is really a libtool program.
5125	if (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5126	  # If there is no directory component, then add one.
5127	  case $file in
5128	  */* | *\\*) . $file ;;
5129	  *) . ./$file ;;
5130	  esac
5131
5132	  # Transform arg to wrapped name.
5133	  file="$progdir/$program"
5134	fi
5135	;;
5136      esac
5137      # Quote arguments (to preserve shell metacharacters).
5138      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5139      args="$args \"$file\""
5140    done
5141
5142    if test -z "$run"; then
5143      if test -n "$shlibpath_var"; then
5144	# Export the shlibpath_var.
5145	eval "export $shlibpath_var"
5146      fi
5147
5148      # Restore saved enviroment variables
5149      if test "${save_LC_ALL+set}" = set; then
5150	LC_ALL="$save_LC_ALL"; export LC_ALL
5151      fi
5152      if test "${save_LANG+set}" = set; then
5153	LANG="$save_LANG"; export LANG
5154      fi
5155
5156      # Now prepare to actually exec the command.
5157      exec_cmd="\$cmd$args"
5158    else
5159      # Display what would be done.
5160      if test -n "$shlibpath_var"; then
5161	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5162	$echo "export $shlibpath_var"
5163      fi
5164      $echo "$cmd$args"
5165      exit 0
5166    fi
5167    ;;
5168
5169  # libtool clean and uninstall mode
5170  clean | uninstall)
5171    modename="$modename: $mode"
5172    rm="$nonopt"
5173    files=
5174    rmforce=
5175    exit_status=0
5176
5177    # This variable tells wrapper scripts just to set variables rather
5178    # than running their programs.
5179    libtool_install_magic="$magic"
5180
5181    for arg
5182    do
5183      case $arg in
5184      -f) rm="$rm $arg"; rmforce=yes ;;
5185      -*) rm="$rm $arg" ;;
5186      *) files="$files $arg" ;;
5187      esac
5188    done
5189
5190    if test -z "$rm"; then
5191      $echo "$modename: you must specify an RM program" 1>&2
5192      $echo "$help" 1>&2
5193      exit 1
5194    fi
5195
5196    rmdirs=
5197
5198    for file in $files; do
5199      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5200      if test "X$dir" = "X$file"; then
5201	dir=.
5202	objdir="$objdir"
5203      else
5204	objdir="$dir/$objdir"
5205      fi
5206      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5207      test "$mode" = uninstall && objdir="$dir"
5208
5209      # Remember objdir for removal later, being careful to avoid duplicates
5210      if test "$mode" = clean; then
5211	case " $rmdirs " in
5212	  *" $objdir "*) ;;
5213	  *) rmdirs="$rmdirs $objdir" ;;
5214	esac
5215      fi
5216
5217      # Don't error if the file doesn't exist and rm -f was used.
5218      if (test -L "$file") >/dev/null 2>&1 \
5219	|| (test -h "$file") >/dev/null 2>&1 \
5220	|| test -f "$file"; then
5221	:
5222      elif test -d "$file"; then
5223	exit_status=1
5224	continue
5225      elif test "$rmforce" = yes; then
5226	continue
5227      fi
5228
5229      rmfiles="$file"
5230
5231      case $name in
5232      *.la)
5233	# Possibly a libtool archive, so verify it.
5234	if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5235	  . $dir/$name
5236
5237	  # Delete the libtool libraries and symlinks.
5238	  for n in $library_names; do
5239	    rmfiles="$rmfiles $objdir/$n"
5240	  done
5241	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
5242	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
5243
5244	  if test "$mode" = uninstall; then
5245	    if test -n "$library_names"; then
5246	      # Do each command in the postuninstall commands.
5247	      eval cmds=\"$postuninstall_cmds\"
5248	      save_ifs="$IFS"; IFS='~'
5249	      for cmd in $cmds; do
5250		IFS="$save_ifs"
5251		$show "$cmd"
5252		$run eval "$cmd"
5253		if test "$?" -ne 0 && test "$rmforce" != yes; then
5254		  exit_status=1
5255		fi
5256	      done
5257	      IFS="$save_ifs"
5258	    fi
5259
5260	    if test -n "$old_library"; then
5261	      # Do each command in the old_postuninstall commands.
5262	      eval cmds=\"$old_postuninstall_cmds\"
5263	      save_ifs="$IFS"; IFS='~'
5264	      for cmd in $cmds; do
5265		IFS="$save_ifs"
5266		$show "$cmd"
5267		$run eval "$cmd"
5268		if test "$?" -ne 0 && test "$rmforce" != yes; then
5269		  exit_status=1
5270		fi
5271	      done
5272	      IFS="$save_ifs"
5273	    fi
5274	    # FIXME: should reinstall the best remaining shared library.
5275	  fi
5276	fi
5277	;;
5278
5279      *.lo)
5280	# Possibly a libtool object, so verify it.
5281	if (${SED} -e '2q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5282
5283	  # Read the .lo file
5284	  . $dir/$name
5285
5286	  # Add PIC object to the list of files to remove.
5287	  if test -n "$pic_object" \
5288	     && test "$pic_object" != none; then
5289	    rmfiles="$rmfiles $dir/$pic_object"
5290	  fi
5291
5292	  # Add non-PIC object to the list of files to remove.
5293	  if test -n "$non_pic_object" \
5294	     && test "$non_pic_object" != none; then
5295	    rmfiles="$rmfiles $dir/$non_pic_object"
5296	  fi
5297	fi
5298	;;
5299
5300      *)
5301	# Do a test to see if this is a libtool program.
5302	if test "$mode" = clean &&
5303	   (${SED} -e '4q' $file | egrep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5304	  relink_command=
5305	  . $dir/$file
5306
5307	  rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
5308	  if test "$fast_install" = yes && test -n "$relink_command"; then
5309	    rmfiles="$rmfiles $objdir/lt-$name"
5310	  fi
5311	fi
5312	;;
5313      esac
5314      $show "$rm $rmfiles"
5315      $run $rm $rmfiles || exit_status=1
5316    done
5317
5318    # Try to remove the ${objdir}s in the directories where we deleted files
5319    for dir in $rmdirs; do
5320      if test -d "$dir"; then
5321	$show "rmdir $dir"
5322	$run rmdir $dir >/dev/null 2>&1
5323      fi
5324    done
5325
5326    exit $exit_status
5327    ;;
5328
5329  "")
5330    $echo "$modename: you must specify a MODE" 1>&2
5331    $echo "$generic_help" 1>&2
5332    exit 1
5333    ;;
5334  esac
5335
5336  if test -z "$exec_cmd"; then
5337    $echo "$modename: invalid operation mode \`$mode'" 1>&2
5338    $echo "$generic_help" 1>&2
5339    exit 1
5340  fi
5341fi # test -z "$show_help"
5342
5343if test -n "$exec_cmd"; then
5344  eval exec $exec_cmd
5345  exit 1
5346fi
5347
5348# We need to display help for each of the modes.
5349case $mode in
5350"") $echo \
5351"Usage: $modename [OPTION]... [MODE-ARG]...
5352
5353Provide generalized library-building support services.
5354
5355    --config          show all configuration variables
5356    --debug           enable verbose shell tracing
5357-n, --dry-run         display commands without modifying any files
5358    --features        display basic configuration information and exit
5359    --finish          same as \`--mode=finish'
5360    --help            display this help message and exit
5361    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
5362    --quiet           same as \`--silent'
5363    --silent          don't print informational messages
5364    --tag=TAG         use configuration variables from tag TAG
5365    --version         print version information
5366
5367MODE must be one of the following:
5368
5369      clean           remove files from the build directory
5370      compile         compile a source file into a libtool object
5371      execute         automatically set library path, then run a program
5372      finish          complete the installation of libtool libraries
5373      install         install libraries or executables
5374      link            create a library or an executable
5375      uninstall       remove libraries from an installed directory
5376
5377MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
5378a more detailed description of MODE."
5379  exit 0
5380  ;;
5381
5382clean)
5383  $echo \
5384"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
5385
5386Remove files from the build directory.
5387
5388RM is the name of the program to use to delete files associated with each FILE
5389(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
5390to RM.
5391
5392If FILE is a libtool library, object or program, all the files associated
5393with it are deleted. Otherwise, only FILE itself is deleted using RM."
5394  ;;
5395
5396compile)
5397  $echo \
5398"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
5399
5400Compile a source file into a libtool library object.
5401
5402This mode accepts the following additional options:
5403
5404  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
5405  -prefer-pic       try to building PIC objects only
5406  -prefer-non-pic   try to building non-PIC objects only
5407  -static           always build a \`.o' file suitable for static linking
5408
5409COMPILE-COMMAND is a command to be used in creating a \`standard' object file
5410from the given SOURCEFILE.
5411
5412The output file name is determined by removing the directory component from
5413SOURCEFILE, then substituting the C source code suffix \`.c' with the
5414library object suffix, \`.lo'."
5415  ;;
5416
5417execute)
5418  $echo \
5419"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
5420
5421Automatically set library path, then run a program.
5422
5423This mode accepts the following additional options:
5424
5425  -dlopen FILE      add the directory containing FILE to the library path
5426
5427This mode sets the library path environment variable according to \`-dlopen'
5428flags.
5429
5430If any of the ARGS are libtool executable wrappers, then they are translated
5431into their corresponding uninstalled binary, and any of their required library
5432directories are added to the library path.
5433
5434Then, COMMAND is executed, with ARGS as arguments."
5435  ;;
5436
5437finish)
5438  $echo \
5439"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
5440
5441Complete the installation of libtool libraries.
5442
5443Each LIBDIR is a directory that contains libtool libraries.
5444
5445The commands that this mode executes may require superuser privileges.  Use
5446the \`--dry-run' option if you just want to see what would be executed."
5447  ;;
5448
5449install)
5450  $echo \
5451"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
5452
5453Install executables or libraries.
5454
5455INSTALL-COMMAND is the installation command.  The first component should be
5456either the \`install' or \`cp' program.
5457
5458The rest of the components are interpreted as arguments to that command (only
5459BSD-compatible install options are recognized)."
5460  ;;
5461
5462link)
5463  $echo \
5464"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
5465
5466Link object files or libraries together to form another library, or to
5467create an executable program.
5468
5469LINK-COMMAND is a command using the C compiler that you would use to create
5470a program from several object files.
5471
5472The following components of LINK-COMMAND are treated specially:
5473
5474  -all-static       do not do any dynamic linking at all
5475  -avoid-version    do not add a version suffix if possible
5476  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
5477  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
5478  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
5479  -export-symbols SYMFILE
5480		    try to export only the symbols listed in SYMFILE
5481  -export-symbols-regex REGEX
5482		    try to export only the symbols matching REGEX
5483  -LLIBDIR          search LIBDIR for required installed libraries
5484  -lNAME            OUTPUT-FILE requires the installed library libNAME
5485  -module           build a library that can dlopened
5486  -no-fast-install  disable the fast-install mode
5487  -no-install       link a not-installable executable
5488  -no-undefined     declare that a library does not refer to external symbols
5489  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
5490  -objectlist FILE  Use a list of object files found in FILE to specify objects
5491  -release RELEASE  specify package release information
5492  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
5493  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
5494  -static           do not do any dynamic linking of libtool libraries
5495  -version-info CURRENT[:REVISION[:AGE]]
5496		    specify library version info [each variable defaults to 0]
5497
5498All other options (arguments beginning with \`-') are ignored.
5499
5500Every other argument is treated as a filename.  Files ending in \`.la' are
5501treated as uninstalled libtool libraries, other files are standard or library
5502object files.
5503
5504If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
5505only library objects (\`.lo' files) may be specified, and \`-rpath' is
5506required, except when creating a convenience library.
5507
5508If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
5509using \`ar' and \`ranlib', or on Windows using \`lib'.
5510
5511If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
5512is created, otherwise an executable program is created."
5513  ;;
5514
5515uninstall)
5516  $echo \
5517"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
5518
5519Remove libraries from an installation directory.
5520
5521RM is the name of the program to use to delete files associated with each FILE
5522(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
5523to RM.
5524
5525If FILE is a libtool library, all the files associated with it are deleted.
5526Otherwise, only FILE itself is deleted using RM."
5527  ;;
5528
5529*)
5530  $echo "$modename: invalid operation mode \`$mode'" 1>&2
5531  $echo "$help" 1>&2
5532  exit 1
5533  ;;
5534esac
5535
5536echo
5537$echo "Try \`$modename --help' for more information about other modes."
5538
5539exit 0
5540
5541# The TAGs below are defined such that we never get into a situation
5542# in which we disable both kinds of libraries.  Given conflicting
5543# choices, we go for a static library, that is the most portable,
5544# since we can't tell whether shared libraries were disabled because
5545# the user asked for that or because the platform doesn't support
5546# them.  This is particularly important on AIX, because we don't
5547# support having both static and shared libraries enabled at the same
5548# time on that platform, so we default to a shared-only configuration.
5549# If a disable-shared tag is given, we'll fallback to a static-only
5550# configuration.  But we'll never go from static-only to shared-only.
5551
5552# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
5553build_libtool_libs=no
5554build_old_libs=yes
5555# ### END LIBTOOL TAG CONFIG: disable-shared
5556
5557# ### BEGIN LIBTOOL TAG CONFIG: disable-static
5558build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5559# ### END LIBTOOL TAG CONFIG: disable-static
5560
5561# Local Variables:
5562# mode:shell-script
5563# sh-indentation:2
5564# End:
5565