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