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