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