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