1# ltmain.sh - Provide generalized library-building support services.
2# NOTE: Changing this file will not affect anything until you rerun configure.
3#
4# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003
5# Free Software Foundation, Inc.
6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21#
22# As a special exception to the GNU General Public License, if you
23# distribute this file as part of a program that contains a
24# configuration script generated by Autoconf, you may include it under
25# the same distribution terms that you use for the rest of that program.
26
27# Check that we have a working $echo.
28if test "X$1" = X--no-reexec; then
29  # Discard the --no-reexec flag, and continue.
30  shift
31elif test "X$1" = X--fallback-echo; then
32  # Avoid inline document here, it may be left over
33  :
34elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
35  # Yippee, $echo works!
36  :
37else
38  # Restart under the correct shell, and then maybe $echo will work.
39  exec $SHELL "$0" --no-reexec ${1+"$@"}
40fi
41
42if test "X$1" = X--fallback-echo; then
43  # used as fallback echo
44  shift
45  cat <<EOF
46$*
47EOF
48  exit 0
49fi
50
51# The name of this program.
52progname=`$echo "$0" | ${SED} 's%^.*/%%'`
53modename="$progname"
54
55# Constants.
56PROGRAM=ltmain.sh
57PACKAGE=libtool
58VERSION=1.5.0a
59TIMESTAMP=" (1.1220.2.35 2003/11/12 18:51:58) Debian$Rev: 179 $"
60
61default_mode=
62help="Try \`$progname --help' for more information."
63magic="%%%MAGIC variable%%%"
64mkdir="mkdir"
65mv="mv -f"
66rm="rm -f"
67
68# Sed substitution that helps us do robust quoting.  It backslashifies
69# metacharacters that are still active within double-quoted strings.
70Xsed="${SED}"' -e 1s/^X//'
71sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
72# test EBCDIC or ASCII
73case `echo A|tr A '\301'` in
74 A) # EBCDIC based system
75  SP2NL="tr '\100' '\n'"
76  NL2SP="tr '\r\n' '\100\100'"
77  ;;
78 *) # Assume ASCII based system
79  SP2NL="tr '\040' '\012'"
80  NL2SP="tr '\015\012' '\040\040'"
81  ;;
82esac
83
84# NLS nuisances.
85# Only set LANG and LC_ALL to C if already set.
86# These must not be set unconditionally because not all systems understand
87# e.g. LANG=C (notably SCO).
88# We save the old values to restore during execute mode.
89if test "${LC_ALL+set}" = set; then
90  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
91fi
92if test "${LANG+set}" = set; then
93  save_LANG="$LANG"; LANG=C; export LANG
94fi
95
96# Make sure IFS has a sensible default
97: ${IFS="
98"}
99
100if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
101  $echo "$modename: not configured to build any kind of library" 1>&2
102  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
103  exit 1
104fi
105
106# Global variables.
107mode=$default_mode
108nonopt=
109prev=
110prevopt=
111run=
112show="$echo"
113show_help=
114execute_dlfiles=
115lo2o="s/\\.lo\$/.${objext}/"
116o2lo="s/\\.${objext}\$/.lo/"
117
118#####################################
119# Shell function definitions:
120# This seems to be the best place for them
121
122# Need a lot of goo to handle *both* DLLs and import libs
123# Has to be a shell function in order to 'eat' the argument
124# that is supplied when $file_magic_command is called.
125win32_libid () {
126  win32_libid_type="unknown"
127  win32_fileres=`file -L $1 2>/dev/null`
128  case $win32_fileres in
129  *ar\ archive\ import\ library*) # definitely import
130    win32_libid_type="x86 archive import"
131    ;;
132  *ar\ archive*) # could be an import, or static
133    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
134      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
135      win32_nmres=`eval $NM -f posix -A $1 | \
136	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
137      if test "X$win32_nmres" = "Ximport" ; then
138        win32_libid_type="x86 archive import"
139      else
140        win32_libid_type="x86 archive static"
141      fi
142    fi
143    ;;
144  *DLL*)
145    win32_libid_type="x86 DLL"
146    ;;
147  *executable*) # but shell scripts are "executable" too...
148    case $win32_fileres in
149    *MS\ Windows\ PE\ Intel*)
150      win32_libid_type="x86 DLL"
151      ;;
152    esac
153    ;;
154  esac
155  $echo $win32_libid_type
156}
157
158# End of Shell function definitions
159#####################################
160
161# Parse our command line options once, thoroughly.
162while test "$#" -gt 0
163do
164  arg="$1"
165  shift
166
167  case $arg in
168  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
169  *) optarg= ;;
170  esac
171
172  # If the previous option needs an argument, assign it.
173  if test -n "$prev"; then
174    case $prev in
175    execute_dlfiles)
176      execute_dlfiles="$execute_dlfiles $arg"
177      ;;
178    tag)
179      tagname="$arg"
180      preserve_args="${preserve_args}=$arg"
181
182      # Check whether tagname contains only valid characters
183      case $tagname in
184      *[!-_A-Za-z0-9,/]*)
185	$echo "$progname: invalid tag name: $tagname" 1>&2
186	exit 1
187	;;
188      esac
189
190      case $tagname in
191      CC)
192	# Don't test for the "default" C tag, as we know, it's there, but
193	# not specially marked.
194	;;
195      *)
196	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
197	  taglist="$taglist $tagname"
198	  # Evaluate the configuration.
199	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
200	else
201	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
202	fi
203	;;
204      esac
205      ;;
206    *)
207      eval "$prev=\$arg"
208      ;;
209    esac
210
211    prev=
212    prevopt=
213    continue
214  fi
215
216  # Have we seen a non-optional argument yet?
217  case $arg in
218  --help)
219    show_help=yes
220    ;;
221
222  --version)
223    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
224    $echo
225    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
226    $echo "This is free software; see the source for copying conditions.  There is NO"
227    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
228    exit 0
229    ;;
230
231  --config)
232    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
233    # Now print the configurations for the tags.
234    for tagname in $taglist; do
235      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
236    done
237    exit 0
238    ;;
239
240  --debug)
241    $echo "$progname: enabling shell trace mode"
242    set -x
243    preserve_args="$preserve_args $arg"
244    ;;
245
246  --dry-run | -n)
247    run=:
248    ;;
249
250  --features)
251    $echo "host: $host"
252    if test "$build_libtool_libs" = yes; then
253      $echo "enable shared libraries"
254    else
255      $echo "disable shared libraries"
256    fi
257    if test "$build_old_libs" = yes; then
258      $echo "enable static libraries"
259    else
260      $echo "disable static libraries"
261    fi
262    exit 0
263    ;;
264
265  --finish) mode="finish" ;;
266
267  --mode) prevopt="--mode" prev=mode ;;
268  --mode=*) mode="$optarg" ;;
269
270  --preserve-dup-deps) duplicate_deps="yes" ;;
271
272  --quiet | --silent)
273    show=:
274    preserve_args="$preserve_args $arg"
275    ;;
276
277  --tag) prevopt="--tag" prev=tag ;;
278  --tag=*)
279    set tag "$optarg" ${1+"$@"}
280    shift
281    prev=tag
282    preserve_args="$preserve_args --tag"
283    ;;
284
285  -dlopen)
286    prevopt="-dlopen"
287    prev=execute_dlfiles
288    ;;
289
290  -*)
291    $echo "$modename: unrecognized option \`$arg'" 1>&2
292    $echo "$help" 1>&2
293    exit 1
294    ;;
295
296  *)
297    nonopt="$arg"
298    break
299    ;;
300  esac
301done
302
303if test -n "$prevopt"; then
304  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
305  $echo "$help" 1>&2
306  exit 1
307fi
308
309# If this variable is set in any of the actions, the command in it
310# will be execed at the end.  This prevents here-documents from being
311# left over by shells.
312exec_cmd=
313
314if test -z "$show_help"; then
315
316  # Infer the operation mode.
317  if test -z "$mode"; then
318    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
319    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
320    case $nonopt in
321    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
322      mode=link
323      for arg
324      do
325	case $arg in
326	-c)
327	   mode=compile
328	   break
329	   ;;
330	esac
331      done
332      ;;
333    *db | *dbx | *strace | *truss)
334      mode=execute
335      ;;
336    *install*|cp|mv)
337      mode=install
338      ;;
339    *rm)
340      mode=uninstall
341      ;;
342    *)
343      # If we have no mode, but dlfiles were specified, then do execute mode.
344      test -n "$execute_dlfiles" && mode=execute
345
346      # Just use the default operation mode.
347      if test -z "$mode"; then
348	if test -n "$nonopt"; then
349	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
350	else
351	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
352	fi
353      fi
354      ;;
355    esac
356  fi
357
358  # Only execute mode is allowed to have -dlopen flags.
359  if test -n "$execute_dlfiles" && test "$mode" != execute; then
360    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
361    $echo "$help" 1>&2
362    exit 1
363  fi
364
365  # Change the help message to a mode-specific one.
366  generic_help="$help"
367  help="Try \`$modename --help --mode=$mode' for more information."
368
369  # These modes are in order of execution frequency so that they run quickly.
370  case $mode in
371  # libtool compile mode
372  compile)
373    modename="$modename: compile"
374    # Get the compilation command and the source file.
375    base_compile=
376    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
377    suppress_opt=yes
378    suppress_output=
379    arg_mode=normal
380    libobj=
381    later=
382
383    for arg
384    do
385      case "$arg_mode" in
386      arg  )
387	# do not "continue".  Instead, add this to base_compile
388	lastarg="$arg"
389	arg_mode=normal
390	;;
391
392      target )
393	libobj="$arg"
394	arg_mode=normal
395	continue
396	;;
397
398      normal )
399	# Accept any command-line options.
400	case $arg in
401	-o)
402	  if test -n "$libobj" ; then
403	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
404	    exit 1
405	  fi
406	  arg_mode=target
407	  continue
408	  ;;
409
410	-static | -prefer-pic | -prefer-non-pic)
411	  later="$later $arg"
412	  continue
413	  ;;
414
415	-no-suppress)
416	  suppress_opt=no
417	  continue
418	  ;;
419
420	-Xcompiler)
421	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
422	  continue      #  The current "srcfile" will either be retained or
423	  ;;            #  replaced later.  I would guess that would be a bug.
424
425	-Wc,*)
426	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
427	  lastarg=
428	  save_ifs="$IFS"; IFS=','
429	  for arg in $args; do
430	    IFS="$save_ifs"
431
432	    # Double-quote args containing other shell metacharacters.
433	    # Many Bourne shells cannot handle close brackets correctly
434	    # in scan sets, so we specify it separately.
435	    case $arg in
436	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
437	      arg="\"$arg\""
438	      ;;
439	    esac
440	    lastarg="$lastarg $arg"
441	  done
442	  IFS="$save_ifs"
443	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
444
445	  # Add the arguments to base_compile.
446	  base_compile="$base_compile $lastarg"
447	  continue
448	  ;;
449
450	* )
451	  # Accept the current argument as the source file.
452	  # The previous "srcfile" becomes the current argument.
453	  #
454	  lastarg="$srcfile"
455	  srcfile="$arg"
456	  ;;
457	esac  #  case $arg
458	;;
459      esac    #  case $arg_mode
460
461      # Aesthetically quote the previous argument.
462      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
463
464      case $lastarg in
465      # Double-quote args containing other shell metacharacters.
466      # Many Bourne shells cannot handle close brackets correctly
467      # in scan sets, so we specify it separately.
468      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
469	lastarg="\"$lastarg\""
470	;;
471      esac
472
473      base_compile="$base_compile $lastarg"
474    done # for arg
475
476    case $arg_mode in
477    arg)
478      $echo "$modename: you must specify an argument for -Xcompile"
479      exit 1
480      ;;
481    target)
482      $echo "$modename: you must specify a target with \`-o'" 1>&2
483      exit 1
484      ;;
485    *)
486      # Get the name of the library object.
487      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
488      ;;
489    esac
490
491    # Recognize several different file suffixes.
492    # If the user specifies -o file.o, it is replaced with file.lo
493    xform='[cCFSifmso]'
494    case $libobj in
495    *.ada) xform=ada ;;
496    *.adb) xform=adb ;;
497    *.ads) xform=ads ;;
498    *.asm) xform=asm ;;
499    *.c++) xform=c++ ;;
500    *.cc) xform=cc ;;
501    *.ii) xform=ii ;;
502    *.class) xform=class ;;
503    *.cpp) xform=cpp ;;
504    *.cxx) xform=cxx ;;
505    *.f90) xform=f90 ;;
506    *.for) xform=for ;;
507    *.java) xform=java ;;
508    esac
509
510    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
511
512    case $libobj in
513    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
514    *)
515      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
516      exit 1
517      ;;
518    esac
519
520    # Infer tagged configuration to use if any are available and
521    # if one wasn't chosen via the "--tag" command line option.
522    # Only attempt this if the compiler in the base compile
523    # command doesn't match the default compiler.
524    if test -n "$available_tags" && test -z "$tagname"; then
525      case $base_compile in
526      # Blanks in the command may have been stripped by the calling shell,
527      # but not from the CC environment variable when configure was run.
528      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
529      # Blanks at the start of $base_compile will cause this to fail
530      # if we don't check for them as well.
531      *)
532	for z in $available_tags; do
533	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
534	    # Evaluate the configuration.
535	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
536	    case "$base_compile " in
537	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
538	      # The compiler in the base compile command matches
539	      # the one in the tagged configuration.
540	      # Assume this is the tagged configuration we want.
541	      tagname=$z
542	      break
543	      ;;
544	    esac
545	  fi
546	done
547	# If $tagname still isn't set, then no tagged configuration
548	# was found and let the user know that the "--tag" command
549	# line option must be used.
550	if test -z "$tagname"; then
551	  $echo "$modename: unable to infer tagged configuration"
552	  $echo "$modename: specify a tag with \`--tag'" 1>&2
553	  exit 1
554#        else
555#          $echo "$modename: using $tagname tagged configuration"
556	fi
557	;;
558      esac
559    fi
560
561    for arg in $later; do
562      case $arg in
563      -static)
564	build_old_libs=yes
565	continue
566	;;
567
568      -prefer-pic)
569	pic_mode=yes
570	continue
571	;;
572
573      -prefer-non-pic)
574	pic_mode=no
575	continue
576	;;
577      esac
578    done
579
580    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
581    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
582    if test "X$xdir" = "X$obj"; then
583      xdir=
584    else
585      xdir=$xdir/
586    fi
587    lobj=${xdir}$objdir/$objname
588
589    if test -z "$base_compile"; then
590      $echo "$modename: you must specify a compilation command" 1>&2
591      $echo "$help" 1>&2
592      exit 1
593    fi
594
595    # Delete any leftover library objects.
596    if test "$build_old_libs" = yes; then
597      removelist="$obj $lobj $libobj ${libobj}T"
598    else
599      removelist="$lobj $libobj ${libobj}T"
600    fi
601
602    $run $rm $removelist
603    trap "$run $rm $removelist; exit 1" 1 2 15
604
605    # On Cygwin there's no "real" PIC flag so we must build both object types
606    case $host_os in
607    cygwin* | mingw* | pw32* | os2*)
608      pic_mode=default
609      ;;
610    esac
611    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
612      # non-PIC code in shared libraries is not supported
613      pic_mode=default
614    fi
615
616    # Calculate the filename of the output object if compiler does
617    # not support -o with -c
618    if test "$compiler_c_o" = no; then
619      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
620      lockfile="$output_obj.lock"
621      removelist="$removelist $output_obj $lockfile"
622      trap "$run $rm $removelist; exit 1" 1 2 15
623    else
624      output_obj=
625      need_locks=no
626      lockfile=
627    fi
628
629    # Lock this critical section if it is needed
630    # We use this script file to make the link, it avoids creating a new file
631    if test "$need_locks" = yes; then
632      until $run ln "$0" "$lockfile" 2>/dev/null; do
633	$show "Waiting for $lockfile to be removed"
634	sleep 2
635      done
636    elif test "$need_locks" = warn; then
637      if test -f "$lockfile"; then
638	$echo "\
639*** ERROR, $lockfile exists and contains:
640`cat $lockfile 2>/dev/null`
641
642This indicates that another process is trying to use the same
643temporary object file, and libtool could not work around it because
644your compiler does not support \`-c' and \`-o' together.  If you
645repeat this compilation, it may succeed, by chance, but you had better
646avoid parallel builds (make -j) in this platform, or get a better
647compiler."
648
649	$run $rm $removelist
650	exit 1
651      fi
652      $echo $srcfile > "$lockfile"
653    fi
654
655    if test -n "$fix_srcfile_path"; then
656      eval srcfile=\"$fix_srcfile_path\"
657    fi
658
659    $run $rm "$libobj" "${libobj}T"
660
661    # Create a libtool object file (analogous to a ".la" file),
662    # but don't create it if we're doing a dry run.
663    test -z "$run" && cat > ${libobj}T <<EOF
664# $libobj - a libtool object file
665# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
666#
667# Please DO NOT delete this file!
668# It is necessary for linking the library.
669
670# Name of the PIC object.
671EOF
672
673    # Only build a PIC object if we are building libtool libraries.
674    if test "$build_libtool_libs" = yes; then
675      # Without this assignment, base_compile gets emptied.
676      fbsd_hideous_sh_bug=$base_compile
677
678      if test "$pic_mode" != no; then
679	command="$base_compile $srcfile $pic_flag"
680      else
681	# Don't build PIC code
682	command="$base_compile $srcfile"
683      fi
684
685      if test ! -d "${xdir}$objdir"; then
686	$show "$mkdir ${xdir}$objdir"
687	$run $mkdir ${xdir}$objdir
688	status=$?
689	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
690	  exit $status
691	fi
692      fi
693
694      if test -z "$output_obj"; then
695	# Place PIC objects in $objdir
696	command="$command -o $lobj"
697      fi
698
699      $run $rm "$lobj" "$output_obj"
700
701      $show "$command"
702      if $run eval "$command"; then :
703      else
704	test -n "$output_obj" && $run $rm $removelist
705	exit 1
706      fi
707
708      if test "$need_locks" = warn &&
709	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
710	$echo "\
711*** ERROR, $lockfile contains:
712`cat $lockfile 2>/dev/null`
713
714but it should contain:
715$srcfile
716
717This indicates that another process is trying to use the same
718temporary object file, and libtool could not work around it because
719your compiler does not support \`-c' and \`-o' together.  If you
720repeat this compilation, it may succeed, by chance, but you had better
721avoid parallel builds (make -j) in this platform, or get a better
722compiler."
723
724	$run $rm $removelist
725	exit 1
726      fi
727
728      # Just move the object if needed, then go on to compile the next one
729      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
730	$show "$mv $output_obj $lobj"
731	if $run $mv $output_obj $lobj; then :
732	else
733	  error=$?
734	  $run $rm $removelist
735	  exit $error
736	fi
737      fi
738
739      # Append the name of the PIC object to the libtool object file.
740      test -z "$run" && cat >> ${libobj}T <<EOF
741pic_object='$objdir/$objname'
742
743EOF
744
745      # Allow error messages only from the first compilation.
746      if test "$suppress_opt" = yes; then
747        suppress_output=' >/dev/null 2>&1'
748      fi
749    else
750      # No PIC object so indicate it doesn't exist in the libtool
751      # object file.
752      test -z "$run" && cat >> ${libobj}T <<EOF
753pic_object=none
754
755EOF
756    fi
757
758    # Only build a position-dependent object if we build old libraries.
759    if test "$build_old_libs" = yes; then
760      if test "$pic_mode" != yes; then
761	# Don't build PIC code
762	command="$base_compile $srcfile"
763      else
764	command="$base_compile $srcfile $pic_flag"
765      fi
766      if test "$compiler_c_o" = yes; then
767	command="$command -o $obj"
768      fi
769
770      # Suppress compiler output if we already did a PIC compilation.
771      command="$command$suppress_output"
772      $run $rm "$obj" "$output_obj"
773      $show "$command"
774      if $run eval "$command"; then :
775      else
776	$run $rm $removelist
777	exit 1
778      fi
779
780      if test "$need_locks" = warn &&
781	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
782	$echo "\
783*** ERROR, $lockfile contains:
784`cat $lockfile 2>/dev/null`
785
786but it should contain:
787$srcfile
788
789This indicates that another process is trying to use the same
790temporary object file, and libtool could not work around it because
791your compiler does not support \`-c' and \`-o' together.  If you
792repeat this compilation, it may succeed, by chance, but you had better
793avoid parallel builds (make -j) in this platform, or get a better
794compiler."
795
796	$run $rm $removelist
797	exit 1
798      fi
799
800      # Just move the object if needed
801      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
802	$show "$mv $output_obj $obj"
803	if $run $mv $output_obj $obj; then :
804	else
805	  error=$?
806	  $run $rm $removelist
807	  exit $error
808	fi
809      fi
810
811      # Append the name of the non-PIC object the libtool object file.
812      # Only append if the libtool object file exists.
813      test -z "$run" && cat >> ${libobj}T <<EOF
814# Name of the non-PIC object.
815non_pic_object='$objname'
816
817EOF
818    else
819      # Append the name of the non-PIC object the libtool object file.
820      # Only append if the libtool object file exists.
821      test -z "$run" && cat >> ${libobj}T <<EOF
822# Name of the non-PIC object.
823non_pic_object=none
824
825EOF
826    fi
827
828    $run $mv "${libobj}T" "${libobj}"
829
830    # Unlock the critical section if it was locked
831    if test "$need_locks" != no; then
832      $run $rm "$lockfile"
833    fi
834
835    exit 0
836    ;;
837
838  # libtool link mode
839  link | relink)
840    modename="$modename: link"
841    case $host in
842    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
843      # It is impossible to link a dll without this setting, and
844      # we shouldn't force the makefile maintainer to figure out
845      # which system we are compiling for in order to pass an extra
846      # flag for every libtool invocation.
847      # allow_undefined=no
848
849      # FIXME: Unfortunately, there are problems with the above when trying
850      # to make a dll which has undefined symbols, in which case not
851      # even a static library is built.  For now, we need to specify
852      # -no-undefined on the libtool link line when we can be certain
853      # that all symbols are satisfied, otherwise we get a static library.
854      allow_undefined=yes
855      ;;
856    *)
857      allow_undefined=yes
858      ;;
859    esac
860    libtool_args="$nonopt"
861    base_compile="$nonopt $@"
862    compile_command="$nonopt"
863    finalize_command="$nonopt"
864
865    compile_rpath=
866    finalize_rpath=
867    compile_shlibpath=
868    finalize_shlibpath=
869    convenience=
870    old_convenience=
871    deplibs=
872    old_deplibs=
873    compiler_flags=
874    linker_flags=
875    dllsearchpath=
876    lib_search_path=`pwd`
877    inst_prefix_dir=
878
879    avoid_version=no
880    dlfiles=
881    dlprefiles=
882    dlself=no
883    export_dynamic=no
884    export_symbols=
885    export_symbols_regex=
886    generated=
887    libobjs=
888    ltlibs=
889    module=no
890    no_install=no
891    objs=
892    non_pic_objects=
893    prefer_static_libs=no
894    preload=no
895    prev=
896    prevarg=
897    release=
898    rpath=
899    xrpath=
900    perm_rpath=
901    temp_rpath=
902    thread_safe=no
903    vinfo=
904    vinfo_number=no
905
906    # Infer tagged configuration to use if any are available and
907    # if one wasn't chosen via the "--tag" command line option.
908    # Only attempt this if the compiler in the base link
909    # command doesn't match the default compiler.
910    if test -n "$available_tags" && test -z "$tagname"; then
911      case $base_compile in
912      # Blanks in the command may have been stripped by the calling shell,
913      # but not from the CC environment variable when configure was run.
914      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
915      # Blanks at the start of $base_compile will cause this to fail
916      # if we don't check for them as well.
917      *)
918	for z in $available_tags; do
919	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
920	    # Evaluate the configuration.
921	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
922	    case $base_compile in
923	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
924	      # The compiler in $compile_command matches
925	      # the one in the tagged configuration.
926	      # Assume this is the tagged configuration we want.
927	      tagname=$z
928	      break
929	      ;;
930	    esac
931	  fi
932	done
933	# If $tagname still isn't set, then no tagged configuration
934	# was found and let the user know that the "--tag" command
935	# line option must be used.
936	if test -z "$tagname"; then
937	  $echo "$modename: unable to infer tagged configuration"
938	  $echo "$modename: specify a tag with \`--tag'" 1>&2
939	  exit 1
940#       else
941#         $echo "$modename: using $tagname tagged configuration"
942	fi
943	;;
944      esac
945    fi
946
947    # We need to know -static, to get the right output filenames.
948    for arg
949    do
950      case $arg in
951      -all-static | -static)
952	if test "X$arg" = "X-all-static"; then
953	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
954	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
955	  fi
956	  if test -n "$link_static_flag"; then
957	    dlopen_self=$dlopen_self_static
958	  fi
959	else
960	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
961	    dlopen_self=$dlopen_self_static
962	  fi
963	fi
964	build_libtool_libs=no
965	build_old_libs=yes
966	prefer_static_libs=yes
967	break
968	;;
969      esac
970    done
971
972    # See if our shared archives depend on static archives.
973    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
974
975    # Go through the arguments, transforming them on the way.
976    while test "$#" -gt 0; do
977      arg="$1"
978      shift
979      case $arg in
980      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
981	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
982	;;
983      *) qarg=$arg ;;
984      esac
985      libtool_args="$libtool_args $qarg"
986
987      # If the previous option needs an argument, assign it.
988      if test -n "$prev"; then
989	case $prev in
990	output)
991	  compile_command="$compile_command @OUTPUT@"
992	  finalize_command="$finalize_command @OUTPUT@"
993	  ;;
994	esac
995
996	case $prev in
997	dlfiles|dlprefiles)
998	  if test "$preload" = no; then
999	    # Add the symbol object into the linking commands.
1000	    compile_command="$compile_command @SYMFILE@"
1001	    finalize_command="$finalize_command @SYMFILE@"
1002	    preload=yes
1003	  fi
1004	  case $arg in
1005	  *.la | *.lo) ;;  # We handle these cases below.
1006	  force)
1007	    if test "$dlself" = no; then
1008	      dlself=needless
1009	      export_dynamic=yes
1010	    fi
1011	    prev=
1012	    continue
1013	    ;;
1014	  self)
1015	    if test "$prev" = dlprefiles; then
1016	      dlself=yes
1017	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1018	      dlself=yes
1019	    else
1020	      dlself=needless
1021	      export_dynamic=yes
1022	    fi
1023	    prev=
1024	    continue
1025	    ;;
1026	  *)
1027	    if test "$prev" = dlfiles; then
1028	      dlfiles="$dlfiles $arg"
1029	    else
1030	      dlprefiles="$dlprefiles $arg"
1031	    fi
1032	    prev=
1033	    continue
1034	    ;;
1035	  esac
1036	  ;;
1037	expsyms)
1038	  export_symbols="$arg"
1039	  if test ! -f "$arg"; then
1040	    $echo "$modename: symbol file \`$arg' does not exist"
1041	    exit 1
1042	  fi
1043	  prev=
1044	  continue
1045	  ;;
1046	expsyms_regex)
1047	  export_symbols_regex="$arg"
1048	  prev=
1049	  continue
1050	  ;;
1051	inst_prefix)
1052	  inst_prefix_dir="$arg"
1053	  prev=
1054	  continue
1055	  ;;
1056	release)
1057	  release="-$arg"
1058	  prev=
1059	  continue
1060	  ;;
1061	objectlist)
1062	  if test -f "$arg"; then
1063	    save_arg=$arg
1064	    moreargs=
1065	    for fil in `cat $save_arg`
1066	    do
1067#	      moreargs="$moreargs $fil"
1068	      arg=$fil
1069	      # A libtool-controlled object.
1070
1071	      # Check to see that this really is a libtool object.
1072	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1073		pic_object=
1074		non_pic_object=
1075
1076		# Read the .lo file
1077		# If there is no directory component, then add one.
1078		case $arg in
1079		*/* | *\\*) . $arg ;;
1080		*) . ./$arg ;;
1081		esac
1082
1083		if test -z "$pic_object" || \
1084		   test -z "$non_pic_object" ||
1085		   test "$pic_object" = none && \
1086		   test "$non_pic_object" = none; then
1087		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1088		  exit 1
1089		fi
1090
1091		# Extract subdirectory from the argument.
1092		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1093		if test "X$xdir" = "X$arg"; then
1094		  xdir=
1095		else
1096		  xdir="$xdir/"
1097		fi
1098
1099		if test "$pic_object" != none; then
1100		  # Prepend the subdirectory the object is found in.
1101		  pic_object="$xdir$pic_object"
1102
1103		  if test "$prev" = dlfiles; then
1104		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1105		      dlfiles="$dlfiles $pic_object"
1106		      prev=
1107		      continue
1108		    else
1109		      # If libtool objects are unsupported, then we need to preload.
1110		      prev=dlprefiles
1111		    fi
1112		  fi
1113
1114		  # CHECK ME:  I think I busted this.  -Ossama
1115		  if test "$prev" = dlprefiles; then
1116		    # Preload the old-style object.
1117		    dlprefiles="$dlprefiles $pic_object"
1118		    prev=
1119		  fi
1120
1121		  # A PIC object.
1122		  libobjs="$libobjs $pic_object"
1123		  arg="$pic_object"
1124		fi
1125
1126		# Non-PIC object.
1127		if test "$non_pic_object" != none; then
1128		  # Prepend the subdirectory the object is found in.
1129		  non_pic_object="$xdir$non_pic_object"
1130
1131		  # A standard non-PIC object
1132		  non_pic_objects="$non_pic_objects $non_pic_object"
1133		  if test -z "$pic_object" || test "$pic_object" = none ; then
1134		    arg="$non_pic_object"
1135		  fi
1136		fi
1137	      else
1138		# Only an error if not doing a dry-run.
1139		if test -z "$run"; then
1140		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1141		  exit 1
1142		else
1143		  # Dry-run case.
1144
1145		  # Extract subdirectory from the argument.
1146		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1147		  if test "X$xdir" = "X$arg"; then
1148		    xdir=
1149		  else
1150		    xdir="$xdir/"
1151		  fi
1152
1153		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1154		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1155		  libobjs="$libobjs $pic_object"
1156		  non_pic_objects="$non_pic_objects $non_pic_object"
1157		fi
1158	      fi
1159	    done
1160	  else
1161	    $echo "$modename: link input file \`$save_arg' does not exist"
1162	    exit 1
1163	  fi
1164	  arg=$save_arg
1165	  prev=
1166	  continue
1167	  ;;
1168	rpath | xrpath)
1169	  # We need an absolute path.
1170	  case $arg in
1171	  [\\/]* | [A-Za-z]:[\\/]*) ;;
1172	  *)
1173	    $echo "$modename: only absolute run-paths are allowed" 1>&2
1174	    exit 1
1175	    ;;
1176	  esac
1177	  if test "$prev" = rpath; then
1178	    case "$rpath " in
1179	    *" $arg "*) ;;
1180	    *) rpath="$rpath $arg" ;;
1181	    esac
1182	  else
1183	    case "$xrpath " in
1184	    *" $arg "*) ;;
1185	    *) xrpath="$xrpath $arg" ;;
1186	    esac
1187	  fi
1188	  prev=
1189	  continue
1190	  ;;
1191	xcompiler)
1192	  compiler_flags="$compiler_flags $qarg"
1193	  prev=
1194	  compile_command="$compile_command $qarg"
1195	  finalize_command="$finalize_command $qarg"
1196	  continue
1197	  ;;
1198	xlinker)
1199	  linker_flags="$linker_flags $qarg"
1200	  compiler_flags="$compiler_flags $wl$qarg"
1201	  prev=
1202	  compile_command="$compile_command $wl$qarg"
1203	  finalize_command="$finalize_command $wl$qarg"
1204	  continue
1205	  ;;
1206	xcclinker)
1207	  linker_flags="$linker_flags $qarg"
1208	  compiler_flags="$compiler_flags $qarg"
1209	  prev=
1210	  compile_command="$compile_command $qarg"
1211	  finalize_command="$finalize_command $qarg"
1212	  continue
1213	  ;;
1214	*)
1215	  eval "$prev=\"\$arg\""
1216	  prev=
1217	  continue
1218	  ;;
1219	esac
1220      fi # test -n "$prev"
1221
1222      prevarg="$arg"
1223
1224      case $arg in
1225      -all-static)
1226	if test -n "$link_static_flag"; then
1227	  compile_command="$compile_command $link_static_flag"
1228	  finalize_command="$finalize_command $link_static_flag"
1229	fi
1230	continue
1231	;;
1232
1233      -allow-undefined)
1234	# FIXME: remove this flag sometime in the future.
1235	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1236	continue
1237	;;
1238
1239      -avoid-version)
1240	avoid_version=yes
1241	continue
1242	;;
1243
1244      -dlopen)
1245	prev=dlfiles
1246	continue
1247	;;
1248
1249      -dlpreopen)
1250	prev=dlprefiles
1251	continue
1252	;;
1253
1254      -export-dynamic)
1255	export_dynamic=yes
1256	continue
1257	;;
1258
1259      -export-symbols | -export-symbols-regex)
1260	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1261	  $echo "$modename: more than one -exported-symbols argument is not allowed"
1262	  exit 1
1263	fi
1264	if test "X$arg" = "X-export-symbols"; then
1265	  prev=expsyms
1266	else
1267	  prev=expsyms_regex
1268	fi
1269	continue
1270	;;
1271
1272      -inst-prefix-dir)
1273	prev=inst_prefix
1274	continue
1275	;;
1276
1277      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1278      # so, if we see these flags be careful not to treat them like -L
1279      -L[A-Z][A-Z]*:*)
1280	case $with_gcc/$host in
1281	no/*-*-irix* | /*-*-irix*)
1282	  compile_command="$compile_command $arg"
1283	  finalize_command="$finalize_command $arg"
1284	  ;;
1285	esac
1286	continue
1287	;;
1288
1289      -L*)
1290	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1291	# We need an absolute path.
1292	case $dir in
1293	[\\/]* | [A-Za-z]:[\\/]*) ;;
1294	*)
1295	  absdir=`cd "$dir" && pwd`
1296	  if test -z "$absdir"; then
1297	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1298	    exit 1
1299	  fi
1300	  dir="$absdir"
1301	  ;;
1302	esac
1303	case "$deplibs " in
1304	*" -L$dir "*) ;;
1305	*)
1306	  deplibs="$deplibs -L$dir"
1307	  lib_search_path="$lib_search_path $dir"
1308	  ;;
1309	esac
1310	case $host in
1311	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1312	  case :$dllsearchpath: in
1313	  *":$dir:"*) ;;
1314	  *) dllsearchpath="$dllsearchpath:$dir";;
1315	  esac
1316	  ;;
1317	esac
1318	continue
1319	;;
1320
1321      -l*)
1322	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1323	  case $host in
1324	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
1325	    # These systems don't actually have a C or math library (as such)
1326	    continue
1327	    ;;
1328	  *-*-mingw* | *-*-os2*)
1329	    # These systems don't actually have a C library (as such)
1330	    test "X$arg" = "X-lc" && continue
1331	    ;;
1332	  *-*-openbsd* | *-*-freebsd*)
1333	    # Do not include libc due to us having libc/libc_r.
1334	    test "X$arg" = "X-lc" && continue
1335	    ;;
1336	  *-*-rhapsody* | *-*-darwin1.[012])
1337	    # Rhapsody C and math libraries are in the System framework
1338	    deplibs="$deplibs -framework System"
1339	    continue
1340	  esac
1341	elif test "X$arg" = "X-lc_r"; then
1342	 case $host in
1343	 *-*-openbsd* | *-*-freebsd*)
1344	   # Do not include libc_r directly, use -pthread flag.
1345	   continue
1346	   ;;
1347	 esac
1348	fi
1349	deplibs="$deplibs $arg"
1350	continue
1351	;;
1352
1353     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1354	deplibs="$deplibs $arg"
1355	continue
1356	;;
1357
1358      -module)
1359	module=yes
1360	continue
1361	;;
1362
1363      # gcc -m* arguments should be passed to the linker via $compiler_flags
1364      # in order to pass architecture information to the linker
1365      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1366      # but this is not reliable with gcc because gcc may use -mfoo to
1367      # select a different linker, different libraries, etc, while
1368      # -Wl,-mfoo simply passes -mfoo to the linker.
1369      -m*)
1370	# Unknown arguments in both finalize_command and compile_command need
1371	# to be aesthetically quoted because they are evaled later.
1372	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1373	case $arg in
1374	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1375	  arg="\"$arg\""
1376	  ;;
1377	esac
1378        compile_command="$compile_command $arg"
1379        finalize_command="$finalize_command $arg"
1380        if test "$with_gcc" = "yes" ; then
1381          compiler_flags="$compiler_flags $arg"
1382        fi
1383        continue
1384        ;;
1385
1386      -shrext)
1387	prev=shrext
1388	continue
1389	;;
1390
1391      -no-fast-install)
1392	fast_install=no
1393	continue
1394	;;
1395
1396      -no-install)
1397	case $host in
1398	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1399	  # The PATH hackery in wrapper scripts is required on Windows
1400	  # in order for the loader to find any dlls it needs.
1401	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1402	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1403	  fast_install=no
1404	  ;;
1405	*) no_install=yes ;;
1406	esac
1407	continue
1408	;;
1409
1410      -no-undefined)
1411	allow_undefined=no
1412	continue
1413	;;
1414
1415      -objectlist)
1416	prev=objectlist
1417	continue
1418	;;
1419
1420      -o) prev=output ;;
1421
1422      -release)
1423	prev=release
1424	continue
1425	;;
1426
1427      -rpath)
1428	prev=rpath
1429	continue
1430	;;
1431
1432      -R)
1433	prev=xrpath
1434	continue
1435	;;
1436
1437      -R*)
1438	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1439	# We need an absolute path.
1440	case $dir in
1441	[\\/]* | [A-Za-z]:[\\/]*) ;;
1442	*)
1443	  $echo "$modename: only absolute run-paths are allowed" 1>&2
1444	  exit 1
1445	  ;;
1446	esac
1447	case "$xrpath " in
1448	*" $dir "*) ;;
1449	*) xrpath="$xrpath $dir" ;;
1450	esac
1451	continue
1452	;;
1453
1454      -static)
1455	# The effects of -static are defined in a previous loop.
1456	# We used to do the same as -all-static on platforms that
1457	# didn't have a PIC flag, but the assumption that the effects
1458	# would be equivalent was wrong.  It would break on at least
1459	# Digital Unix and AIX.
1460	continue
1461	;;
1462
1463      -thread-safe)
1464	thread_safe=yes
1465	continue
1466	;;
1467
1468      -version-info)
1469	prev=vinfo
1470	continue
1471	;;
1472      -version-number)
1473	prev=vinfo
1474	vinfo_number=yes
1475	continue
1476	;;
1477
1478      -Wc,*)
1479	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1480	arg=
1481	save_ifs="$IFS"; IFS=','
1482	for flag in $args; do
1483	  IFS="$save_ifs"
1484	  case $flag in
1485	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1486	    flag="\"$flag\""
1487	    ;;
1488	  esac
1489	  arg="$arg $wl$flag"
1490	  compiler_flags="$compiler_flags $flag"
1491	done
1492	IFS="$save_ifs"
1493	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1494	;;
1495
1496      -Wl,*)
1497	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1498	arg=
1499	save_ifs="$IFS"; IFS=','
1500	for flag in $args; do
1501	  IFS="$save_ifs"
1502	  case $flag in
1503	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1504	    flag="\"$flag\""
1505	    ;;
1506	  esac
1507	  arg="$arg $wl$flag"
1508	  compiler_flags="$compiler_flags $wl$flag"
1509	  linker_flags="$linker_flags $flag"
1510	done
1511	IFS="$save_ifs"
1512	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1513	;;
1514
1515      -Xcompiler)
1516	prev=xcompiler
1517	continue
1518	;;
1519
1520      -Xlinker)
1521	prev=xlinker
1522	continue
1523	;;
1524
1525      -XCClinker)
1526	prev=xcclinker
1527	continue
1528	;;
1529
1530      # Some other compiler flag.
1531      -* | +*)
1532	# Unknown arguments in both finalize_command and compile_command need
1533	# to be aesthetically quoted because they are evaled later.
1534	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1535	case $arg in
1536	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1537	  arg="\"$arg\""
1538	  ;;
1539	esac
1540	;;
1541
1542      *.$objext)
1543	# A standard object.
1544	objs="$objs $arg"
1545	;;
1546
1547      *.lo)
1548	# A libtool-controlled object.
1549
1550	# Check to see that this really is a libtool object.
1551	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1552	  pic_object=
1553	  non_pic_object=
1554
1555	  # Read the .lo file
1556	  # If there is no directory component, then add one.
1557	  case $arg in
1558	  */* | *\\*) . $arg ;;
1559	  *) . ./$arg ;;
1560	  esac
1561
1562	  if test -z "$pic_object" || \
1563	     test -z "$non_pic_object" ||
1564	     test "$pic_object" = none && \
1565	     test "$non_pic_object" = none; then
1566	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1567	    exit 1
1568	  fi
1569
1570	  # Extract subdirectory from the argument.
1571	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1572	  if test "X$xdir" = "X$arg"; then
1573	    xdir=
1574 	  else
1575	    xdir="$xdir/"
1576	  fi
1577
1578	  if test "$pic_object" != none; then
1579	    # Prepend the subdirectory the object is found in.
1580	    pic_object="$xdir$pic_object"
1581
1582	    if test "$prev" = dlfiles; then
1583	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1584		dlfiles="$dlfiles $pic_object"
1585		prev=
1586		continue
1587	      else
1588		# If libtool objects are unsupported, then we need to preload.
1589		prev=dlprefiles
1590	      fi
1591	    fi
1592
1593	    # CHECK ME:  I think I busted this.  -Ossama
1594	    if test "$prev" = dlprefiles; then
1595	      # Preload the old-style object.
1596	      dlprefiles="$dlprefiles $pic_object"
1597	      prev=
1598	    fi
1599
1600	    # A PIC object.
1601	    libobjs="$libobjs $pic_object"
1602	    arg="$pic_object"
1603	  fi
1604
1605	  # Non-PIC object.
1606	  if test "$non_pic_object" != none; then
1607	    # Prepend the subdirectory the object is found in.
1608	    non_pic_object="$xdir$non_pic_object"
1609
1610	    # A standard non-PIC object
1611	    non_pic_objects="$non_pic_objects $non_pic_object"
1612	    if test -z "$pic_object" || test "$pic_object" = none ; then
1613	      arg="$non_pic_object"
1614	    fi
1615	  fi
1616	else
1617	  # Only an error if not doing a dry-run.
1618	  if test -z "$run"; then
1619	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1620	    exit 1
1621	  else
1622	    # Dry-run case.
1623
1624	    # Extract subdirectory from the argument.
1625	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1626	    if test "X$xdir" = "X$arg"; then
1627	      xdir=
1628	    else
1629	      xdir="$xdir/"
1630	    fi
1631
1632	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1633	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1634	    libobjs="$libobjs $pic_object"
1635	    non_pic_objects="$non_pic_objects $non_pic_object"
1636	  fi
1637	fi
1638	;;
1639
1640      *.$libext)
1641	# An archive.
1642	deplibs="$deplibs $arg"
1643	old_deplibs="$old_deplibs $arg"
1644	continue
1645	;;
1646
1647      *.la)
1648	# A libtool-controlled library.
1649
1650	if test "$prev" = dlfiles; then
1651	  # This library was specified with -dlopen.
1652	  dlfiles="$dlfiles $arg"
1653	  prev=
1654	elif test "$prev" = dlprefiles; then
1655	  # The library was specified with -dlpreopen.
1656	  dlprefiles="$dlprefiles $arg"
1657	  prev=
1658	else
1659	  deplibs="$deplibs $arg"
1660	fi
1661	continue
1662	;;
1663
1664      # Some other compiler argument.
1665      *)
1666	# Unknown arguments in both finalize_command and compile_command need
1667	# to be aesthetically quoted because they are evaled later.
1668	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1669	case $arg in
1670	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1671	  arg="\"$arg\""
1672	  ;;
1673	esac
1674	;;
1675      esac # arg
1676
1677      # Now actually substitute the argument into the commands.
1678      if test -n "$arg"; then
1679	compile_command="$compile_command $arg"
1680	finalize_command="$finalize_command $arg"
1681      fi
1682    done # argument parsing loop
1683
1684    if test -n "$prev"; then
1685      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1686      $echo "$help" 1>&2
1687      exit 1
1688    fi
1689
1690    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1691      eval arg=\"$export_dynamic_flag_spec\"
1692      compile_command="$compile_command $arg"
1693      finalize_command="$finalize_command $arg"
1694    fi
1695
1696    oldlibs=
1697    # calculate the name of the file, without its directory
1698    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1699    libobjs_save="$libobjs"
1700
1701    if test -n "$shlibpath_var"; then
1702      # get the directories listed in $shlibpath_var
1703      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1704    else
1705      shlib_search_path=
1706    fi
1707    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1708    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1709
1710    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1711    if test "X$output_objdir" = "X$output"; then
1712      output_objdir="$objdir"
1713    else
1714      output_objdir="$output_objdir/$objdir"
1715    fi
1716    # Create the object directory.
1717    if test ! -d "$output_objdir"; then
1718      $show "$mkdir $output_objdir"
1719      $run $mkdir $output_objdir
1720      status=$?
1721      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1722	exit $status
1723      fi
1724    fi
1725
1726    # Determine the type of output
1727    case $output in
1728    "")
1729      $echo "$modename: you must specify an output file" 1>&2
1730      $echo "$help" 1>&2
1731      exit 1
1732      ;;
1733    *.$libext) linkmode=oldlib ;;
1734    *.lo | *.$objext) linkmode=obj ;;
1735    *.la) linkmode=lib ;;
1736    *) linkmode=prog ;; # Anything else should be a program.
1737    esac
1738
1739    case $host in
1740    *cygwin* | *mingw* | *pw32*)
1741      # don't eliminate duplcations in $postdeps and $predeps
1742      duplicate_compiler_generated_deps=yes
1743      ;;
1744    *)
1745      duplicate_compiler_generated_deps=$duplicate_deps
1746      ;;
1747    esac
1748    specialdeplibs=
1749
1750    libs=
1751    # Find all interdependent deplibs by searching for libraries
1752    # that are linked more than once (e.g. -la -lb -la)
1753    for deplib in $deplibs; do
1754      if test "X$duplicate_deps" = "Xyes" ; then
1755	case "$libs " in
1756	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1757	esac
1758      fi
1759      libs="$libs $deplib"
1760    done
1761
1762    if test "$linkmode" = lib; then
1763      libs="$predeps $libs $compiler_lib_search_path $postdeps"
1764
1765      # Compute libraries that are listed more than once in $predeps
1766      # $postdeps and mark them as special (i.e., whose duplicates are
1767      # not to be eliminated).
1768      pre_post_deps=
1769      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1770	for pre_post_dep in $predeps $postdeps; do
1771	  case "$pre_post_deps " in
1772	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1773	  esac
1774	  pre_post_deps="$pre_post_deps $pre_post_dep"
1775	done
1776      fi
1777      pre_post_deps=
1778    fi
1779
1780    deplibs=
1781    newdependency_libs=
1782    newlib_search_path=
1783    need_relink=no # whether we're linking any uninstalled libtool libraries
1784    notinst_deplibs= # not-installed libtool libraries
1785    notinst_path= # paths that contain not-installed libtool libraries
1786    case $linkmode in
1787    lib)
1788	passes="conv link"
1789	for file in $dlfiles $dlprefiles; do
1790	  case $file in
1791	  *.la) ;;
1792	  *)
1793	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1794	    exit 1
1795	    ;;
1796	  esac
1797	done
1798	;;
1799    prog)
1800	compile_deplibs=
1801	finalize_deplibs=
1802	alldeplibs=no
1803	newdlfiles=
1804	newdlprefiles=
1805	passes="conv scan dlopen dlpreopen link"
1806	;;
1807    *)  passes="conv"
1808	;;
1809    esac
1810    for pass in $passes; do
1811      if test "$linkmode,$pass" = "lib,link" ||
1812	 test "$linkmode,$pass" = "prog,scan"; then
1813	libs="$deplibs"
1814	deplibs=
1815      fi
1816      if test "$linkmode" = prog; then
1817	case $pass in
1818	dlopen) libs="$dlfiles" ;;
1819	dlpreopen) libs="$dlprefiles" ;;
1820	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1821	esac
1822      fi
1823      if test "$pass" = dlopen; then
1824	# Collect dlpreopened libraries
1825	save_deplibs="$deplibs"
1826	deplibs=
1827      fi
1828      for deplib in $libs; do
1829	lib=
1830	found=no
1831	case $deplib in
1832	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1833	  if test "$linkmode,$pass" = "prog,link"; then
1834	    compile_deplibs="$deplib $compile_deplibs"
1835	    finalize_deplibs="$deplib $finalize_deplibs"
1836	  else
1837	    deplibs="$deplib $deplibs"
1838	  fi
1839	  continue
1840	  ;;
1841	-l*)
1842	  if test "$linkmode" != lib && test "$linkmode" != prog; then
1843	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1844	    continue
1845	  fi
1846	  if test "$pass" = conv; then
1847	    deplibs="$deplib $deplibs"
1848	    continue
1849	  fi
1850	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1851	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1852	    for search_ext in .la $shrext .so .a; do
1853	      # Search the libtool library
1854	      lib="$searchdir/lib${name}${search_ext}"
1855	      if test -f "$lib"; then
1856		if test "$search_ext" = ".la"; then
1857		  found=yes
1858		else
1859		  found=no
1860		fi
1861		break 2
1862	      fi
1863	    done
1864	  done
1865	  if test "$found" != yes; then
1866	    # deplib doesn't seem to be a libtool library
1867	    if test "$linkmode,$pass" = "prog,link"; then
1868	      compile_deplibs="$deplib $compile_deplibs"
1869	      finalize_deplibs="$deplib $finalize_deplibs"
1870	    else
1871	      deplibs="$deplib $deplibs"
1872	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1873	    fi
1874	    continue
1875	  else # deplib is a libtool library
1876	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1877	    # We need to do some special things here, and not later.
1878	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1879	      case " $predeps $postdeps " in
1880	      *" $deplib "*)
1881		if (${SED} -e '2q' $lib |
1882                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1883		  library_names=
1884		  old_library=
1885		  case $lib in
1886		  */* | *\\*) . $lib ;;
1887		  *) . ./$lib ;;
1888		  esac
1889		  for l in $old_library $library_names; do
1890		    ll="$l"
1891		  done
1892		  if test "X$ll" = "X$old_library" ; then # only static version available
1893		    found=no
1894		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1895		    test "X$ladir" = "X$lib" && ladir="."
1896		    lib=$ladir/$old_library
1897		    if test "$linkmode,$pass" = "prog,link"; then
1898		      compile_deplibs="$deplib $compile_deplibs"
1899		      finalize_deplibs="$deplib $finalize_deplibs"
1900		    else
1901		      deplibs="$deplib $deplibs"
1902		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1903		    fi
1904		    continue
1905		  fi
1906		fi
1907	        ;;
1908	      *) ;;
1909	      esac
1910	    fi
1911	  fi
1912	  ;; # -l
1913	-L*)
1914	  case $linkmode in
1915	  lib)
1916	    deplibs="$deplib $deplibs"
1917	    test "$pass" = conv && continue
1918	    newdependency_libs="$deplib $newdependency_libs"
1919	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1920	    ;;
1921	  prog)
1922	    if test "$pass" = conv; then
1923	      deplibs="$deplib $deplibs"
1924	      continue
1925	    fi
1926	    if test "$pass" = scan; then
1927	      deplibs="$deplib $deplibs"
1928	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1929	    else
1930	      compile_deplibs="$deplib $compile_deplibs"
1931	      finalize_deplibs="$deplib $finalize_deplibs"
1932	    fi
1933	    ;;
1934	  *)
1935	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1936	    ;;
1937	  esac # linkmode
1938	  continue
1939	  ;; # -L
1940	-R*)
1941	  if test "$pass" = link; then
1942	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1943	    # Make sure the xrpath contains only unique directories.
1944	    case "$xrpath " in
1945	    *" $dir "*) ;;
1946	    *) xrpath="$xrpath $dir" ;;
1947	    esac
1948	  fi
1949	  deplibs="$deplib $deplibs"
1950	  continue
1951	  ;;
1952	*.la) lib="$deplib" ;;
1953	*.$libext)
1954	  if test "$pass" = conv; then
1955	    deplibs="$deplib $deplibs"
1956	    continue
1957	  fi
1958	  case $linkmode in
1959	  lib)
1960	    if test "$deplibs_check_method" != pass_all; then
1961	      $echo
1962	      $echo "*** Warning: Trying to link with static lib archive $deplib."
1963	      $echo "*** I have the capability to make that library automatically link in when"
1964	      $echo "*** you link to this library.  But I can only do this if you have a"
1965	      $echo "*** shared version of the library, which you do not appear to have"
1966	      $echo "*** because the file extensions .$libext of this argument makes me believe"
1967	      $echo "*** that it is just a static archive that I should not used here."
1968	    else
1969	      $echo
1970	      $echo "*** Warning: Linking the shared library $output against the"
1971	      $echo "*** static library $deplib is not portable!"
1972	      deplibs="$deplib $deplibs"
1973	    fi
1974	    continue
1975	    ;;
1976	  prog)
1977	    if test "$pass" != link; then
1978	      deplibs="$deplib $deplibs"
1979	    else
1980	      compile_deplibs="$deplib $compile_deplibs"
1981	      finalize_deplibs="$deplib $finalize_deplibs"
1982	    fi
1983	    continue
1984	    ;;
1985	  esac # linkmode
1986	  ;; # *.$libext
1987	*.lo | *.$objext)
1988	  if test "$pass" = conv; then
1989	    deplibs="$deplib $deplibs"
1990	  elif test "$linkmode" = prog; then
1991	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1992	      # If there is no dlopen support or we're linking statically,
1993	      # we need to preload.
1994	      newdlprefiles="$newdlprefiles $deplib"
1995	      compile_deplibs="$deplib $compile_deplibs"
1996	      finalize_deplibs="$deplib $finalize_deplibs"
1997	    else
1998	      newdlfiles="$newdlfiles $deplib"
1999	    fi
2000	  fi
2001	  continue
2002	  ;;
2003	%DEPLIBS%)
2004	  alldeplibs=yes
2005	  continue
2006	  ;;
2007	esac # case $deplib
2008	if test "$found" = yes || test -f "$lib"; then :
2009	else
2010	  $echo "$modename: cannot find the library \`$lib'" 1>&2
2011	  exit 1
2012	fi
2013
2014	# Check to see that this really is a libtool archive.
2015	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2016	else
2017	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2018	  exit 1
2019	fi
2020
2021	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2022	test "X$ladir" = "X$lib" && ladir="."
2023
2024	dlname=
2025	dlopen=
2026	dlpreopen=
2027	libdir=
2028	library_names=
2029	old_library=
2030	# If the library was installed with an old release of libtool,
2031	# it will not redefine variables installed, or shouldnotlink
2032	installed=yes
2033	shouldnotlink=no
2034
2035	# Read the .la file
2036	case $lib in
2037	*/* | *\\*) . $lib ;;
2038	*) . ./$lib ;;
2039	esac
2040
2041	if test "$linkmode,$pass" = "lib,link" ||
2042	   test "$linkmode,$pass" = "prog,scan" ||
2043	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2044	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2045	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2046	fi
2047
2048	if test "$pass" = conv; then
2049	  # Only check for convenience libraries
2050	  deplibs="$lib $deplibs"
2051	  if test -z "$libdir"; then
2052	    if test -z "$old_library"; then
2053	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2054	      exit 1
2055	    fi
2056	    # It is a libtool convenience library, so add in its objects.
2057	    convenience="$convenience $ladir/$objdir/$old_library"
2058	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
2059	    tmp_libs=
2060	    for deplib in $dependency_libs; do
2061	      deplibs="$deplib $deplibs"
2062              if test "X$duplicate_deps" = "Xyes" ; then
2063	        case "$tmp_libs " in
2064	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2065	        esac
2066              fi
2067	      tmp_libs="$tmp_libs $deplib"
2068	    done
2069	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
2070	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
2071	    exit 1
2072	  fi
2073	  continue
2074	fi # $pass = conv
2075
2076
2077	# Get the name of the library we link against.
2078	linklib=
2079	for l in $old_library $library_names; do
2080	  linklib="$l"
2081	done
2082	if test -z "$linklib"; then
2083	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2084	  exit 1
2085	fi
2086
2087	# This library was specified with -dlopen.
2088	if test "$pass" = dlopen; then
2089	  if test -z "$libdir"; then
2090	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2091	    exit 1
2092	  fi
2093	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2094	    # If there is no dlname, no dlopen support or we're linking
2095	    # statically, we need to preload.  We also need to preload any
2096	    # dependent libraries so libltdl's deplib preloader doesn't
2097	    # bomb out in the load deplibs phase.
2098	    dlprefiles="$dlprefiles $lib $dependency_libs"
2099	  else
2100	    newdlfiles="$newdlfiles $lib"
2101	  fi
2102	  continue
2103	fi # $pass = dlopen
2104
2105	# We need an absolute path.
2106	case $ladir in
2107	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2108	*)
2109	  abs_ladir=`cd "$ladir" && pwd`
2110	  if test -z "$abs_ladir"; then
2111	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2112	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2113	    abs_ladir="$ladir"
2114	  fi
2115	  ;;
2116	esac
2117	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2118
2119	# Find the relevant object directory and library name.
2120	if test "X$installed" = Xyes; then
2121	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2122	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
2123	    dir="$ladir"
2124	    absdir="$abs_ladir"
2125	    libdir="$abs_ladir"
2126	  else
2127	    dir="$libdir"
2128	    absdir="$libdir"
2129	  fi
2130	else
2131	  dir="$ladir/$objdir"
2132	  absdir="$abs_ladir/$objdir"
2133	  # Remove this search path later
2134	  notinst_path="$notinst_path $abs_ladir"
2135	fi # $installed = yes
2136	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2137
2138	# This library was specified with -dlpreopen.
2139	if test "$pass" = dlpreopen; then
2140	  if test -z "$libdir"; then
2141	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2142	    exit 1
2143	  fi
2144	  # Prefer using a static library (so that no silly _DYNAMIC symbols
2145	  # are required to link).
2146	  if test -n "$old_library"; then
2147	    newdlprefiles="$newdlprefiles $dir/$old_library"
2148	  # Otherwise, use the dlname, so that lt_dlopen finds it.
2149	  elif test -n "$dlname"; then
2150	    newdlprefiles="$newdlprefiles $dir/$dlname"
2151	  else
2152	    newdlprefiles="$newdlprefiles $dir/$linklib"
2153	  fi
2154	fi # $pass = dlpreopen
2155
2156	if test -z "$libdir"; then
2157	  # Link the convenience library
2158	  if test "$linkmode" = lib; then
2159	    deplibs="$dir/$old_library $deplibs"
2160	  elif test "$linkmode,$pass" = "prog,link"; then
2161	    compile_deplibs="$dir/$old_library $compile_deplibs"
2162	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
2163	  else
2164	    deplibs="$lib $deplibs" # used for prog,scan pass
2165	  fi
2166	  continue
2167	fi
2168
2169
2170	if test "$linkmode" = prog && test "$pass" != link; then
2171	  newlib_search_path="$newlib_search_path $ladir"
2172	  deplibs="$lib $deplibs"
2173
2174	  linkalldeplibs=no
2175	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
2176	     test "$build_libtool_libs" = no; then
2177	    linkalldeplibs=yes
2178	  fi
2179
2180	  tmp_libs=
2181	  for deplib in $dependency_libs; do
2182	    case $deplib in
2183	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2184	    esac
2185	    # Need to link against all dependency_libs?
2186	    if test "$linkalldeplibs" = yes; then
2187	      deplibs="$deplib $deplibs"
2188	    else
2189	      # Need to hardcode shared library paths
2190	      # or/and link against static libraries
2191	      newdependency_libs="$deplib $newdependency_libs"
2192	    fi
2193	    if test "X$duplicate_deps" = "Xyes" ; then
2194	      case "$tmp_libs " in
2195	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2196	      esac
2197	    fi
2198	    tmp_libs="$tmp_libs $deplib"
2199	  done # for deplib
2200	  continue
2201	fi # $linkmode = prog...
2202
2203	if test "$linkmode,$pass" = "prog,link"; then
2204	  if test -n "$library_names" &&
2205	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2206	    # We need to hardcode the library path
2207	    if test -n "$shlibpath_var"; then
2208	      # Make sure the rpath contains only unique directories.
2209	      case "$temp_rpath " in
2210	      *" $dir "*) ;;
2211	      *" $absdir "*) ;;
2212	      *) temp_rpath="$temp_rpath $dir" ;;
2213	      esac
2214	    fi
2215
2216	    # Hardcode the library path.
2217	    # Skip directories that are in the system default run-time
2218	    # search path.
2219	    case " $sys_lib_dlsearch_path " in
2220	    *" $absdir "*) ;;
2221	    *)
2222	      case "$compile_rpath " in
2223	      *" $absdir "*) ;;
2224	      *) compile_rpath="$compile_rpath $absdir"
2225	      esac
2226	      ;;
2227	    esac
2228	    case " $sys_lib_dlsearch_path " in
2229	    *" $libdir "*) ;;
2230	    *)
2231	      case "$finalize_rpath " in
2232	      *" $libdir "*) ;;
2233	      *) finalize_rpath="$finalize_rpath $libdir"
2234	      esac
2235	      ;;
2236	    esac
2237	  fi # $linkmode,$pass = prog,link...
2238
2239	  if test "$alldeplibs" = yes &&
2240	     { test "$deplibs_check_method" = pass_all ||
2241	       { test "$build_libtool_libs" = yes &&
2242		 test -n "$library_names"; }; }; then
2243	    # We only need to search for static libraries
2244	    continue
2245	  fi
2246	fi
2247
2248	link_static=no # Whether the deplib will be linked statically
2249	if test -n "$library_names" &&
2250	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2251	  if test "$installed" = no; then
2252	    notinst_deplibs="$notinst_deplibs $lib"
2253	    need_relink=yes
2254	  fi
2255	  # This is a shared library
2256
2257      # Warn about portability, can't link against -module's on some systems (darwin)
2258      if test "$shouldnotlink" = yes && test "$pass" = link ; then
2259	    $echo
2260	    if test "$linkmode" = prog; then
2261	      $echo "*** Warning: Linking the executable $output against the loadable module"
2262	    else
2263	      $echo "*** Warning: Linking the shared library $output against the loadable module"
2264	    fi
2265	    $echo "*** $linklib is not portable!"
2266      fi
2267	  if test "$linkmode" = lib &&
2268	     test "$hardcode_into_libs" = yes; then
2269	    # Hardcode the library path.
2270	    # Skip directories that are in the system default run-time
2271	    # search path.
2272	    case " $sys_lib_dlsearch_path " in
2273	    *" $absdir "*) ;;
2274	    *)
2275	      case "$compile_rpath " in
2276	      *" $absdir "*) ;;
2277	      *) compile_rpath="$compile_rpath $absdir"
2278	      esac
2279	      ;;
2280	    esac
2281	    case " $sys_lib_dlsearch_path " in
2282	    *" $libdir "*) ;;
2283	    *)
2284	      case "$finalize_rpath " in
2285	      *" $libdir "*) ;;
2286	      *) finalize_rpath="$finalize_rpath $libdir"
2287	      esac
2288	      ;;
2289	    esac
2290	  fi
2291
2292	  if test -n "$old_archive_from_expsyms_cmds"; then
2293	    # figure out the soname
2294	    set dummy $library_names
2295	    realname="$2"
2296	    shift; shift
2297	    libname=`eval \\$echo \"$libname_spec\"`
2298	    # use dlname if we got it. it's perfectly good, no?
2299	    if test -n "$dlname"; then
2300	      soname="$dlname"
2301	    elif test -n "$soname_spec"; then
2302	      # bleh windows
2303	      case $host in
2304	      *cygwin* | mingw*)
2305		major=`expr $current - $age`
2306		versuffix="-$major"
2307		;;
2308	      esac
2309	      eval soname=\"$soname_spec\"
2310	    else
2311	      soname="$realname"
2312	    fi
2313
2314	    # Make a new name for the extract_expsyms_cmds to use
2315	    soroot="$soname"
2316	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2317	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2318
2319	    # If the library has no export list, then create one now
2320	    if test -f "$output_objdir/$soname-def"; then :
2321	    else
2322	      $show "extracting exported symbol list from \`$soname'"
2323	      save_ifs="$IFS"; IFS='~'
2324	      eval cmds=\"$extract_expsyms_cmds\"
2325	      for cmd in $cmds; do
2326		IFS="$save_ifs"
2327		$show "$cmd"
2328		$run eval "$cmd" || exit $?
2329	      done
2330	      IFS="$save_ifs"
2331	    fi
2332
2333	    # Create $newlib
2334	    if test -f "$output_objdir/$newlib"; then :; else
2335	      $show "generating import library for \`$soname'"
2336	      save_ifs="$IFS"; IFS='~'
2337	      eval cmds=\"$old_archive_from_expsyms_cmds\"
2338	      for cmd in $cmds; do
2339		IFS="$save_ifs"
2340		$show "$cmd"
2341		$run eval "$cmd" || exit $?
2342	      done
2343	      IFS="$save_ifs"
2344	    fi
2345	    # make sure the library variables are pointing to the new library
2346	    dir=$output_objdir
2347	    linklib=$newlib
2348	  fi # test -n "$old_archive_from_expsyms_cmds"
2349
2350	  if test "$linkmode" = prog || test "$mode" != relink; then
2351	    add_shlibpath=
2352	    add_dir=
2353	    add=
2354	    lib_linked=yes
2355	    case $hardcode_action in
2356	    immediate | unsupported)
2357	      if test "$hardcode_direct" = no; then
2358		add="$dir/$linklib"
2359		case $host in
2360		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2361		  *-*-darwin* )
2362		    # if the lib is a module then we can not link against it, someone
2363		    # is ignoring the new warnings I added
2364		    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2365		      $echo "** Warning, lib $linklib is a module, not a shared library"
2366		      if test -z "$old_library" ; then
2367		        $echo
2368		        $echo "** And there doesn't seem to be a static archive available"
2369		        $echo "** The link will probably fail, sorry"
2370		      else
2371		        add="$dir/$old_library"
2372		      fi
2373		    fi
2374		esac
2375	      elif test "$hardcode_minus_L" = no; then
2376		case $host in
2377		*-*-sunos*) add_shlibpath="$dir" ;;
2378		esac
2379		add_dir="-L$dir"
2380		add="-l$name"
2381	      elif test "$hardcode_shlibpath_var" = no; then
2382		add_shlibpath="$dir"
2383		add="-l$name"
2384	      else
2385		lib_linked=no
2386	      fi
2387	      ;;
2388	    relink)
2389	      if test "$hardcode_direct" = yes; then
2390		add="$dir/$linklib"
2391	      elif test "$hardcode_minus_L" = yes; then
2392		add_dir="-L$dir"
2393		# Try looking first in the location we're being installed to.
2394		if test -n "$inst_prefix_dir"; then
2395		  case "$libdir" in
2396		    [\\/]*)
2397		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
2398		      ;;
2399		  esac
2400		fi
2401		add="-l$name"
2402	      elif test "$hardcode_shlibpath_var" = yes; then
2403		add_shlibpath="$dir"
2404		add="-l$name"
2405	      else
2406		lib_linked=no
2407	      fi
2408	      ;;
2409	    *) lib_linked=no ;;
2410	    esac
2411
2412	    if test "$lib_linked" != yes; then
2413	      $echo "$modename: configuration error: unsupported hardcode properties"
2414	      exit 1
2415	    fi
2416
2417	    if test -n "$add_shlibpath"; then
2418	      case :$compile_shlibpath: in
2419	      *":$add_shlibpath:"*) ;;
2420	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2421	      esac
2422	    fi
2423	    if test "$linkmode" = prog; then
2424	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2425	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
2426	    else
2427	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2428	      test -n "$add" && deplibs="$add $deplibs"
2429	      if test "$hardcode_direct" != yes && \
2430		 test "$hardcode_minus_L" != yes && \
2431		 test "$hardcode_shlibpath_var" = yes; then
2432		case :$finalize_shlibpath: in
2433		*":$libdir:"*) ;;
2434		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2435		esac
2436	      fi
2437	    fi
2438	  fi
2439
2440	  if test "$linkmode" = prog || test "$mode" = relink; then
2441	    add_shlibpath=
2442	    add_dir=
2443	    add=
2444	    # Finalize command for both is simple: just hardcode it.
2445	    if test "$hardcode_direct" = yes; then
2446	      add="$libdir/$linklib"
2447	    elif test "$hardcode_minus_L" = yes; then
2448	      add_dir="-L$libdir"
2449	      add="-l$name"
2450	    elif test "$hardcode_shlibpath_var" = yes; then
2451	      case :$finalize_shlibpath: in
2452	      *":$libdir:"*) ;;
2453	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2454	      esac
2455	      add="-l$name"
2456	    elif test "$hardcode_automatic" = yes; then
2457	      if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2458	        add="$inst_prefix_dir$libdir/$linklib"
2459	      else
2460	        add="$libdir/$linklib"
2461	      fi
2462	    else
2463	      # We cannot seem to hardcode it, guess we'll fake it.
2464	      add_dir="-L$libdir"
2465	      # Try looking first in the location we're being installed to.
2466	      if test -n "$inst_prefix_dir"; then
2467		case "$libdir" in
2468		  [\\/]*)
2469		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
2470		    ;;
2471		esac
2472	      fi
2473	      add="-l$name"
2474	    fi
2475
2476	    if test "$linkmode" = prog; then
2477	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2478	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2479	    else
2480	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2481	      test -n "$add" && deplibs="$add $deplibs"
2482	    fi
2483	  fi
2484	elif test "$linkmode" = prog; then
2485	  # Here we assume that one of hardcode_direct or hardcode_minus_L
2486	  # is not unsupported.  This is valid on all known static and
2487	  # shared platforms.
2488	  if test "$hardcode_direct" != unsupported; then
2489	    test -n "$old_library" && linklib="$old_library"
2490	    compile_deplibs="$dir/$linklib $compile_deplibs"
2491	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
2492	  else
2493	    compile_deplibs="-l$name -L$dir $compile_deplibs"
2494	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2495	  fi
2496	elif test "$build_libtool_libs" = yes; then
2497	  # Not a shared library
2498	  if test "$deplibs_check_method" != pass_all; then
2499	    # We're trying link a shared library against a static one
2500	    # but the system doesn't support it.
2501
2502	    # Just print a warning and add the library to dependency_libs so
2503	    # that the program can be linked against the static library.
2504	    $echo
2505	    $echo "*** Warning: This system can not link to static lib archive $lib."
2506	    $echo "*** I have the capability to make that library automatically link in when"
2507	    $echo "*** you link to this library.  But I can only do this if you have a"
2508	    $echo "*** shared version of the library, which you do not appear to have."
2509	    if test "$module" = yes; then
2510	      $echo "*** But as you try to build a module library, libtool will still create "
2511	      $echo "*** a static module, that should work as long as the dlopening application"
2512	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2513	      if test -z "$global_symbol_pipe"; then
2514		$echo
2515		$echo "*** However, this would only work if libtool was able to extract symbol"
2516		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2517		$echo "*** not find such a program.  So, this module is probably useless."
2518		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2519	      fi
2520	      if test "$build_old_libs" = no; then
2521		build_libtool_libs=module
2522		build_old_libs=yes
2523	      else
2524		build_libtool_libs=no
2525	      fi
2526	    fi
2527	  else
2528	    convenience="$convenience $dir/$old_library"
2529	    old_convenience="$old_convenience $dir/$old_library"
2530	    deplibs="$dir/$old_library $deplibs"
2531	    link_static=yes
2532	  fi
2533	fi # link shared/static library?
2534
2535	if test "$linkmode" = lib; then
2536	  if test -n "$dependency_libs" &&
2537	     { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2538	       test "$link_static" = yes; }; then
2539	    # Extract -R from dependency_libs
2540	    temp_deplibs=
2541	    for libdir in $dependency_libs; do
2542	      case $libdir in
2543	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2544		   case " $xrpath " in
2545		   *" $temp_xrpath "*) ;;
2546		   *) xrpath="$xrpath $temp_xrpath";;
2547		   esac;;
2548	      *) temp_deplibs="$temp_deplibs $libdir";;
2549	      esac
2550	    done
2551	    dependency_libs="$temp_deplibs"
2552	  fi
2553
2554	  newlib_search_path="$newlib_search_path $absdir"
2555	  # Link against this library
2556	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2557	  # ... and its dependency_libs
2558	  tmp_libs=
2559	  for deplib in $dependency_libs; do
2560	    newdependency_libs="$deplib $newdependency_libs"
2561	    if test "X$duplicate_deps" = "Xyes" ; then
2562	      case "$tmp_libs " in
2563	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2564	      esac
2565	    fi
2566	    tmp_libs="$tmp_libs $deplib"
2567	  done
2568
2569	  if test "$link_all_deplibs" != no; then
2570	    # Add the search paths of all dependency libraries
2571	    for deplib in $dependency_libs; do
2572	      case $deplib in
2573	      -L*) path="$deplib" ;;
2574	      *.la)
2575		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2576		test "X$dir" = "X$deplib" && dir="."
2577		# We need an absolute path.
2578		case $dir in
2579		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2580		*)
2581		  absdir=`cd "$dir" && pwd`
2582		  if test -z "$absdir"; then
2583		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2584		    absdir="$dir"
2585		  fi
2586		  ;;
2587		esac
2588		if grep "^installed=no" $deplib > /dev/null; then
2589		  path="$absdir/$objdir"
2590		else
2591		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2592		  if test -z "$libdir"; then
2593		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2594		    exit 1
2595		  fi
2596		  if test "$absdir" != "$libdir"; then
2597		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2598		  fi
2599		  path="$absdir"
2600		fi
2601		depdepl=
2602		case $host in
2603		*-*-darwin*)
2604		  # we do not want to link against static libs, but need to link against shared
2605		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2606		  if test -n "$deplibrary_names" ; then
2607		    for tmp in $deplibrary_names ; do
2608		      depdepl=$tmp
2609		    done
2610		    if test -f "$path/$depdepl" ; then
2611		      depdepl="$path/$depdepl"
2612		   fi
2613		    # do not add paths which are already there
2614		    case " $newlib_search_path " in
2615		    *" $path "*) ;;
2616		    *) newlib_search_path="$newlib_search_path $path";;
2617		    esac
2618		    path=""
2619		  fi
2620		  ;;
2621		*)
2622		path="-L$path"
2623		;;
2624		esac
2625
2626		;;
2627		  -l*)
2628		case $host in
2629		*-*-darwin*)
2630		 # Again, we only want to link against shared libraries
2631		 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2632		 for tmp in $newlib_search_path ; do
2633		     if test -f "$tmp/lib$tmp_libs.dylib" ; then
2634		       eval depdepl="$tmp/lib$tmp_libs.dylib"
2635		       break
2636		     fi
2637         done
2638         path=""
2639		  ;;
2640		*) continue ;;
2641		esac
2642		;;
2643	      *) continue ;;
2644	      esac
2645	      case " $deplibs " in
2646	      *" $depdepl "*) ;;
2647	      *) deplibs="$deplibs $depdepl" ;;
2648	      esac
2649	      case " $deplibs " in
2650	      *" $path "*) ;;
2651	      *) deplibs="$deplibs $path" ;;
2652	      esac
2653	    done
2654	  fi # link_all_deplibs != no
2655	fi # linkmode = lib
2656      done # for deplib in $libs
2657      dependency_libs="$newdependency_libs"
2658      if test "$pass" = dlpreopen; then
2659	# Link the dlpreopened libraries before other libraries
2660	for deplib in $save_deplibs; do
2661	  deplibs="$deplib $deplibs"
2662	done
2663      fi
2664      if test "$pass" != dlopen; then
2665	if test "$pass" != conv; then
2666	  # Make sure lib_search_path contains only unique directories.
2667	  lib_search_path=
2668	  for dir in $newlib_search_path; do
2669	    case "$lib_search_path " in
2670	    *" $dir "*) ;;
2671	    *) lib_search_path="$lib_search_path $dir" ;;
2672	    esac
2673	  done
2674	  newlib_search_path=
2675	fi
2676
2677	if test "$linkmode,$pass" != "prog,link"; then
2678	  vars="deplibs"
2679	else
2680	  vars="compile_deplibs finalize_deplibs"
2681	fi
2682	for var in $vars dependency_libs; do
2683	  # Add libraries to $var in reverse order
2684	  eval tmp_libs=\"\$$var\"
2685	  new_libs=
2686	  for deplib in $tmp_libs; do
2687	    # FIXME: Pedantically, this is the right thing to do, so
2688	    #        that some nasty dependency loop isn't accidentally
2689	    #        broken:
2690	    #new_libs="$deplib $new_libs"
2691	    # Pragmatically, this seems to cause very few problems in
2692	    # practice:
2693	    case $deplib in
2694	    -L*) new_libs="$deplib $new_libs" ;;
2695	    -R*) ;;
2696	    *)
2697	      # And here is the reason: when a library appears more
2698	      # than once as an explicit dependence of a library, or
2699	      # is implicitly linked in more than once by the
2700	      # compiler, it is considered special, and multiple
2701	      # occurrences thereof are not removed.  Compare this
2702	      # with having the same library being listed as a
2703	      # dependency of multiple other libraries: in this case,
2704	      # we know (pedantically, we assume) the library does not
2705	      # need to be listed more than once, so we keep only the
2706	      # last copy.  This is not always right, but it is rare
2707	      # enough that we require users that really mean to play
2708	      # such unportable linking tricks to link the library
2709	      # using -Wl,-lname, so that libtool does not consider it
2710	      # for duplicate removal.
2711	      case " $specialdeplibs " in
2712	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
2713	      *)
2714		case " $new_libs " in
2715		*" $deplib "*) ;;
2716		*) new_libs="$deplib $new_libs" ;;
2717		esac
2718		;;
2719	      esac
2720	      ;;
2721	    esac
2722	  done
2723	  tmp_libs=
2724	  for deplib in $new_libs; do
2725	    case $deplib in
2726	    -L*)
2727	      case " $tmp_libs " in
2728	      *" $deplib "*) ;;
2729	      *) tmp_libs="$tmp_libs $deplib" ;;
2730	      esac
2731	      ;;
2732	    *) tmp_libs="$tmp_libs $deplib" ;;
2733	    esac
2734	  done
2735	  eval $var=\"$tmp_libs\"
2736	done # for var
2737      fi
2738      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2739      tmp_libs=
2740      for i in $dependency_libs ; do
2741	case " $predeps $postdeps $compiler_lib_search_path " in
2742	*" $i "*)
2743	  i=""
2744	  ;;
2745	esac
2746	if test -n "$i" ; then
2747	  tmp_libs="$tmp_libs $i"
2748	fi
2749      done
2750      dependency_libs=$tmp_libs
2751    done # for pass
2752    if test "$linkmode" = prog; then
2753      dlfiles="$newdlfiles"
2754      dlprefiles="$newdlprefiles"
2755    fi
2756
2757    case $linkmode in
2758    oldlib)
2759      if test -n "$deplibs"; then
2760	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2761      fi
2762
2763      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2764	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2765      fi
2766
2767      if test -n "$rpath"; then
2768	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2769      fi
2770
2771      if test -n "$xrpath"; then
2772	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2773      fi
2774
2775      if test -n "$vinfo"; then
2776	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2777      fi
2778
2779      if test -n "$release"; then
2780	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2781      fi
2782
2783      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2784	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2785      fi
2786
2787      # Now set the variables for building old libraries.
2788      build_libtool_libs=no
2789      oldlibs="$output"
2790      objs="$objs$old_deplibs"
2791      ;;
2792
2793    lib)
2794      # Make sure we only generate libraries of the form `libNAME.la'.
2795      case $outputname in
2796      lib*)
2797	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2798	eval shared_ext=\"$shrext\"
2799	eval libname=\"$libname_spec\"
2800	;;
2801      *)
2802	if test "$module" = no; then
2803	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2804	  $echo "$help" 1>&2
2805	  exit 1
2806	fi
2807	if test "$need_lib_prefix" != no; then
2808	  # Add the "lib" prefix for modules if required
2809	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2810	  eval shared_ext=\"$shrext\"
2811	  eval libname=\"$libname_spec\"
2812	else
2813	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2814	fi
2815	;;
2816      esac
2817
2818      if test -n "$objs"; then
2819	if test "$deplibs_check_method" != pass_all; then
2820	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2821	  exit 1
2822	else
2823	  $echo
2824	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
2825	  $echo "*** objects $objs is not portable!"
2826	  libobjs="$libobjs $objs"
2827	fi
2828      fi
2829
2830      if test "$dlself" != no; then
2831	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2832      fi
2833
2834      set dummy $rpath
2835      if test "$#" -gt 2; then
2836	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2837      fi
2838      install_libdir="$2"
2839
2840      oldlibs=
2841      if test -z "$rpath"; then
2842	if test "$build_libtool_libs" = yes; then
2843	  # Building a libtool convenience library.
2844	  # Some compilers have problems with a `.al' extension so
2845	  # convenience libraries should have the same extension an
2846	  # archive normally would.
2847	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
2848	  build_libtool_libs=convenience
2849	  build_old_libs=yes
2850	fi
2851
2852	if test -n "$vinfo"; then
2853	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2854	fi
2855
2856	if test -n "$release"; then
2857	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2858	fi
2859      else
2860
2861	# Parse the version information argument.
2862	save_ifs="$IFS"; IFS=':'
2863	set dummy $vinfo 0 0 0
2864	IFS="$save_ifs"
2865
2866	if test -n "$8"; then
2867	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
2868	  $echo "$help" 1>&2
2869	  exit 1
2870	fi
2871
2872	# convert absolute version numbers to libtool ages
2873	# this retains compatibility with .la files and attempts
2874	# to make the code below a bit more comprehensible
2875
2876	case $vinfo_number in
2877	yes)
2878	  number_major="$2"
2879	  number_minor="$3"
2880	  number_revision="$4"
2881	  #
2882	  # There are really only two kinds -- those that
2883	  # use the current revision as the major version
2884	  # and those that subtract age and use age as
2885	  # a minor version.  But, then there is irix
2886	  # which has an extra 1 added just for fun
2887	  #
2888	  case $version_type in
2889	  darwin|linux|osf|windows)
2890	    current=`expr $number_major + $number_minor`
2891	    age="$number_minor"
2892	    revision="$number_revision"
2893	    ;;
2894	  freebsd-aout|freebsd-elf|sunos)
2895	    current="$number_major"
2896	    revision="$number_minor"
2897	    age="0"
2898	    ;;
2899	  irix|nonstopux)
2900	    current=`expr $number_major + $number_minor - 1`
2901	    age="$number_minor"
2902	    revision="$number_minor"
2903	    ;;
2904	  esac
2905	  ;;
2906	no)
2907	  current="$2"
2908	  revision="$3"
2909	  age="$4"
2910	  ;;
2911	esac
2912
2913	# Check that each of the things are valid numbers.
2914	case $current in
2915	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2916	*)
2917	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2918	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2919	  exit 1
2920	  ;;
2921	esac
2922
2923	case $revision in
2924	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2925	*)
2926	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2927	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2928	  exit 1
2929	  ;;
2930	esac
2931
2932	case $age in
2933	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2934	*)
2935	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2936	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2937	  exit 1
2938	  ;;
2939	esac
2940
2941	if test "$age" -gt "$current"; then
2942	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2943	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2944	  exit 1
2945	fi
2946
2947	# Calculate the version variables.
2948	major=
2949	versuffix=
2950	verstring=
2951	case $version_type in
2952	none) ;;
2953
2954	darwin)
2955	  # Like Linux, but with the current version available in
2956	  # verstring for coding it into the library header
2957	  major=.`expr $current - $age`
2958	  versuffix="$major.$age.$revision"
2959	  # Darwin ld doesn't like 0 for these options...
2960	  minor_current=`expr $current + 1`
2961	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2962	  ;;
2963
2964	freebsd-aout)
2965	  major=".$current"
2966	  versuffix=".$current.$revision";
2967	  ;;
2968
2969	freebsd-elf)
2970	  major=".$current"
2971	  versuffix=".$current";
2972	  ;;
2973
2974	irix | nonstopux)
2975	  major=`expr $current - $age + 1`
2976
2977	  case $version_type in
2978	    nonstopux) verstring_prefix=nonstopux ;;
2979	    *)         verstring_prefix=sgi ;;
2980	  esac
2981	  verstring="$verstring_prefix$major.$revision"
2982
2983	  # Add in all the interfaces that we are compatible with.
2984	  loop=$revision
2985	  while test "$loop" -ne 0; do
2986	    iface=`expr $revision - $loop`
2987	    loop=`expr $loop - 1`
2988	    verstring="$verstring_prefix$major.$iface:$verstring"
2989	  done
2990
2991	  # Before this point, $major must not contain `.'.
2992	  major=.$major
2993	  versuffix="$major.$revision"
2994	  ;;
2995
2996	linux)
2997	  major=.`expr $current - $age`
2998	  versuffix="$major.$age.$revision"
2999	  ;;
3000
3001	osf)
3002	  major=.`expr $current - $age`
3003	  versuffix=".$current.$age.$revision"
3004	  verstring="$current.$age.$revision"
3005
3006	  # Add in all the interfaces that we are compatible with.
3007	  loop=$age
3008	  while test "$loop" -ne 0; do
3009	    iface=`expr $current - $loop`
3010	    loop=`expr $loop - 1`
3011	    verstring="$verstring:${iface}.0"
3012	  done
3013
3014	  # Make executables depend on our current version.
3015	  verstring="$verstring:${current}.0"
3016	  ;;
3017
3018	sunos)
3019	  major=".$current"
3020	  versuffix=".$current.$revision"
3021	  ;;
3022
3023	windows)
3024	  # Use '-' rather than '.', since we only want one
3025	  # extension on DOS 8.3 filesystems.
3026	  major=`expr $current - $age`
3027	  versuffix="-$major"
3028	  ;;
3029
3030	*)
3031	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
3032	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3033	  exit 1
3034	  ;;
3035	esac
3036
3037	# Clear the version info if we defaulted, and they specified a release.
3038	if test -z "$vinfo" && test -n "$release"; then
3039	  major=
3040	  case $version_type in
3041	  darwin)
3042	    # we can't check for "0.0" in archive_cmds due to quoting
3043	    # problems, so we reset it completely
3044	    verstring=
3045	    ;;
3046	  *)
3047	    verstring="0.0"
3048	    ;;
3049	  esac
3050	  if test "$need_version" = no; then
3051	    versuffix=
3052	  else
3053	    versuffix=".0.0"
3054	  fi
3055	fi
3056
3057	# Remove version info from name if versioning should be avoided
3058	if test "$avoid_version" = yes && test "$need_version" = no; then
3059	  major=
3060	  versuffix=
3061	  verstring=""
3062	fi
3063
3064	# Check to see if the archive will have undefined symbols.
3065	if test "$allow_undefined" = yes; then
3066	  if test "$allow_undefined_flag" = unsupported; then
3067	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3068	    build_libtool_libs=no
3069	    build_old_libs=yes
3070	  fi
3071	else
3072	  # Don't allow undefined symbols.
3073	  allow_undefined_flag="$no_undefined_flag"
3074	fi
3075      fi
3076
3077      if test "$mode" != relink; then
3078	# Remove our outputs, but don't remove object files since they
3079	# may have been created when compiling PIC objects.
3080	removelist=
3081	tempremovelist=`$echo "$output_objdir/*"`
3082	for p in $tempremovelist; do
3083	  case $p in
3084	    *.$objext)
3085	       ;;
3086	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3087	       removelist="$removelist $p"
3088	       ;;
3089	    *) ;;
3090	  esac
3091	done
3092	if test -n "$removelist"; then
3093	  $show "${rm}r $removelist"
3094	  $run ${rm}r $removelist
3095	fi
3096      fi
3097
3098      # Now set the variables for building old libraries.
3099      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3100	oldlibs="$oldlibs $output_objdir/$libname.$libext"
3101
3102	# Transform .lo files to .o files.
3103	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3104      fi
3105
3106      # Eliminate all temporary directories.
3107      for path in $notinst_path; do
3108	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3109	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3110	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3111      done
3112
3113      if test -n "$xrpath"; then
3114	# If the user specified any rpath flags, then add them.
3115	temp_xrpath=
3116	for libdir in $xrpath; do
3117	  temp_xrpath="$temp_xrpath -R$libdir"
3118	  case "$finalize_rpath " in
3119	  *" $libdir "*) ;;
3120	  *) finalize_rpath="$finalize_rpath $libdir" ;;
3121	  esac
3122	done
3123	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3124	  dependency_libs="$temp_xrpath $dependency_libs"
3125	fi
3126      fi
3127
3128      # Make sure dlfiles contains only unique files that won't be dlpreopened
3129      old_dlfiles="$dlfiles"
3130      dlfiles=
3131      for lib in $old_dlfiles; do
3132	case " $dlprefiles $dlfiles " in
3133	*" $lib "*) ;;
3134	*) dlfiles="$dlfiles $lib" ;;
3135	esac
3136      done
3137
3138      # Make sure dlprefiles contains only unique files
3139      old_dlprefiles="$dlprefiles"
3140      dlprefiles=
3141      for lib in $old_dlprefiles; do
3142	case "$dlprefiles " in
3143	*" $lib "*) ;;
3144	*) dlprefiles="$dlprefiles $lib" ;;
3145	esac
3146      done
3147
3148      if test "$build_libtool_libs" = yes; then
3149	if test -n "$rpath"; then
3150	  case $host in
3151	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3152	    # these systems don't actually have a c library (as such)!
3153	    ;;
3154	  *-*-rhapsody* | *-*-darwin1.[012])
3155	    # Rhapsody C library is in the System framework
3156	    deplibs="$deplibs -framework System"
3157	    ;;
3158	  *-*-netbsd*)
3159	    # Don't link with libc until the a.out ld.so is fixed.
3160	    ;;
3161	  *-*-openbsd* | *-*-freebsd*)
3162	    # Do not include libc due to us having libc/libc_r.
3163	    test "X$arg" = "X-lc" && continue
3164	    ;;
3165 	  *)
3166	    # Add libc to deplibs on all other systems if necessary.
3167	    if test "$build_libtool_need_lc" = "yes"; then
3168	      deplibs="$deplibs -lc"
3169	    fi
3170	    ;;
3171	  esac
3172	fi
3173
3174	# Transform deplibs into only deplibs that can be linked in shared.
3175	name_save=$name
3176	libname_save=$libname
3177	release_save=$release
3178	versuffix_save=$versuffix
3179	major_save=$major
3180	# I'm not sure if I'm treating the release correctly.  I think
3181	# release should show up in the -l (ie -lgmp5) so we don't want to
3182	# add it in twice.  Is that correct?
3183	release=""
3184	versuffix=""
3185	major=""
3186	newdeplibs=
3187	droppeddeps=no
3188	case $deplibs_check_method in
3189	pass_all)
3190	  # Don't check for shared/static.  Everything works.
3191	  # This might be a little naive.  We might want to check
3192	  # whether the library exists or not.  But this is on
3193	  # osf3 & osf4 and I'm not really sure... Just
3194	  # implementing what was already the behavior.
3195	  newdeplibs=$deplibs
3196	  ;;
3197	test_compile)
3198	  # This code stresses the "libraries are programs" paradigm to its
3199	  # limits. Maybe even breaks it.  We compile a program, linking it
3200	  # against the deplibs as a proxy for the library.  Then we can check
3201	  # whether they linked in statically or dynamically with ldd.
3202	  $rm conftest.c
3203	  cat > conftest.c <<EOF
3204	  int main() { return 0; }
3205EOF
3206	  $rm conftest
3207	  $LTCC -o conftest conftest.c $deplibs
3208	  if test "$?" -eq 0 ; then
3209	    ldd_output=`ldd conftest`
3210	    for i in $deplibs; do
3211	      name="`expr $i : '-l\(.*\)'`"
3212	      # If $name is empty we are operating on a -L argument.
3213              if test "$name" != "" && test "$name" -ne "0"; then
3214		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3215		  case " $predeps $postdeps " in
3216		  *" $i "*)
3217		    newdeplibs="$newdeplibs $i"
3218		    i=""
3219		    ;;
3220		  esac
3221	        fi
3222		if test -n "$i" ; then
3223		  libname=`eval \\$echo \"$libname_spec\"`
3224		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
3225		  set dummy $deplib_matches
3226		  deplib_match=$2
3227		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3228		    newdeplibs="$newdeplibs $i"
3229		  else
3230		    droppeddeps=yes
3231		    $echo
3232		    $echo "*** Warning: dynamic linker does not accept needed library $i."
3233		    $echo "*** I have the capability to make that library automatically link in when"
3234		    $echo "*** you link to this library.  But I can only do this if you have a"
3235		    $echo "*** shared version of the library, which I believe you do not have"
3236		    $echo "*** because a test_compile did reveal that the linker did not use it for"
3237		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3238		  fi
3239		fi
3240	      else
3241		newdeplibs="$newdeplibs $i"
3242	      fi
3243	    done
3244	  else
3245	    # Error occurred in the first compile.  Let's try to salvage
3246	    # the situation: Compile a separate program for each library.
3247	    for i in $deplibs; do
3248	      name="`expr $i : '-l\(.*\)'`"
3249	      # If $name is empty we are operating on a -L argument.
3250              if test "$name" != "" && test "$name" != "0"; then
3251		$rm conftest
3252		$LTCC -o conftest conftest.c $i
3253		# Did it work?
3254		if test "$?" -eq 0 ; then
3255		  ldd_output=`ldd conftest`
3256		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3257		    case " $predeps $postdeps " in
3258		    *" $i "*)
3259		      newdeplibs="$newdeplibs $i"
3260		      i=""
3261		      ;;
3262		    esac
3263		  fi
3264		  if test -n "$i" ; then
3265		    libname=`eval \\$echo \"$libname_spec\"`
3266		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3267		    set dummy $deplib_matches
3268		    deplib_match=$2
3269		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3270		      newdeplibs="$newdeplibs $i"
3271		    else
3272		      droppeddeps=yes
3273		      $echo
3274		      $echo "*** Warning: dynamic linker does not accept needed library $i."
3275		      $echo "*** I have the capability to make that library automatically link in when"
3276		      $echo "*** you link to this library.  But I can only do this if you have a"
3277		      $echo "*** shared version of the library, which you do not appear to have"
3278		      $echo "*** because a test_compile did reveal that the linker did not use this one"
3279		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3280		    fi
3281		  fi
3282		else
3283		  droppeddeps=yes
3284		  $echo
3285		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3286		  $echo "***  make it link in!  You will probably need to install it or some"
3287		  $echo "*** library that it depends on before this library will be fully"
3288		  $echo "*** functional.  Installing it before continuing would be even better."
3289		fi
3290	      else
3291		newdeplibs="$newdeplibs $i"
3292	      fi
3293	    done
3294	  fi
3295	  ;;
3296	file_magic*)
3297	  set dummy $deplibs_check_method
3298	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3299	  for a_deplib in $deplibs; do
3300	    name="`expr $a_deplib : '-l\(.*\)'`"
3301	    # If $name is empty we are operating on a -L argument.
3302            if test "$name" != "" && test  "$name" != "0"; then
3303	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3304		case " $predeps $postdeps " in
3305		*" $a_deplib "*)
3306		  newdeplibs="$newdeplibs $a_deplib"
3307		  a_deplib=""
3308		  ;;
3309		esac
3310	      fi
3311	      if test -n "$a_deplib" ; then
3312		libname=`eval \\$echo \"$libname_spec\"`
3313		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3314		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3315		  for potent_lib in $potential_libs; do
3316		      # Follow soft links.
3317		      if ls -lLd "$potent_lib" 2>/dev/null \
3318			 | grep " -> " >/dev/null; then
3319			continue
3320		      fi
3321		      # The statement above tries to avoid entering an
3322		      # endless loop below, in case of cyclic links.
3323		      # We might still enter an endless loop, since a link
3324		      # loop can be closed while we follow links,
3325		      # but so what?
3326		      potlib="$potent_lib"
3327		      while test -h "$potlib" 2>/dev/null; do
3328			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3329			case $potliblink in
3330			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3331			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3332			esac
3333		      done
3334		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3335			 | ${SED} 10q \
3336			 | $EGREP "$file_magic_regex" > /dev/null; then
3337			newdeplibs="$newdeplibs $a_deplib"
3338			a_deplib=""
3339			break 2
3340		      fi
3341		  done
3342		done
3343	      fi
3344	      if test -n "$a_deplib" ; then
3345		droppeddeps=yes
3346		$echo
3347		$echo "*** Warning: linker path does not have real file for library $a_deplib."
3348		$echo "*** I have the capability to make that library automatically link in when"
3349		$echo "*** you link to this library.  But I can only do this if you have a"
3350		$echo "*** shared version of the library, which you do not appear to have"
3351		$echo "*** because I did check the linker path looking for a file starting"
3352		if test -z "$potlib" ; then
3353		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
3354		else
3355		  $echo "*** with $libname and none of the candidates passed a file format test"
3356		  $echo "*** using a file magic. Last file checked: $potlib"
3357		fi
3358	      fi
3359	    else
3360	      # Add a -L argument.
3361	      newdeplibs="$newdeplibs $a_deplib"
3362	    fi
3363	  done # Gone through all deplibs.
3364	  ;;
3365	match_pattern*)
3366	  set dummy $deplibs_check_method
3367	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3368	  for a_deplib in $deplibs; do
3369	    name="`expr $a_deplib : '-l\(.*\)'`"
3370	    # If $name is empty we are operating on a -L argument.
3371	    if test -n "$name" && test "$name" != "0"; then
3372	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3373		case " $predeps $postdeps " in
3374		*" $a_deplib "*)
3375		  newdeplibs="$newdeplibs $a_deplib"
3376		  a_deplib=""
3377		  ;;
3378		esac
3379	      fi
3380	      if test -n "$a_deplib" ; then
3381		libname=`eval \\$echo \"$libname_spec\"`
3382		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3383		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3384		  for potent_lib in $potential_libs; do
3385		    potlib="$potent_lib" # see symlink-check above in file_magic test
3386		    if eval $echo \"$potent_lib\" 2>/dev/null \
3387		        | ${SED} 10q \
3388		        | $EGREP "$match_pattern_regex" > /dev/null; then
3389		      newdeplibs="$newdeplibs $a_deplib"
3390		      a_deplib=""
3391		      break 2
3392		    fi
3393		  done
3394		done
3395	      fi
3396	      if test -n "$a_deplib" ; then
3397		droppeddeps=yes
3398		$echo
3399		$echo "*** Warning: linker path does not have real file for library $a_deplib."
3400		$echo "*** I have the capability to make that library automatically link in when"
3401		$echo "*** you link to this library.  But I can only do this if you have a"
3402		$echo "*** shared version of the library, which you do not appear to have"
3403		$echo "*** because I did check the linker path looking for a file starting"
3404		if test -z "$potlib" ; then
3405		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3406		else
3407		  $echo "*** with $libname and none of the candidates passed a file format test"
3408		  $echo "*** using a regex pattern. Last file checked: $potlib"
3409		fi
3410	      fi
3411	    else
3412	      # Add a -L argument.
3413	      newdeplibs="$newdeplibs $a_deplib"
3414	    fi
3415	  done # Gone through all deplibs.
3416	  ;;
3417	none | unknown | *)
3418	  newdeplibs=""
3419	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3420	    -e 's/ -[LR][^ ]*//g'`
3421	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3422	    for i in $predeps $postdeps ; do
3423	      # can't use Xsed below, because $i might contain '/'
3424	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3425	    done
3426	  fi
3427	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
3428	    | grep . >/dev/null; then
3429	    $echo
3430	    if test "X$deplibs_check_method" = "Xnone"; then
3431	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
3432	    else
3433	      $echo "*** Warning: inter-library dependencies are not known to be supported."
3434	    fi
3435	    $echo "*** All declared inter-library dependencies are being dropped."
3436	    droppeddeps=yes
3437	  fi
3438	  ;;
3439	esac
3440	versuffix=$versuffix_save
3441	major=$major_save
3442	release=$release_save
3443	libname=$libname_save
3444	name=$name_save
3445
3446	case $host in
3447	*-*-rhapsody* | *-*-darwin1.[012])
3448	  # On Rhapsody replace the C library is the System framework
3449	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
3450	  ;;
3451	esac
3452
3453	if test "$droppeddeps" = yes; then
3454	  if test "$module" = yes; then
3455	    $echo
3456	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
3457	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3458	    $echo "*** a static module, that should work as long as the dlopening"
3459	    $echo "*** application is linked with the -dlopen flag."
3460	    if test -z "$global_symbol_pipe"; then
3461	      $echo
3462	      $echo "*** However, this would only work if libtool was able to extract symbol"
3463	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3464	      $echo "*** not find such a program.  So, this module is probably useless."
3465	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3466	    fi
3467	    if test "$build_old_libs" = no; then
3468	      oldlibs="$output_objdir/$libname.$libext"
3469	      build_libtool_libs=module
3470	      build_old_libs=yes
3471	    else
3472	      build_libtool_libs=no
3473	    fi
3474	  else
3475	    $echo "*** The inter-library dependencies that have been dropped here will be"
3476	    $echo "*** automatically added whenever a program is linked with this library"
3477	    $echo "*** or is declared to -dlopen it."
3478
3479	    if test "$allow_undefined" = no; then
3480	      $echo
3481	      $echo "*** Since this library must not contain undefined symbols,"
3482	      $echo "*** because either the platform does not support them or"
3483	      $echo "*** it was explicitly requested with -no-undefined,"
3484	      $echo "*** libtool will only create a static version of it."
3485	      if test "$build_old_libs" = no; then
3486		oldlibs="$output_objdir/$libname.$libext"
3487		build_libtool_libs=module
3488		build_old_libs=yes
3489	      else
3490		build_libtool_libs=no
3491	      fi
3492	    fi
3493	  fi
3494	fi
3495	# Done checking deplibs!
3496	deplibs=$newdeplibs
3497      fi
3498
3499      # All the library-specific variables (install_libdir is set above).
3500      library_names=
3501      old_library=
3502      dlname=
3503
3504      # Test again, we may have decided not to build it any more
3505      if test "$build_libtool_libs" = yes; then
3506	if test "$hardcode_into_libs" = yes; then
3507	  # Hardcode the library paths
3508	  hardcode_libdirs=
3509	  dep_rpath=
3510	  rpath="$finalize_rpath"
3511	  test "$mode" != relink && rpath="$compile_rpath$rpath"
3512	  for libdir in $rpath; do
3513	    if test -n "$hardcode_libdir_flag_spec"; then
3514	      if test -n "$hardcode_libdir_separator"; then
3515		if test -z "$hardcode_libdirs"; then
3516		  hardcode_libdirs="$libdir"
3517		else
3518		  # Just accumulate the unique libdirs.
3519		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3520		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3521		    ;;
3522		  *)
3523		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3524		    ;;
3525		  esac
3526		fi
3527	      else
3528		eval flag=\"$hardcode_libdir_flag_spec\"
3529		dep_rpath="$dep_rpath $flag"
3530	      fi
3531	    elif test -n "$runpath_var"; then
3532	      case "$perm_rpath " in
3533	      *" $libdir "*) ;;
3534	      *) perm_rpath="$perm_rpath $libdir" ;;
3535	      esac
3536	    fi
3537	  done
3538	  # Substitute the hardcoded libdirs into the rpath.
3539	  if test -n "$hardcode_libdir_separator" &&
3540	     test -n "$hardcode_libdirs"; then
3541	    libdir="$hardcode_libdirs"
3542	    if test -n "$hardcode_libdir_flag_spec_ld"; then
3543	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3544	    else
3545	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3546	    fi
3547	  fi
3548	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
3549	    # We should set the runpath_var.
3550	    rpath=
3551	    for dir in $perm_rpath; do
3552	      rpath="$rpath$dir:"
3553	    done
3554	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3555	  fi
3556	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3557	fi
3558
3559	shlibpath="$finalize_shlibpath"
3560	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3561	if test -n "$shlibpath"; then
3562	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3563	fi
3564
3565	# Get the real and link names of the library.
3566	eval shared_ext=\"$shrext\"
3567	eval library_names=\"$library_names_spec\"
3568	set dummy $library_names
3569	realname="$2"
3570	shift; shift
3571
3572	if test -n "$soname_spec"; then
3573	  eval soname=\"$soname_spec\"
3574	else
3575	  soname="$realname"
3576	fi
3577	if test -z "$dlname"; then
3578	  dlname=$soname
3579	fi
3580
3581	lib="$output_objdir/$realname"
3582	for link
3583	do
3584	  linknames="$linknames $link"
3585	done
3586
3587	# Use standard objects if they are pic
3588	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3589
3590	# Prepare the list of exported symbols
3591	if test -z "$export_symbols"; then
3592	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3593	    $show "generating symbol list for \`$libname.la'"
3594	    export_symbols="$output_objdir/$libname.exp"
3595	    $run $rm $export_symbols
3596	    eval cmds=\"$export_symbols_cmds\"
3597	    save_ifs="$IFS"; IFS='~'
3598	    for cmd in $cmds; do
3599	      IFS="$save_ifs"
3600	      if len=`expr "X$cmd" : ".*"` &&
3601	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3602	        $show "$cmd"
3603	        $run eval "$cmd" || exit $?
3604	        skipped_export=false
3605	      else
3606	        # The command line is too long to execute in one step.
3607	        $show "using reloadable object file for export list..."
3608	        skipped_export=:
3609	      fi
3610	    done
3611	    IFS="$save_ifs"
3612	    if test -n "$export_symbols_regex"; then
3613	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3614	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3615	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3616	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
3617	    fi
3618	  fi
3619	fi
3620
3621	if test -n "$export_symbols" && test -n "$include_expsyms"; then
3622	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3623	fi
3624
3625	tmp_deplibs=
3626	for test_deplib in $deplibs; do
3627		case " $convenience " in
3628		*" $test_deplib "*) ;;
3629		*)
3630			tmp_deplibs="$tmp_deplibs $test_deplib"
3631			;;
3632		esac
3633	done
3634	deplibs="$tmp_deplibs"
3635
3636	if test -n "$convenience"; then
3637	  if test -n "$whole_archive_flag_spec"; then
3638	    save_libobjs=$libobjs
3639	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3640	  else
3641	    gentop="$output_objdir/${outputname}x"
3642	    $show "${rm}r $gentop"
3643	    $run ${rm}r "$gentop"
3644	    $show "$mkdir $gentop"
3645	    $run $mkdir "$gentop"
3646	    status=$?
3647	    if test "$status" -ne 0 && test ! -d "$gentop"; then
3648	      exit $status
3649	    fi
3650	    generated="$generated $gentop"
3651
3652	    for xlib in $convenience; do
3653	      # Extract the objects.
3654	      case $xlib in
3655	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3656	      *) xabs=`pwd`"/$xlib" ;;
3657	      esac
3658	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3659	      xdir="$gentop/$xlib"
3660
3661	      $show "${rm}r $xdir"
3662	      $run ${rm}r "$xdir"
3663	      $show "$mkdir $xdir"
3664	      $run $mkdir "$xdir"
3665	      status=$?
3666	      if test "$status" -ne 0 && test ! -d "$xdir"; then
3667		exit $status
3668	      fi
3669	      # We will extract separately just the conflicting names and we will no
3670	      # longer touch any unique names. It is faster to leave these extract
3671	      # automatically by $AR in one run.
3672	      $show "(cd $xdir && $AR x $xabs)"
3673	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3674	      if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3675		:
3676	      else
3677		$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3678		$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3679		$AR t "$xabs" | sort | uniq -cd | while read -r count name
3680		do
3681		  i=1
3682		  while test "$i" -le "$count"
3683		  do
3684		   # Put our $i before any first dot (extension)
3685		   # Never overwrite any file
3686		   name_to="$name"
3687		   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3688		   do
3689		     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3690		   done
3691		   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3692		   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3693		   i=`expr $i + 1`
3694		  done
3695		done
3696	      fi
3697
3698	      libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3699	    done
3700	  fi
3701	fi
3702
3703	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3704	  eval flag=\"$thread_safe_flag_spec\"
3705	  linker_flags="$linker_flags $flag"
3706	fi
3707
3708	# Make a backup of the uninstalled library when relinking
3709	if test "$mode" = relink; then
3710	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3711	fi
3712
3713	# Do each of the archive commands.
3714	if test "$module" = yes && test -n "$module_cmds" ; then
3715	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3716	    eval cmds=\"$module_expsym_cmds\"
3717	  else
3718	    eval cmds=\"$module_cmds\"
3719	  fi
3720	else
3721	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3722	  eval cmds=\"$archive_expsym_cmds\"
3723	else
3724	  eval cmds=\"$archive_cmds\"
3725	  fi
3726	fi
3727
3728	if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
3729	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3730	  :
3731	else
3732	  # The command line is too long to link in one step, link piecewise.
3733	  $echo "creating reloadable object files..."
3734
3735	  # Save the value of $output and $libobjs because we want to
3736	  # use them later.  If we have whole_archive_flag_spec, we
3737	  # want to use save_libobjs as it was before
3738	  # whole_archive_flag_spec was expanded, because we can't
3739	  # assume the linker understands whole_archive_flag_spec.
3740	  # This may have to be revisited, in case too many
3741	  # convenience libraries get linked in and end up exceeding
3742	  # the spec.
3743	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3744	    save_libobjs=$libobjs
3745	  fi
3746	  save_output=$output
3747
3748	  # Clear the reloadable object creation command queue and
3749	  # initialize k to one.
3750	  test_cmds=
3751	  concat_cmds=
3752	  objlist=
3753	  delfiles=
3754	  last_robj=
3755	  k=1
3756	  output=$output_objdir/$save_output-${k}.$objext
3757	  # Loop over the list of objects to be linked.
3758	  for obj in $save_libobjs
3759	  do
3760	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3761	    if test "X$objlist" = X ||
3762	       { len=`expr "X$test_cmds" : ".*"` &&
3763		 test "$len" -le "$max_cmd_len"; }; then
3764	      objlist="$objlist $obj"
3765	    else
3766	      # The command $test_cmds is almost too long, add a
3767	      # command to the queue.
3768	      if test "$k" -eq 1 ; then
3769		# The first file doesn't have a previous command to add.
3770		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3771	      else
3772		# All subsequent reloadable object files will link in
3773		# the last one created.
3774		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3775	      fi
3776	      last_robj=$output_objdir/$save_output-${k}.$objext
3777	      k=`expr $k + 1`
3778	      output=$output_objdir/$save_output-${k}.$objext
3779	      objlist=$obj
3780	      len=1
3781	    fi
3782	  done
3783	  # Handle the remaining objects by creating one last
3784	  # reloadable object file.  All subsequent reloadable object
3785	  # files will link in the last one created.
3786	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3787	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3788
3789	  if ${skipped_export-false}; then
3790	    $show "generating symbol list for \`$libname.la'"
3791	    export_symbols="$output_objdir/$libname.exp"
3792	    $run $rm $export_symbols
3793	    libobjs=$output
3794	    # Append the command to create the export file.
3795	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3796          fi
3797
3798	  # Set up a command to remove the reloadale object files
3799	  # after they are used.
3800	  i=0
3801	  while test "$i" -lt "$k"
3802	  do
3803	    i=`expr $i + 1`
3804	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3805	  done
3806
3807	  $echo "creating a temporary reloadable object file: $output"
3808
3809	  # Loop through the commands generated above and execute them.
3810	  save_ifs="$IFS"; IFS='~'
3811	  for cmd in $concat_cmds; do
3812	    IFS="$save_ifs"
3813	    $show "$cmd"
3814	    $run eval "$cmd" || exit $?
3815	  done
3816	  IFS="$save_ifs"
3817
3818	  libobjs=$output
3819	  # Restore the value of output.
3820	  output=$save_output
3821
3822	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3823	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3824	  fi
3825	  # Expand the library linking commands again to reset the
3826	  # value of $libobjs for piecewise linking.
3827
3828	  # Do each of the archive commands.
3829	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3830	    eval cmds=\"$archive_expsym_cmds\"
3831	  else
3832	    eval cmds=\"$archive_cmds\"
3833	  fi
3834
3835	  # Append the command to remove the reloadable object files
3836	  # to the just-reset $cmds.
3837	  eval cmds=\"\$cmds~$rm $delfiles\"
3838	fi
3839	save_ifs="$IFS"; IFS='~'
3840	for cmd in $cmds; do
3841	  IFS="$save_ifs"
3842	  $show "$cmd"
3843	  $run eval "$cmd" || exit $?
3844	done
3845	IFS="$save_ifs"
3846
3847	# Restore the uninstalled library and exit
3848	if test "$mode" = relink; then
3849	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3850	  exit 0
3851	fi
3852
3853	# Create links to the real library.
3854	for linkname in $linknames; do
3855	  if test "$realname" != "$linkname"; then
3856	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3857	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3858	  fi
3859	done
3860
3861	# If -module or -export-dynamic was specified, set the dlname.
3862	if test "$module" = yes || test "$export_dynamic" = yes; then
3863	  # On all known operating systems, these are identical.
3864	  dlname="$soname"
3865	fi
3866      fi
3867      ;;
3868
3869    obj)
3870      if test -n "$deplibs"; then
3871	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3872      fi
3873
3874      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3875	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3876      fi
3877
3878      if test -n "$rpath"; then
3879	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3880      fi
3881
3882      if test -n "$xrpath"; then
3883	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3884      fi
3885
3886      if test -n "$vinfo"; then
3887	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3888      fi
3889
3890      if test -n "$release"; then
3891	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3892      fi
3893
3894      case $output in
3895      *.lo)
3896	if test -n "$objs$old_deplibs"; then
3897	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3898	  exit 1
3899	fi
3900	libobj="$output"
3901	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3902	;;
3903      *)
3904	libobj=
3905	obj="$output"
3906	;;
3907      esac
3908
3909      # Delete the old objects.
3910      $run $rm $obj $libobj
3911
3912      # Objects from convenience libraries.  This assumes
3913      # single-version convenience libraries.  Whenever we create
3914      # different ones for PIC/non-PIC, this we'll have to duplicate
3915      # the extraction.
3916      reload_conv_objs=
3917      gentop=
3918      # reload_cmds runs $LD directly, so let us get rid of
3919      # -Wl from whole_archive_flag_spec
3920      wl=
3921
3922      if test -n "$convenience"; then
3923	if test -n "$whole_archive_flag_spec"; then
3924	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3925	else
3926	  gentop="$output_objdir/${obj}x"
3927	  $show "${rm}r $gentop"
3928	  $run ${rm}r "$gentop"
3929	  $show "$mkdir $gentop"
3930	  $run $mkdir "$gentop"
3931	  status=$?
3932	  if test "$status" -ne 0 && test ! -d "$gentop"; then
3933	    exit $status
3934	  fi
3935	  generated="$generated $gentop"
3936
3937	  for xlib in $convenience; do
3938	    # Extract the objects.
3939	    case $xlib in
3940	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3941	    *) xabs=`pwd`"/$xlib" ;;
3942	    esac
3943	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3944	    xdir="$gentop/$xlib"
3945
3946	    $show "${rm}r $xdir"
3947	    $run ${rm}r "$xdir"
3948	    $show "$mkdir $xdir"
3949	    $run $mkdir "$xdir"
3950	    status=$?
3951	    if test "$status" -ne 0 && test ! -d "$xdir"; then
3952	      exit $status
3953	    fi
3954	    # We will extract separately just the conflicting names and we will no
3955	    # longer touch any unique names. It is faster to leave these extract
3956	    # automatically by $AR in one run.
3957	    $show "(cd $xdir && $AR x $xabs)"
3958	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3959	    if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3960	      :
3961	    else
3962	      $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3963	      $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3964	      $AR t "$xabs" | sort | uniq -cd | while read -r count name
3965	      do
3966		i=1
3967		while test "$i" -le "$count"
3968		do
3969		 # Put our $i before any first dot (extension)
3970		 # Never overwrite any file
3971		 name_to="$name"
3972		 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3973		 do
3974		   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3975		 done
3976		 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3977		 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3978		 i=`expr $i + 1`
3979		done
3980	      done
3981	    fi
3982
3983	    reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3984	  done
3985	fi
3986      fi
3987
3988      # Create the old-style object.
3989      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
3990
3991      output="$obj"
3992      eval cmds=\"$reload_cmds\"
3993      save_ifs="$IFS"; IFS='~'
3994      for cmd in $cmds; do
3995	IFS="$save_ifs"
3996	$show "$cmd"
3997	$run eval "$cmd" || exit $?
3998      done
3999      IFS="$save_ifs"
4000
4001      # Exit if we aren't doing a library object file.
4002      if test -z "$libobj"; then
4003	if test -n "$gentop"; then
4004	  $show "${rm}r $gentop"
4005	  $run ${rm}r $gentop
4006	fi
4007
4008	exit 0
4009      fi
4010
4011      if test "$build_libtool_libs" != yes; then
4012	if test -n "$gentop"; then
4013	  $show "${rm}r $gentop"
4014	  $run ${rm}r $gentop
4015	fi
4016
4017	# Create an invalid libtool object if no PIC, so that we don't
4018	# accidentally link it into a program.
4019	# $show "echo timestamp > $libobj"
4020	# $run eval "echo timestamp > $libobj" || exit $?
4021	exit 0
4022      fi
4023
4024      if test -n "$pic_flag" || test "$pic_mode" != default; then
4025	# Only do commands if we really have different PIC objects.
4026	reload_objs="$libobjs $reload_conv_objs"
4027	output="$libobj"
4028	eval cmds=\"$reload_cmds\"
4029	save_ifs="$IFS"; IFS='~'
4030	for cmd in $cmds; do
4031	  IFS="$save_ifs"
4032	  $show "$cmd"
4033	  $run eval "$cmd" || exit $?
4034	done
4035	IFS="$save_ifs"
4036      fi
4037
4038      if test -n "$gentop"; then
4039	$show "${rm}r $gentop"
4040	$run ${rm}r $gentop
4041      fi
4042
4043      exit 0
4044      ;;
4045
4046    prog)
4047      case $host in
4048	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4049      esac
4050      if test -n "$vinfo"; then
4051	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4052      fi
4053
4054      if test -n "$release"; then
4055	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4056      fi
4057
4058      if test "$preload" = yes; then
4059	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4060	   test "$dlopen_self_static" = unknown; then
4061	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4062	fi
4063      fi
4064
4065      case $host in
4066      *-*-rhapsody* | *-*-darwin1.[012])
4067	# On Rhapsody replace the C library is the System framework
4068	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4069	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
4070	;;
4071      esac
4072
4073      case $host in
4074      *darwin*)
4075        # Don't allow lazy linking, it breaks C++ global constructors
4076        if test "$tagname" = CXX ; then
4077        compile_command="$compile_command ${wl}-bind_at_load"
4078        finalize_command="$finalize_command ${wl}-bind_at_load"
4079        fi
4080        ;;
4081      esac
4082
4083      compile_command="$compile_command $compile_deplibs"
4084      finalize_command="$finalize_command $finalize_deplibs"
4085
4086      if test -n "$rpath$xrpath"; then
4087	# If the user specified any rpath flags, then add them.
4088	for libdir in $rpath $xrpath; do
4089	  # This is the magic to use -rpath.
4090	  case "$finalize_rpath " in
4091	  *" $libdir "*) ;;
4092	  *) finalize_rpath="$finalize_rpath $libdir" ;;
4093	  esac
4094	done
4095      fi
4096
4097      # Now hardcode the library paths
4098      rpath=
4099      hardcode_libdirs=
4100      for libdir in $compile_rpath $finalize_rpath; do
4101	if test -n "$hardcode_libdir_flag_spec"; then
4102	  if test -n "$hardcode_libdir_separator"; then
4103	    if test -z "$hardcode_libdirs"; then
4104	      hardcode_libdirs="$libdir"
4105	    else
4106	      # Just accumulate the unique libdirs.
4107	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4108	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4109		;;
4110	      *)
4111		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4112		;;
4113	      esac
4114	    fi
4115	  else
4116	    eval flag=\"$hardcode_libdir_flag_spec\"
4117	    rpath="$rpath $flag"
4118	  fi
4119	elif test -n "$runpath_var"; then
4120	  case "$perm_rpath " in
4121	  *" $libdir "*) ;;
4122	  *) perm_rpath="$perm_rpath $libdir" ;;
4123	  esac
4124	fi
4125	case $host in
4126	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4127	  case :$dllsearchpath: in
4128	  *":$libdir:"*) ;;
4129	  *) dllsearchpath="$dllsearchpath:$libdir";;
4130	  esac
4131	  ;;
4132	esac
4133      done
4134      # Substitute the hardcoded libdirs into the rpath.
4135      if test -n "$hardcode_libdir_separator" &&
4136	 test -n "$hardcode_libdirs"; then
4137	libdir="$hardcode_libdirs"
4138	eval rpath=\" $hardcode_libdir_flag_spec\"
4139      fi
4140      compile_rpath="$rpath"
4141
4142      rpath=
4143      hardcode_libdirs=
4144      for libdir in $finalize_rpath; do
4145	if test -n "$hardcode_libdir_flag_spec"; then
4146	  if test -n "$hardcode_libdir_separator"; then
4147	    if test -z "$hardcode_libdirs"; then
4148	      hardcode_libdirs="$libdir"
4149	    else
4150	      # Just accumulate the unique libdirs.
4151	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4152	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4153		;;
4154	      *)
4155		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4156		;;
4157	      esac
4158	    fi
4159	  else
4160	    eval flag=\"$hardcode_libdir_flag_spec\"
4161	    rpath="$rpath $flag"
4162	  fi
4163	elif test -n "$runpath_var"; then
4164	  case "$finalize_perm_rpath " in
4165	  *" $libdir "*) ;;
4166	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4167	  esac
4168	fi
4169      done
4170      # Substitute the hardcoded libdirs into the rpath.
4171      if test -n "$hardcode_libdir_separator" &&
4172	 test -n "$hardcode_libdirs"; then
4173	libdir="$hardcode_libdirs"
4174	eval rpath=\" $hardcode_libdir_flag_spec\"
4175      fi
4176      finalize_rpath="$rpath"
4177
4178      if test -n "$libobjs" && test "$build_old_libs" = yes; then
4179	# Transform all the library objects into standard objects.
4180	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4181	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4182      fi
4183
4184      dlsyms=
4185      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4186	if test -n "$NM" && test -n "$global_symbol_pipe"; then
4187	  dlsyms="${outputname}S.c"
4188	else
4189	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4190	fi
4191      fi
4192
4193      if test -n "$dlsyms"; then
4194	case $dlsyms in
4195	"") ;;
4196	*.c)
4197	  # Discover the nlist of each of the dlfiles.
4198	  nlist="$output_objdir/${outputname}.nm"
4199
4200	  $show "$rm $nlist ${nlist}S ${nlist}T"
4201	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
4202
4203	  # Parse the name list into a source file.
4204	  $show "creating $output_objdir/$dlsyms"
4205
4206	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4207/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4208/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4209
4210#ifdef __cplusplus
4211extern \"C\" {
4212#endif
4213
4214/* Prevent the only kind of declaration conflicts we can make. */
4215#define lt_preloaded_symbols some_other_symbol
4216
4217/* External symbol declarations for the compiler. */\
4218"
4219
4220	  if test "$dlself" = yes; then
4221	    $show "generating symbol list for \`$output'"
4222
4223	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4224
4225	    # Add our own program objects to the symbol list.
4226	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4227	    for arg in $progfiles; do
4228	      $show "extracting global C symbols from \`$arg'"
4229	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4230	    done
4231
4232	    if test -n "$exclude_expsyms"; then
4233	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4234	      $run eval '$mv "$nlist"T "$nlist"'
4235	    fi
4236
4237	    if test -n "$export_symbols_regex"; then
4238	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4239	      $run eval '$mv "$nlist"T "$nlist"'
4240	    fi
4241
4242	    # Prepare the list of exported symbols
4243	    if test -z "$export_symbols"; then
4244	      export_symbols="$output_objdir/$output.exp"
4245	      $run $rm $export_symbols
4246	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4247	    else
4248	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4249	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4250	      $run eval 'mv "$nlist"T "$nlist"'
4251	    fi
4252	  fi
4253
4254	  for arg in $dlprefiles; do
4255	    $show "extracting global C symbols from \`$arg'"
4256	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4257	    $run eval '$echo ": $name " >> "$nlist"'
4258	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4259	  done
4260
4261	  if test -z "$run"; then
4262	    # Make sure we have at least an empty file.
4263	    test -f "$nlist" || : > "$nlist"
4264
4265	    if test -n "$exclude_expsyms"; then
4266	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4267	      $mv "$nlist"T "$nlist"
4268	    fi
4269
4270	    # Try sorting and uniquifying the output.
4271	    if grep -v "^: " < "$nlist" |
4272		if sort -k 3 </dev/null >/dev/null 2>&1; then
4273		  sort -k 3
4274		else
4275		  sort +2
4276		fi |
4277		uniq > "$nlist"S; then
4278	      :
4279	    else
4280	      grep -v "^: " < "$nlist" > "$nlist"S
4281	    fi
4282
4283	    if test -f "$nlist"S; then
4284	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4285	    else
4286	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4287	    fi
4288
4289	    $echo >> "$output_objdir/$dlsyms" "\
4290
4291#undef lt_preloaded_symbols
4292
4293#if defined (__STDC__) && __STDC__
4294# define lt_ptr void *
4295#else
4296# define lt_ptr char *
4297# define const
4298#endif
4299
4300/* The mapping between symbol names and symbols. */
4301const struct {
4302  const char *name;
4303  lt_ptr address;
4304}
4305lt_preloaded_symbols[] =
4306{\
4307"
4308
4309	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4310
4311	    $echo >> "$output_objdir/$dlsyms" "\
4312  {0, (lt_ptr) 0}
4313};
4314
4315/* This works around a problem in FreeBSD linker */
4316#ifdef FREEBSD_WORKAROUND
4317static const void *lt_preloaded_setup() {
4318  return lt_preloaded_symbols;
4319}
4320#endif
4321
4322#ifdef __cplusplus
4323}
4324#endif\
4325"
4326	  fi
4327
4328	  pic_flag_for_symtable=
4329	  case $host in
4330	  # compiling the symbol table file with pic_flag works around
4331	  # a FreeBSD bug that causes programs to crash when -lm is
4332	  # linked before any other PIC object.  But we must not use
4333	  # pic_flag when linking with -static.  The problem exists in
4334	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4335	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4336	    case "$compile_command " in
4337	    *" -static "*) ;;
4338	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4339	    esac;;
4340	  *-*-hpux*)
4341	    case "$compile_command " in
4342	    *" -static "*) ;;
4343	    *) pic_flag_for_symtable=" $pic_flag";;
4344	    esac
4345	  esac
4346
4347	  # Now compile the dynamic symbol file.
4348	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4349	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4350
4351	  # Clean up the generated files.
4352	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4353	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4354
4355	  # Transform the symbol file into the correct name.
4356	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4357	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4358	  ;;
4359	*)
4360	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4361	  exit 1
4362	  ;;
4363	esac
4364      else
4365	# We keep going just in case the user didn't refer to
4366	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
4367	# really was required.
4368
4369	# Nullify the symbol file.
4370	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4371	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4372      fi
4373
4374      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4375	# Replace the output file specification.
4376	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4377	link_command="$compile_command$compile_rpath"
4378
4379	# We have no uninstalled library dependencies, so finalize right now.
4380	$show "$link_command"
4381	$run eval "$link_command"
4382	status=$?
4383
4384	# Delete the generated files.
4385	if test -n "$dlsyms"; then
4386	  $show "$rm $output_objdir/${outputname}S.${objext}"
4387	  $run $rm "$output_objdir/${outputname}S.${objext}"
4388	fi
4389
4390	exit $status
4391      fi
4392
4393      if test -n "$shlibpath_var"; then
4394	# We should set the shlibpath_var
4395	rpath=
4396	for dir in $temp_rpath; do
4397	  case $dir in
4398	  [\\/]* | [A-Za-z]:[\\/]*)
4399	    # Absolute path.
4400	    rpath="$rpath$dir:"
4401	    ;;
4402	  *)
4403	    # Relative path: add a thisdir entry.
4404	    rpath="$rpath\$thisdir/$dir:"
4405	    ;;
4406	  esac
4407	done
4408	temp_rpath="$rpath"
4409      fi
4410
4411      if test -n "$compile_shlibpath$finalize_shlibpath"; then
4412	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4413      fi
4414      if test -n "$finalize_shlibpath"; then
4415	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4416      fi
4417
4418      compile_var=
4419      finalize_var=
4420      if test -n "$runpath_var"; then
4421	if test -n "$perm_rpath"; then
4422	  # We should set the runpath_var.
4423	  rpath=
4424	  for dir in $perm_rpath; do
4425	    rpath="$rpath$dir:"
4426	  done
4427	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4428	fi
4429	if test -n "$finalize_perm_rpath"; then
4430	  # We should set the runpath_var.
4431	  rpath=
4432	  for dir in $finalize_perm_rpath; do
4433	    rpath="$rpath$dir:"
4434	  done
4435	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4436	fi
4437      fi
4438
4439      if test "$no_install" = yes; then
4440	# We don't need to create a wrapper script.
4441	link_command="$compile_var$compile_command$compile_rpath"
4442	# Replace the output file specification.
4443	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4444	# Delete the old output file.
4445	$run $rm $output
4446	# Link the executable and exit
4447	$show "$link_command"
4448	$run eval "$link_command" || exit $?
4449	exit 0
4450      fi
4451
4452      if test "$hardcode_action" = relink; then
4453	# Fast installation is not supported
4454	link_command="$compile_var$compile_command$compile_rpath"
4455	relink_command="$finalize_var$finalize_command$finalize_rpath"
4456
4457	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4458	$echo "$modename: \`$output' will be relinked during installation" 1>&2
4459      else
4460	if test "$fast_install" != no; then
4461	  link_command="$finalize_var$compile_command$finalize_rpath"
4462	  if test "$fast_install" = yes; then
4463	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4464	  else
4465	    # fast_install is set to needless
4466	    relink_command=
4467	  fi
4468	else
4469	  link_command="$compile_var$compile_command$compile_rpath"
4470	  relink_command="$finalize_var$finalize_command$finalize_rpath"
4471	fi
4472      fi
4473
4474      # Replace the output file specification.
4475      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4476
4477      # Delete the old output files.
4478      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4479
4480      $show "$link_command"
4481      $run eval "$link_command" || exit $?
4482
4483      # Now create the wrapper script.
4484      $show "creating $output"
4485
4486      # Quote the relink command for shipping.
4487      if test -n "$relink_command"; then
4488	# Preserve any variables that may affect compiler behavior
4489	for var in $variables_saved_for_relink; do
4490	  if eval test -z \"\${$var+set}\"; then
4491	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4492	  elif eval var_value=\$$var; test -z "$var_value"; then
4493	    relink_command="$var=; export $var; $relink_command"
4494	  else
4495	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4496	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
4497	  fi
4498	done
4499	relink_command="(cd `pwd`; $relink_command)"
4500	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4501      fi
4502
4503      # Quote $echo for shipping.
4504      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4505	case $0 in
4506	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4507	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4508	esac
4509	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4510      else
4511	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4512      fi
4513
4514      # Only actually do things if our run command is non-null.
4515      if test -z "$run"; then
4516	# win32 will think the script is a binary if it has
4517	# a .exe suffix, so we strip it off here.
4518	case $output in
4519	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4520	esac
4521	# test for cygwin because mv fails w/o .exe extensions
4522	case $host in
4523	  *cygwin*)
4524	    exeext=.exe
4525	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4526	  *) exeext= ;;
4527	esac
4528	case $host in
4529	  *cygwin* | *mingw* )
4530	    cwrappersource=`$echo ${objdir}/lt-${output}.c`
4531	    cwrapper=`$echo ${output}.exe`
4532	    $rm $cwrappersource $cwrapper
4533	    trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4534
4535	    cat > $cwrappersource <<EOF
4536
4537/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4538   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4539
4540   The $output program cannot be directly executed until all the libtool
4541   libraries that it depends on are installed.
4542   
4543   This wrapper executable should never be moved out of the build directory.
4544   If it is, it will not operate correctly.
4545
4546   Currently, it simply execs the wrapper *script* "/bin/sh $output",
4547   but could eventually absorb all of the scripts functionality and
4548   exec $objdir/$outputname directly.
4549*/
4550EOF
4551	    cat >> $cwrappersource<<"EOF"
4552#include <stdio.h>
4553#include <stdlib.h>
4554#include <unistd.h>
4555#include <malloc.h>
4556#include <stdarg.h>
4557#include <assert.h>
4558
4559#if defined(PATH_MAX)
4560# define LT_PATHMAX PATH_MAX
4561#elif defined(MAXPATHLEN)
4562# define LT_PATHMAX MAXPATHLEN
4563#else
4564# define LT_PATHMAX 1024
4565#endif
4566
4567#ifndef DIR_SEPARATOR
4568#define DIR_SEPARATOR '/'
4569#endif
4570
4571#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4572  defined (__OS2__)
4573#define HAVE_DOS_BASED_FILE_SYSTEM
4574#ifndef DIR_SEPARATOR_2
4575#define DIR_SEPARATOR_2 '\\'
4576#endif
4577#endif
4578
4579#ifndef DIR_SEPARATOR_2
4580# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4581#else /* DIR_SEPARATOR_2 */
4582# define IS_DIR_SEPARATOR(ch) \
4583        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4584#endif /* DIR_SEPARATOR_2 */
4585
4586#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4587#define XFREE(stale) do { \
4588  if (stale) { free ((void *) stale); stale = 0; } \
4589} while (0)
4590
4591const char *program_name = NULL;
4592
4593void * xmalloc (size_t num);
4594char * xstrdup (const char *string);
4595char * basename (const char *name);
4596char * fnqualify(const char *path);
4597char * strendzap(char *str, const char *pat);
4598void lt_fatal (const char *message, ...);
4599
4600int
4601main (int argc, char *argv[])
4602{
4603  char **newargz;
4604  int i;
4605
4606  program_name = (char *) xstrdup ((char *) basename (argv[0]));
4607  newargz = XMALLOC(char *, argc+2);
4608EOF
4609
4610	    cat >> $cwrappersource <<EOF
4611  newargz[0] = "$SHELL";
4612EOF
4613
4614	    cat >> $cwrappersource <<"EOF"
4615  newargz[1] = fnqualify(argv[0]);
4616  /* we know the script has the same name, without the .exe */
4617  /* so make sure newargz[1] doesn't end in .exe */
4618  strendzap(newargz[1],".exe");
4619  for (i = 1; i < argc; i++)
4620    newargz[i+1] = xstrdup(argv[i]);
4621  newargz[argc+1] = NULL;
4622EOF
4623
4624	    cat >> $cwrappersource <<EOF
4625  execv("$SHELL",newargz);
4626EOF
4627
4628	    cat >> $cwrappersource <<"EOF"
4629}
4630
4631void *
4632xmalloc (size_t num)
4633{
4634  void * p = (void *) malloc (num);
4635  if (!p)
4636    lt_fatal ("Memory exhausted");
4637
4638  return p;
4639}
4640
4641char *
4642xstrdup (const char *string)
4643{
4644  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4645;
4646}
4647
4648char *
4649basename (const char *name)
4650{
4651  const char *base;
4652
4653#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4654  /* Skip over the disk name in MSDOS pathnames. */
4655  if (isalpha (name[0]) && name[1] == ':')
4656    name += 2;
4657#endif
4658
4659  for (base = name; *name; name++)
4660    if (IS_DIR_SEPARATOR (*name))
4661      base = name + 1;
4662  return (char *) base;
4663}
4664
4665char *
4666fnqualify(const char *path)
4667{
4668  size_t size;
4669  char *p;
4670  char tmp[LT_PATHMAX + 1];
4671
4672  assert(path != NULL);
4673
4674  /* Is it qualified already? */
4675#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4676  if (isalpha (path[0]) && path[1] == ':')
4677    return xstrdup (path);
4678#endif
4679  if (IS_DIR_SEPARATOR (path[0]))
4680    return xstrdup (path);
4681
4682  /* prepend the current directory */
4683  /* doesn't handle '~' */
4684  if (getcwd (tmp, LT_PATHMAX) == NULL)
4685    lt_fatal ("getcwd failed");
4686  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4687  p = XMALLOC(char, size);
4688  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4689  return p;
4690}
4691
4692char *
4693strendzap(char *str, const char *pat)
4694{
4695  size_t len, patlen;
4696
4697  assert(str != NULL);
4698  assert(pat != NULL);
4699
4700  len = strlen(str);
4701  patlen = strlen(pat);
4702
4703  if (patlen <= len)
4704  {
4705    str += len - patlen;
4706    if (strcmp(str, pat) == 0)
4707      *str = '\0';
4708  }
4709  return str;
4710}
4711
4712static void
4713lt_error_core (int exit_status, const char * mode,
4714          const char * message, va_list ap)
4715{
4716  fprintf (stderr, "%s: %s: ", program_name, mode);
4717  vfprintf (stderr, message, ap);
4718  fprintf (stderr, ".\n");
4719
4720  if (exit_status >= 0)
4721    exit (exit_status);
4722}
4723
4724void
4725lt_fatal (const char *message, ...)
4726{
4727  va_list ap;
4728  va_start (ap, message);
4729  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4730  va_end (ap);
4731}
4732EOF
4733	  # we should really use a build-platform specific compiler
4734	  # here, but OTOH, the wrappers (shell script and this C one)
4735	  # are only useful if you want to execute the "real" binary.
4736	  # Since the "real" binary is built for $host, then this
4737	  # wrapper might as well be built for $host, too.
4738	  $run $LTCC -s -o $cwrapper $cwrappersource
4739	  ;;
4740	esac
4741	$rm $output
4742	trap "$rm $output; exit 1" 1 2 15
4743
4744	$echo > $output "\
4745#! $SHELL
4746
4747# $output - temporary wrapper script for $objdir/$outputname
4748# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4749#
4750# The $output program cannot be directly executed until all the libtool
4751# libraries that it depends on are installed.
4752#
4753# This wrapper script should never be moved out of the build directory.
4754# If it is, it will not operate correctly.
4755
4756# Sed substitution that helps us do robust quoting.  It backslashifies
4757# metacharacters that are still active within double-quoted strings.
4758Xsed='${SED} -e 1s/^X//'
4759sed_quote_subst='$sed_quote_subst'
4760
4761# The HP-UX ksh and POSIX shell print the target directory to stdout
4762# if CDPATH is set.
4763if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4764
4765relink_command=\"$relink_command\"
4766
4767# This environment variable determines our operation mode.
4768if test \"\$libtool_install_magic\" = \"$magic\"; then
4769  # install mode needs the following variable:
4770  notinst_deplibs='$notinst_deplibs'
4771else
4772  # When we are sourced in execute mode, \$file and \$echo are already set.
4773  if test \"\$libtool_execute_magic\" != \"$magic\"; then
4774    echo=\"$qecho\"
4775    file=\"\$0\"
4776    # Make sure echo works.
4777    if test \"X\$1\" = X--no-reexec; then
4778      # Discard the --no-reexec flag, and continue.
4779      shift
4780    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4781      # Yippee, \$echo works!
4782      :
4783    else
4784      # Restart under the correct shell, and then maybe \$echo will work.
4785      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4786    fi
4787  fi\
4788"
4789	$echo >> $output "\
4790
4791  # Find the directory that this script lives in.
4792  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4793  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4794
4795  # Follow symbolic links until we get to the real thisdir.
4796  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4797  while test -n \"\$file\"; do
4798    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4799
4800    # If there was a directory component, then change thisdir.
4801    if test \"x\$destdir\" != \"x\$file\"; then
4802      case \"\$destdir\" in
4803      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4804      *) thisdir=\"\$thisdir/\$destdir\" ;;
4805      esac
4806    fi
4807
4808    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4809    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4810  done
4811
4812  # Try to get the absolute directory name.
4813  absdir=\`cd \"\$thisdir\" && pwd\`
4814  test -n \"\$absdir\" && thisdir=\"\$absdir\"
4815"
4816
4817	if test "$fast_install" = yes; then
4818	  $echo >> $output "\
4819  program=lt-'$outputname'$exeext
4820  progdir=\"\$thisdir/$objdir\"
4821
4822  if test ! -f \"\$progdir/\$program\" || \\
4823     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4824       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4825
4826    file=\"\$\$-\$program\"
4827
4828    if test ! -d \"\$progdir\"; then
4829      $mkdir \"\$progdir\"
4830    else
4831      $rm \"\$progdir/\$file\"
4832    fi"
4833
4834	  $echo >> $output "\
4835
4836    # relink executable if necessary
4837    if test -n \"\$relink_command\"; then
4838      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4839      else
4840	$echo \"\$relink_command_output\" >&2
4841	$rm \"\$progdir/\$file\"
4842	exit 1
4843      fi
4844    fi
4845
4846    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4847    { $rm \"\$progdir/\$program\";
4848      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4849    $rm \"\$progdir/\$file\"
4850  fi"
4851	else
4852	  $echo >> $output "\
4853  program='$outputname'
4854  progdir=\"\$thisdir/$objdir\"
4855"
4856	fi
4857
4858	$echo >> $output "\
4859
4860  if test -f \"\$progdir/\$program\"; then"
4861
4862	# Export our shlibpath_var if we have one.
4863	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4864	  $echo >> $output "\
4865    # Add our own library path to $shlibpath_var
4866    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4867
4868    # Some systems cannot cope with colon-terminated $shlibpath_var
4869    # The second colon is a workaround for a bug in BeOS R4 sed
4870    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4871
4872    export $shlibpath_var
4873"
4874	fi
4875
4876	# fixup the dll searchpath if we need to.
4877	if test -n "$dllsearchpath"; then
4878	  $echo >> $output "\
4879    # Add the dll search path components to the executable PATH
4880    PATH=$dllsearchpath:\$PATH
4881"
4882	fi
4883
4884	$echo >> $output "\
4885    if test \"\$libtool_execute_magic\" != \"$magic\"; then
4886      # Run the actual program with our arguments.
4887"
4888	case $host in
4889	# Backslashes separate directories on plain windows
4890	*-*-mingw | *-*-os2*)
4891	  $echo >> $output "\
4892      exec \$progdir\\\\\$program \${1+\"\$@\"}
4893"
4894	  ;;
4895
4896	*)
4897	  $echo >> $output "\
4898      exec \$progdir/\$program \${1+\"\$@\"}
4899"
4900	  ;;
4901	esac
4902	$echo >> $output "\
4903      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4904      exit 1
4905    fi
4906  else
4907    # The program doesn't exist.
4908    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4909    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4910    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4911    exit 1
4912  fi
4913fi\
4914"
4915	chmod +x $output
4916      fi
4917      exit 0
4918      ;;
4919    esac
4920
4921    # See if we need to build an old-fashioned archive.
4922    for oldlib in $oldlibs; do
4923
4924      if test "$build_libtool_libs" = convenience; then
4925	oldobjs="$libobjs_save"
4926	addlibs="$convenience"
4927	build_libtool_libs=no
4928      else
4929	if test "$build_libtool_libs" = module; then
4930	  oldobjs="$libobjs_save"
4931	  build_libtool_libs=no
4932	else
4933	  oldobjs="$old_deplibs $non_pic_objects"
4934	fi
4935	addlibs="$old_convenience"
4936      fi
4937
4938      if test -n "$addlibs"; then
4939	gentop="$output_objdir/${outputname}x"
4940	$show "${rm}r $gentop"
4941	$run ${rm}r "$gentop"
4942	$show "$mkdir $gentop"
4943	$run $mkdir "$gentop"
4944	status=$?
4945	if test "$status" -ne 0 && test ! -d "$gentop"; then
4946	  exit $status
4947	fi
4948	generated="$generated $gentop"
4949
4950	# Add in members from convenience archives.
4951	for xlib in $addlibs; do
4952	  # Extract the objects.
4953	  case $xlib in
4954	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
4955	  *) xabs=`pwd`"/$xlib" ;;
4956	  esac
4957	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
4958	  xdir="$gentop/$xlib"
4959
4960	  $show "${rm}r $xdir"
4961	  $run ${rm}r "$xdir"
4962	  $show "$mkdir $xdir"
4963	  $run $mkdir "$xdir"
4964	  status=$?
4965	  if test "$status" -ne 0 && test ! -d "$xdir"; then
4966	    exit $status
4967	  fi
4968	  # We will extract separately just the conflicting names and we will no
4969	  # longer touch any unique names. It is faster to leave these extract
4970	  # automatically by $AR in one run.
4971	  $show "(cd $xdir && $AR x $xabs)"
4972	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
4973	  if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
4974	    :
4975	  else
4976	    $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
4977	    $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
4978	    $AR t "$xabs" | sort | uniq -cd | while read -r count name
4979	    do
4980	      i=1
4981	      while test "$i" -le "$count"
4982	      do
4983	       # Put our $i before any first dot (extension)
4984	       # Never overwrite any file
4985	       name_to="$name"
4986	       while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4987	       do
4988		 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4989	       done
4990	       $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4991	       $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4992	       i=`expr $i + 1`
4993	      done
4994	    done
4995	  fi
4996
4997	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
4998	done
4999      fi
5000
5001      # Do each command in the archive commands.
5002      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5003	eval cmds=\"$old_archive_from_new_cmds\"
5004      else
5005	eval cmds=\"$old_archive_cmds\"
5006
5007	if len=`expr "X$cmds" : ".*"` &&
5008	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5009	  :
5010	else
5011	  # the command line is too long to link in one step, link in parts
5012	  $echo "using piecewise archive linking..."
5013	  save_RANLIB=$RANLIB
5014	  RANLIB=:
5015	  objlist=
5016	  concat_cmds=
5017	  save_oldobjs=$oldobjs
5018	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5019	  # encoded into archives.  This makes 'ar r' malfunction in
5020	  # this piecewise linking case whenever conflicting object
5021	  # names appear in distinct ar calls; check, warn and compensate.
5022	    if (for obj in $save_oldobjs
5023	    do
5024	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
5025	    done | sort | sort -uc >/dev/null 2>&1); then
5026	    :
5027	  else
5028	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5029	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5030	    AR_FLAGS=cq
5031	  fi
5032	  # Is there a better way of finding the last object in the list?
5033	  for obj in $save_oldobjs
5034	  do
5035	    last_oldobj=$obj
5036	  done
5037	  for obj in $save_oldobjs
5038	  do
5039	    oldobjs="$objlist $obj"
5040	    objlist="$objlist $obj"
5041	    eval test_cmds=\"$old_archive_cmds\"
5042	    if len=`expr "X$test_cmds" : ".*"` &&
5043	       test "$len" -le "$max_cmd_len"; then
5044	      :
5045	    else
5046	      # the above command should be used before it gets too long
5047	      oldobjs=$objlist
5048	      if test "$obj" = "$last_oldobj" ; then
5049	        RANLIB=$save_RANLIB
5050	      fi
5051	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5052	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5053	      objlist=
5054	    fi
5055	  done
5056	  RANLIB=$save_RANLIB
5057	  oldobjs=$objlist
5058	  if test "X$oldobjs" = "X" ; then
5059	    eval cmds=\"\$concat_cmds\"
5060	  else
5061	    eval cmds=\"\$concat_cmds~$old_archive_cmds\"
5062	  fi
5063	fi
5064      fi
5065      save_ifs="$IFS"; IFS='~'
5066      for cmd in $cmds; do
5067	IFS="$save_ifs"
5068	$show "$cmd"
5069	$run eval "$cmd" || exit $?
5070      done
5071      IFS="$save_ifs"
5072    done
5073
5074    if test -n "$generated"; then
5075      $show "${rm}r$generated"
5076      $run ${rm}r$generated
5077    fi
5078
5079    # Now create the libtool archive.
5080    case $output in
5081    *.la)
5082      old_library=
5083      test "$build_old_libs" = yes && old_library="$libname.$libext"
5084      $show "creating $output"
5085
5086      # Preserve any variables that may affect compiler behavior
5087      for var in $variables_saved_for_relink; do
5088	if eval test -z \"\${$var+set}\"; then
5089	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5090	elif eval var_value=\$$var; test -z "$var_value"; then
5091	  relink_command="$var=; export $var; $relink_command"
5092	else
5093	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5094	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
5095	fi
5096      done
5097      # Quote the link command for shipping.
5098      relink_command="(cd `pwd`; $SHELL $0 $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
5099      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5100      if test "$hardcode_automatic" = yes ; then
5101        relink_command=
5102      fi
5103      # Only create the output if not a dry run.
5104      if test -z "$run"; then
5105	for installed in no yes; do
5106	  if test "$installed" = yes; then
5107	    if test -z "$install_libdir"; then
5108	      break
5109	    fi
5110	    output="$output_objdir/$outputname"i
5111	    # Replace all uninstalled libtool libraries with the installed ones
5112	    newdependency_libs=
5113	    for deplib in $dependency_libs; do
5114	      case $deplib in
5115	      *.la)
5116		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5117		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5118		if test -z "$libdir"; then
5119		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5120		  exit 1
5121		fi
5122		newdependency_libs="$newdependency_libs $libdir/$name"
5123		;;
5124	      *) newdependency_libs="$newdependency_libs $deplib" ;;
5125	      esac
5126	    done
5127	    dependency_libs="$newdependency_libs"
5128	    newdlfiles=
5129	    for lib in $dlfiles; do
5130	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5131	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5132	      if test -z "$libdir"; then
5133		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5134		exit 1
5135	      fi
5136	      newdlfiles="$newdlfiles $libdir/$name"
5137	    done
5138	    dlfiles="$newdlfiles"
5139	    newdlprefiles=
5140	    for lib in $dlprefiles; do
5141	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5142	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5143	      if test -z "$libdir"; then
5144		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5145		exit 1
5146	      fi
5147	      newdlprefiles="$newdlprefiles $libdir/$name"
5148	    done
5149	    dlprefiles="$newdlprefiles"
5150	  else
5151	    newdlfiles=
5152	    for lib in $dlfiles; do
5153	      case $lib in
5154		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5155		*) abs=`pwd`"/$lib" ;;
5156	      esac
5157	      newdlfiles="$newdlfiles $abs"
5158	    done
5159	    dlfiles="$newdlfiles"
5160	    newdlprefiles=
5161	    for lib in $dlprefiles; do
5162	      case $lib in
5163		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
5164		*) abs=`pwd`"/$lib" ;;
5165	      esac
5166	      newdlprefiles="$newdlprefiles $abs"
5167	    done
5168	    dlprefiles="$newdlprefiles"
5169	  fi
5170	  $rm $output
5171	  # place dlname in correct position for cygwin
5172	  tdlname=$dlname
5173	  case $host,$output,$installed,$module,$dlname in
5174	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5175	  esac
5176	  $echo > $output "\
5177# $outputname - a libtool library file
5178# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5179#
5180# Please DO NOT delete this file!
5181# It is necessary for linking the library.
5182
5183# The name that we can dlopen(3).
5184dlname='$tdlname'
5185
5186# Names of this library.
5187library_names='$library_names'
5188
5189# The name of the static archive.
5190old_library='$old_library'
5191
5192# Libraries that this one depends upon.
5193dependency_libs='$dependency_libs'
5194
5195# Version information for $libname.
5196current=$current
5197age=$age
5198revision=$revision
5199
5200# Is this an already installed library?
5201installed=$installed
5202
5203# Should we warn about portability when linking against -modules?
5204shouldnotlink=$module
5205
5206# Files to dlopen/dlpreopen
5207dlopen='$dlfiles'
5208dlpreopen='$dlprefiles'
5209
5210# Directory that this library needs to be installed in:
5211libdir='$install_libdir'"
5212	  if test "$installed" = no && test "$need_relink" = yes; then
5213	    $echo >> $output "\
5214relink_command=\"$relink_command\""
5215	  fi
5216	done
5217      fi
5218
5219      # Do a symbolic link so that the libtool archive can be found in
5220      # LD_LIBRARY_PATH before the program is installed.
5221      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5222      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5223      ;;
5224    esac
5225    exit 0
5226    ;;
5227
5228  # libtool install mode
5229  install)
5230    modename="$modename: install"
5231
5232    # There may be an optional sh(1) argument at the beginning of
5233    # install_prog (especially on Windows NT).
5234    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5235       # Allow the use of GNU shtool's install command.
5236       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5237      # Aesthetically quote it.
5238      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5239      case $arg in
5240      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
5241	arg="\"$arg\""
5242	;;
5243      esac
5244      install_prog="$arg "
5245      arg="$1"
5246      shift
5247    else
5248      install_prog=
5249      arg="$nonopt"
5250    fi
5251
5252    # The real first argument should be the name of the installation program.
5253    # Aesthetically quote it.
5254    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5255    case $arg in
5256    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
5257      arg="\"$arg\""
5258      ;;
5259    esac
5260    install_prog="$install_prog$arg"
5261
5262    # We need to accept at least all the BSD install flags.
5263    dest=
5264    files=
5265    opts=
5266    prev=
5267    install_type=
5268    isdir=no
5269    stripme=
5270    for arg
5271    do
5272      if test -n "$dest"; then
5273	files="$files $dest"
5274	dest="$arg"
5275	continue
5276      fi
5277
5278      case $arg in
5279      -d) isdir=yes ;;
5280      -f) prev="-f" ;;
5281      -g) prev="-g" ;;
5282      -m) prev="-m" ;;
5283      -o) prev="-o" ;;
5284      -s)
5285	stripme=" -s"
5286	continue
5287	;;
5288      -*) ;;
5289
5290      *)
5291	# If the previous option needed an argument, then skip it.
5292	if test -n "$prev"; then
5293	  prev=
5294	else
5295	  dest="$arg"
5296	  continue
5297	fi
5298	;;
5299      esac
5300
5301      # Aesthetically quote the argument.
5302      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5303      case $arg in
5304      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
5305	arg="\"$arg\""
5306	;;
5307      esac
5308      install_prog="$install_prog $arg"
5309    done
5310
5311    if test -z "$install_prog"; then
5312      $echo "$modename: you must specify an install program" 1>&2
5313      $echo "$help" 1>&2
5314      exit 1
5315    fi
5316
5317    if test -n "$prev"; then
5318      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5319      $echo "$help" 1>&2
5320      exit 1
5321    fi
5322
5323    if test -z "$files"; then
5324      if test -z "$dest"; then
5325	$echo "$modename: no file or destination specified" 1>&2
5326      else
5327	$echo "$modename: you must specify a destination" 1>&2
5328      fi
5329      $echo "$help" 1>&2
5330      exit 1
5331    fi
5332
5333    # Strip any trailing slash from the destination.
5334    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5335
5336    # Check to see that the destination is a directory.
5337    test -d "$dest" && isdir=yes
5338    if test "$isdir" = yes; then
5339      destdir="$dest"
5340      destname=
5341    else
5342      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5343      test "X$destdir" = "X$dest" && destdir=.
5344      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5345
5346      # Not a directory, so check to see that there is only one file specified.
5347      set dummy $files
5348      if test "$#" -gt 2; then
5349	$echo "$modename: \`$dest' is not a directory" 1>&2
5350	$echo "$help" 1>&2
5351	exit 1
5352      fi
5353    fi
5354    case $destdir in
5355    [\\/]* | [A-Za-z]:[\\/]*) ;;
5356    *)
5357      for file in $files; do
5358	case $file in
5359	*.lo) ;;
5360	*)
5361	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5362	  $echo "$help" 1>&2
5363	  exit 1
5364	  ;;
5365	esac
5366      done
5367      ;;
5368    esac
5369
5370    # This variable tells wrapper scripts just to set variables rather
5371    # than running their programs.
5372    libtool_install_magic="$magic"
5373
5374    staticlibs=
5375    future_libdirs=
5376    current_libdirs=
5377    for file in $files; do
5378
5379      # Do each installation.
5380      case $file in
5381      *.$libext)
5382	# Do the static libraries later.
5383	staticlibs="$staticlibs $file"
5384	;;
5385
5386      *.la)
5387	# Check to see that this really is a libtool archive.
5388	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5389	else
5390	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5391	  $echo "$help" 1>&2
5392	  exit 1
5393	fi
5394
5395	library_names=
5396	old_library=
5397	relink_command=
5398	# If there is no directory component, then add one.
5399	case $file in
5400	*/* | *\\*) . $file ;;
5401	*) . ./$file ;;
5402	esac
5403
5404	# Add the libdir to current_libdirs if it is the destination.
5405	if test "X$destdir" = "X$libdir"; then
5406	  case "$current_libdirs " in
5407	  *" $libdir "*) ;;
5408	  *) current_libdirs="$current_libdirs $libdir" ;;
5409	  esac
5410	else
5411	  # Note the libdir as a future libdir.
5412	  case "$future_libdirs " in
5413	  *" $libdir "*) ;;
5414	  *) future_libdirs="$future_libdirs $libdir" ;;
5415	  esac
5416	fi
5417
5418	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5419	test "X$dir" = "X$file/" && dir=
5420	dir="$dir$objdir"
5421
5422	if test -n "$relink_command"; then
5423	  # Determine the prefix the user has applied to our future dir.
5424	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5425
5426	  # Don't allow the user to place us outside of our expected
5427	  # location b/c this prevents finding dependent libraries that
5428	  # are installed to the same prefix.
5429	  # At present, this check doesn't affect windows .dll's that
5430	  # are installed into $libdir/../bin (currently, that works fine)
5431	  # but it's something to keep an eye on.
5432	  if test "$inst_prefix_dir" = "$destdir"; then
5433	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5434	    exit 1
5435	  fi
5436
5437	  if test -n "$inst_prefix_dir"; then
5438	    # Stick the inst_prefix_dir data into the link command.
5439	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5440	  else
5441	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5442	  fi
5443
5444	  $echo "$modename: warning: relinking \`$file'" 1>&2
5445	  $show "$relink_command"
5446	  if $run eval "$relink_command"; then :
5447	  else
5448	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5449	    exit 1
5450	  fi
5451	fi
5452
5453	# See the names of the shared library.
5454	set dummy $library_names
5455	if test -n "$2"; then
5456	  realname="$2"
5457	  shift
5458	  shift
5459
5460	  srcname="$realname"
5461	  test -n "$relink_command" && srcname="$realname"T
5462
5463	  # Install the shared library and build the symlinks.
5464	  $show "$install_prog $dir/$srcname $destdir/$realname"
5465	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5466	  if test -n "$stripme" && test -n "$striplib"; then
5467	    $show "$striplib $destdir/$realname"
5468	    $run eval "$striplib $destdir/$realname" || exit $?
5469	  fi
5470
5471	  if test "$#" -gt 0; then
5472	    # Delete the old symlinks, and create new ones.
5473	    for linkname
5474	    do
5475	      if test "$linkname" != "$realname"; then
5476		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5477		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5478	      fi
5479	    done
5480	  fi
5481
5482	  # Do each command in the postinstall commands.
5483	  lib="$destdir/$realname"
5484	  eval cmds=\"$postinstall_cmds\"
5485	  save_ifs="$IFS"; IFS='~'
5486	  for cmd in $cmds; do
5487	    IFS="$save_ifs"
5488	    $show "$cmd"
5489	    $run eval "$cmd" || exit $?
5490	  done
5491	  IFS="$save_ifs"
5492	fi
5493
5494	# Install the pseudo-library for information purposes.
5495	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5496	instname="$dir/$name"i
5497	$show "$install_prog $instname $destdir/$name"
5498	$run eval "$install_prog $instname $destdir/$name" || exit $?
5499
5500	# Maybe install the static library, too.
5501	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5502	;;
5503
5504      *.lo)
5505	# Install (i.e. copy) a libtool object.
5506
5507	# Figure out destination file name, if it wasn't already specified.
5508	if test -n "$destname"; then
5509	  destfile="$destdir/$destname"
5510	else
5511	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5512	  destfile="$destdir/$destfile"
5513	fi
5514
5515	# Deduce the name of the destination old-style object file.
5516	case $destfile in
5517	*.lo)
5518	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5519	  ;;
5520	*.$objext)
5521	  staticdest="$destfile"
5522	  destfile=
5523	  ;;
5524	*)
5525	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5526	  $echo "$help" 1>&2
5527	  exit 1
5528	  ;;
5529	esac
5530
5531	# Install the libtool object if requested.
5532	if test -n "$destfile"; then
5533	  $show "$install_prog $file $destfile"
5534	  $run eval "$install_prog $file $destfile" || exit $?
5535	fi
5536
5537	# Install the old object if enabled.
5538	if test "$build_old_libs" = yes; then
5539	  # Deduce the name of the old-style object file.
5540	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5541
5542	  $show "$install_prog $staticobj $staticdest"
5543	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5544	fi
5545	exit 0
5546	;;
5547
5548      *)
5549	# Figure out destination file name, if it wasn't already specified.
5550	if test -n "$destname"; then
5551	  destfile="$destdir/$destname"
5552	else
5553	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5554	  destfile="$destdir/$destfile"
5555	fi
5556
5557	# If the file is missing, and there is a .exe on the end, strip it
5558	# because it is most likely a libtool script we actually want to
5559	# install
5560	stripped_ext=""
5561	case $file in
5562	  *.exe)
5563	    if test ! -f "$file"; then
5564	      file=`$echo $file|${SED} 's,.exe$,,'`
5565	      stripped_ext=".exe"
5566	    fi
5567	    ;;
5568	esac
5569
5570	# Do a test to see if this is really a libtool program.
5571	case $host in
5572	*cygwin*|*mingw*)
5573	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5574	    ;;
5575	*)
5576	    wrapper=$file
5577	    ;;
5578	esac
5579	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5580	  notinst_deplibs=
5581	  relink_command=
5582
5583	  # To insure that "foo" is sourced, and not "foo.exe",
5584	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
5585	  # which disallows the automatic-append-.exe behavior.
5586	  case $build in
5587	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5588	  *) wrapperdot=${wrapper} ;;
5589	  esac
5590	  # If there is no directory component, then add one.
5591	  case $file in
5592	  */* | *\\*) . ${wrapperdot} ;;
5593	  *) . ./${wrapperdot} ;;
5594	  esac
5595
5596	  # Check the variables that should have been set.
5597	  if test -z "$notinst_deplibs"; then
5598	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5599	    exit 1
5600	  fi
5601
5602	  finalize=yes
5603	  for lib in $notinst_deplibs; do
5604	    # Check to see that each library is installed.
5605	    libdir=
5606	    if test -f "$lib"; then
5607	      # If there is no directory component, then add one.
5608	      case $lib in
5609	      */* | *\\*) . $lib ;;
5610	      *) . ./$lib ;;
5611	      esac
5612	    fi
5613	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5614	    if test -n "$libdir" && test ! -f "$libfile"; then
5615	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5616	      finalize=no
5617	    fi
5618	  done
5619
5620	  relink_command=
5621	  # To insure that "foo" is sourced, and not "foo.exe",
5622	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
5623	  # which disallows the automatic-append-.exe behavior.
5624	  case $build in
5625	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5626	  *) wrapperdot=${wrapper} ;;
5627	  esac
5628	  # If there is no directory component, then add one.
5629	  case $file in
5630	  */* | *\\*) . ${wrapperdot} ;;
5631	  *) . ./${wrapperdot} ;;
5632	  esac
5633
5634	  outputname=
5635	  if test "$fast_install" = no && test -n "$relink_command"; then
5636	    if test "$finalize" = yes && test -z "$run"; then
5637	      tmpdir="/tmp"
5638	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
5639	      tmpdir="$tmpdir/libtool-$$"
5640	      if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then :
5641	      else
5642		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5643		continue
5644	      fi
5645	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5646	      outputname="$tmpdir/$file"
5647	      # Replace the output file specification.
5648	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5649
5650	      $show "$relink_command"
5651	      if $run eval "$relink_command"; then :
5652	      else
5653		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5654		${rm}r "$tmpdir"
5655		continue
5656	      fi
5657	      file="$outputname"
5658	    else
5659	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
5660	    fi
5661	  else
5662	    # Install the binary that we compiled earlier.
5663	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5664	  fi
5665	fi
5666
5667	# remove .exe since cygwin /usr/bin/install will append another
5668	# one anyways
5669	case $install_prog,$host in
5670	*/usr/bin/install*,*cygwin*)
5671	  case $file:$destfile in
5672	  *.exe:*.exe)
5673	    # this is ok
5674	    ;;
5675	  *.exe:*)
5676	    destfile=$destfile.exe
5677	    ;;
5678	  *:*.exe)
5679	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5680	    ;;
5681	  esac
5682	  ;;
5683	esac
5684	$show "$install_prog$stripme $file $destfile"
5685	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5686	test -n "$outputname" && ${rm}r "$tmpdir"
5687	;;
5688      esac
5689    done
5690
5691    for file in $staticlibs; do
5692      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5693
5694      # Set up the ranlib parameters.
5695      oldlib="$destdir/$name"
5696
5697      $show "$install_prog $file $oldlib"
5698      $run eval "$install_prog \$file \$oldlib" || exit $?
5699
5700      if test -n "$stripme" && test -n "$striplib"; then
5701	$show "$old_striplib $oldlib"
5702	$run eval "$old_striplib $oldlib" || exit $?
5703      fi
5704
5705      # Do each command in the postinstall commands.
5706      eval cmds=\"$old_postinstall_cmds\"
5707      save_ifs="$IFS"; IFS='~'
5708      for cmd in $cmds; do
5709	IFS="$save_ifs"
5710	$show "$cmd"
5711	$run eval "$cmd" || exit $?
5712      done
5713      IFS="$save_ifs"
5714    done
5715
5716    if test -n "$future_libdirs"; then
5717      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5718    fi
5719
5720    if test -n "$current_libdirs"; then
5721      # Maybe just do a dry run.
5722      test -n "$run" && current_libdirs=" -n$current_libdirs"
5723      exec_cmd='$SHELL $0 $preserve_args --finish$current_libdirs'
5724    else
5725      exit 0
5726    fi
5727    ;;
5728
5729  # libtool finish mode
5730  finish)
5731    modename="$modename: finish"
5732    libdirs="$nonopt"
5733    admincmds=
5734
5735    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5736      for dir
5737      do
5738	libdirs="$libdirs $dir"
5739      done
5740
5741      for libdir in $libdirs; do
5742	if test -n "$finish_cmds"; then
5743	  # Do each command in the finish commands.
5744	  eval cmds=\"$finish_cmds\"
5745	  save_ifs="$IFS"; IFS='~'
5746	  for cmd in $cmds; do
5747	    IFS="$save_ifs"
5748	    $show "$cmd"
5749	    $run eval "$cmd" || admincmds="$admincmds
5750       $cmd"
5751	  done
5752	  IFS="$save_ifs"
5753	fi
5754	if test -n "$finish_eval"; then
5755	  # Do the single finish_eval.
5756	  eval cmds=\"$finish_eval\"
5757	  $run eval "$cmds" || admincmds="$admincmds
5758       $cmds"
5759	fi
5760      done
5761    fi
5762
5763    # Exit here if they wanted silent mode.
5764    test "$show" = : && exit 0
5765
5766    $echo "----------------------------------------------------------------------"
5767    $echo "Libraries have been installed in:"
5768    for libdir in $libdirs; do
5769      $echo "   $libdir"
5770    done
5771    $echo
5772    $echo "If you ever happen to want to link against installed libraries"
5773    $echo "in a given directory, LIBDIR, you must either use libtool, and"
5774    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5775    $echo "flag during linking and do at least one of the following:"
5776    if test -n "$shlibpath_var"; then
5777      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
5778      $echo "     during execution"
5779    fi
5780    if test -n "$runpath_var"; then
5781      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
5782      $echo "     during linking"
5783    fi
5784    if test -n "$hardcode_libdir_flag_spec"; then
5785      libdir=LIBDIR
5786      eval flag=\"$hardcode_libdir_flag_spec\"
5787
5788      $echo "   - use the \`$flag' linker flag"
5789    fi
5790    if test -n "$admincmds"; then
5791      $echo "   - have your system administrator run these commands:$admincmds"
5792    fi
5793    if test -f /etc/ld.so.conf; then
5794      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5795    fi
5796    $echo
5797    $echo "See any operating system documentation about shared libraries for"
5798    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5799    $echo "----------------------------------------------------------------------"
5800    exit 0
5801    ;;
5802
5803  # libtool execute mode
5804  execute)
5805    modename="$modename: execute"
5806
5807    # The first argument is the command name.
5808    cmd="$nonopt"
5809    if test -z "$cmd"; then
5810      $echo "$modename: you must specify a COMMAND" 1>&2
5811      $echo "$help"
5812      exit 1
5813    fi
5814
5815    # Handle -dlopen flags immediately.
5816    for file in $execute_dlfiles; do
5817      if test ! -f "$file"; then
5818	$echo "$modename: \`$file' is not a file" 1>&2
5819	$echo "$help" 1>&2
5820	exit 1
5821      fi
5822
5823      dir=
5824      case $file in
5825      *.la)
5826	# Check to see that this really is a libtool archive.
5827	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5828	else
5829	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5830	  $echo "$help" 1>&2
5831	  exit 1
5832	fi
5833
5834	# Read the libtool library.
5835	dlname=
5836	library_names=
5837
5838	# If there is no directory component, then add one.
5839	case $file in
5840	*/* | *\\*) . $file ;;
5841	*) . ./$file ;;
5842	esac
5843
5844	# Skip this library if it cannot be dlopened.
5845	if test -z "$dlname"; then
5846	  # Warn if it was a shared library.
5847	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5848	  continue
5849	fi
5850
5851	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5852	test "X$dir" = "X$file" && dir=.
5853
5854	if test -f "$dir/$objdir/$dlname"; then
5855	  dir="$dir/$objdir"
5856	else
5857	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5858	  exit 1
5859	fi
5860	;;
5861
5862      *.lo)
5863	# Just add the directory containing the .lo file.
5864	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5865	test "X$dir" = "X$file" && dir=.
5866	;;
5867
5868      *)
5869	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5870	continue
5871	;;
5872      esac
5873
5874      # Get the absolute pathname.
5875      absdir=`cd "$dir" && pwd`
5876      test -n "$absdir" && dir="$absdir"
5877
5878      # Now add the directory to shlibpath_var.
5879      if eval "test -z \"\$$shlibpath_var\""; then
5880	eval "$shlibpath_var=\"\$dir\""
5881      else
5882	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5883      fi
5884    done
5885
5886    # This variable tells wrapper scripts just to set shlibpath_var
5887    # rather than running their programs.
5888    libtool_execute_magic="$magic"
5889
5890    # Check if any of the arguments is a wrapper script.
5891    args=
5892    for file
5893    do
5894      case $file in
5895      -*) ;;
5896      *)
5897	# Do a test to see if this is really a libtool program.
5898	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5899	  # If there is no directory component, then add one.
5900	  case $file in
5901	  */* | *\\*) . $file ;;
5902	  *) . ./$file ;;
5903	  esac
5904
5905	  # Transform arg to wrapped name.
5906	  file="$progdir/$program"
5907	fi
5908	;;
5909      esac
5910      # Quote arguments (to preserve shell metacharacters).
5911      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5912      args="$args \"$file\""
5913    done
5914
5915    if test -z "$run"; then
5916      if test -n "$shlibpath_var"; then
5917	# Export the shlibpath_var.
5918	eval "export $shlibpath_var"
5919      fi
5920
5921      # Restore saved environment variables
5922      if test "${save_LC_ALL+set}" = set; then
5923	LC_ALL="$save_LC_ALL"; export LC_ALL
5924      fi
5925      if test "${save_LANG+set}" = set; then
5926	LANG="$save_LANG"; export LANG
5927      fi
5928
5929      # Now prepare to actually exec the command.
5930      exec_cmd="\$cmd$args"
5931    else
5932      # Display what would be done.
5933      if test -n "$shlibpath_var"; then
5934	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5935	$echo "export $shlibpath_var"
5936      fi
5937      $echo "$cmd$args"
5938      exit 0
5939    fi
5940    ;;
5941
5942  # libtool clean and uninstall mode
5943  clean | uninstall)
5944    modename="$modename: $mode"
5945    rm="$nonopt"
5946    files=
5947    rmforce=
5948    exit_status=0
5949
5950    # This variable tells wrapper scripts just to set variables rather
5951    # than running their programs.
5952    libtool_install_magic="$magic"
5953
5954    for arg
5955    do
5956      case $arg in
5957      -f) rm="$rm $arg"; rmforce=yes ;;
5958      -*) rm="$rm $arg" ;;
5959      *) files="$files $arg" ;;
5960      esac
5961    done
5962
5963    if test -z "$rm"; then
5964      $echo "$modename: you must specify an RM program" 1>&2
5965      $echo "$help" 1>&2
5966      exit 1
5967    fi
5968
5969    rmdirs=
5970
5971    origobjdir="$objdir"
5972    for file in $files; do
5973      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5974      if test "X$dir" = "X$file"; then
5975	dir=.
5976	objdir="$origobjdir"
5977      else
5978	objdir="$dir/$origobjdir"
5979      fi
5980      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5981      test "$mode" = uninstall && objdir="$dir"
5982
5983      # Remember objdir for removal later, being careful to avoid duplicates
5984      if test "$mode" = clean; then
5985	case " $rmdirs " in
5986	  *" $objdir "*) ;;
5987	  *) rmdirs="$rmdirs $objdir" ;;
5988	esac
5989      fi
5990
5991      # Don't error if the file doesn't exist and rm -f was used.
5992      if (test -L "$file") >/dev/null 2>&1 \
5993	|| (test -h "$file") >/dev/null 2>&1 \
5994	|| test -f "$file"; then
5995	:
5996      elif test -d "$file"; then
5997	exit_status=1
5998	continue
5999      elif test "$rmforce" = yes; then
6000	continue
6001      fi
6002
6003      rmfiles="$file"
6004
6005      case $name in
6006      *.la)
6007	# Possibly a libtool archive, so verify it.
6008	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6009	  . $dir/$name
6010
6011	  # Delete the libtool libraries and symlinks.
6012	  for n in $library_names; do
6013	    rmfiles="$rmfiles $objdir/$n"
6014	  done
6015	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6016	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6017
6018	  if test "$mode" = uninstall; then
6019	    if test -n "$library_names"; then
6020	      # Do each command in the postuninstall commands.
6021	      eval cmds=\"$postuninstall_cmds\"
6022	      save_ifs="$IFS"; IFS='~'
6023	      for cmd in $cmds; do
6024		IFS="$save_ifs"
6025		$show "$cmd"
6026		$run eval "$cmd"
6027		if test "$?" -ne 0 && test "$rmforce" != yes; then
6028		  exit_status=1
6029		fi
6030	      done
6031	      IFS="$save_ifs"
6032	    fi
6033
6034	    if test -n "$old_library"; then
6035	      # Do each command in the old_postuninstall commands.
6036	      eval cmds=\"$old_postuninstall_cmds\"
6037	      save_ifs="$IFS"; IFS='~'
6038	      for cmd in $cmds; do
6039		IFS="$save_ifs"
6040		$show "$cmd"
6041		$run eval "$cmd"
6042		if test "$?" -ne 0 && test "$rmforce" != yes; then
6043		  exit_status=1
6044		fi
6045	      done
6046	      IFS="$save_ifs"
6047	    fi
6048	    # FIXME: should reinstall the best remaining shared library.
6049	  fi
6050	fi
6051	;;
6052
6053      *.lo)
6054	# Possibly a libtool object, so verify it.
6055	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6056
6057	  # Read the .lo file
6058	  . $dir/$name
6059
6060	  # Add PIC object to the list of files to remove.
6061	  if test -n "$pic_object" \
6062	     && test "$pic_object" != none; then
6063	    rmfiles="$rmfiles $dir/$pic_object"
6064	  fi
6065
6066	  # Add non-PIC object to the list of files to remove.
6067	  if test -n "$non_pic_object" \
6068	     && test "$non_pic_object" != none; then
6069	    rmfiles="$rmfiles $dir/$non_pic_object"
6070	  fi
6071	fi
6072	;;
6073
6074      *)
6075	if test "$mode" = clean ; then
6076	  noexename=$name
6077	  case $file in
6078	  *.exe)
6079	    file=`$echo $file|${SED} 's,.exe$,,'`
6080	    noexename=`$echo $name|${SED} 's,.exe$,,'`
6081	    # $file with .exe has already been added to rmfiles,
6082	    # add $file without .exe
6083	    rmfiles="$rmfiles $file"
6084	    ;;
6085	  esac
6086	  # Do a test to see if this is a libtool program.
6087	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6088	    relink_command=
6089	    . $dir/$noexename
6090
6091	    # note $name still contains .exe if it was in $file originally
6092	    # as does the version of $file that was added into $rmfiles
6093	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6094	    if test "$fast_install" = yes && test -n "$relink_command"; then
6095	      rmfiles="$rmfiles $objdir/lt-$name"
6096	    fi
6097	    if test "X$noexename" != "X$name" ; then
6098	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6099	    fi
6100	  fi
6101	fi
6102	;;
6103      esac
6104      $show "$rm $rmfiles"
6105      $run $rm $rmfiles || exit_status=1
6106    done
6107    objdir="$origobjdir"
6108
6109    # Try to remove the ${objdir}s in the directories where we deleted files
6110    for dir in $rmdirs; do
6111      if test -d "$dir"; then
6112	$show "rmdir $dir"
6113	$run rmdir $dir >/dev/null 2>&1
6114      fi
6115    done
6116
6117    exit $exit_status
6118    ;;
6119
6120  "")
6121    $echo "$modename: you must specify a MODE" 1>&2
6122    $echo "$generic_help" 1>&2
6123    exit 1
6124    ;;
6125  esac
6126
6127  if test -z "$exec_cmd"; then
6128    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6129    $echo "$generic_help" 1>&2
6130    exit 1
6131  fi
6132fi # test -z "$show_help"
6133
6134if test -n "$exec_cmd"; then
6135  eval exec $exec_cmd
6136  exit 1
6137fi
6138
6139# We need to display help for each of the modes.
6140case $mode in
6141"") $echo \
6142"Usage: $modename [OPTION]... [MODE-ARG]...
6143
6144Provide generalized library-building support services.
6145
6146    --config          show all configuration variables
6147    --debug           enable verbose shell tracing
6148-n, --dry-run         display commands without modifying any files
6149    --features        display basic configuration information and exit
6150    --finish          same as \`--mode=finish'
6151    --help            display this help message and exit
6152    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
6153    --quiet           same as \`--silent'
6154    --silent          don't print informational messages
6155    --tag=TAG         use configuration variables from tag TAG
6156    --version         print version information
6157
6158MODE must be one of the following:
6159
6160      clean           remove files from the build directory
6161      compile         compile a source file into a libtool object
6162      execute         automatically set library path, then run a program
6163      finish          complete the installation of libtool libraries
6164      install         install libraries or executables
6165      link            create a library or an executable
6166      uninstall       remove libraries from an installed directory
6167
6168MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
6169a more detailed description of MODE.
6170
6171Report bugs to <bug-libtool@gnu.org>."
6172  exit 0
6173  ;;
6174
6175clean)
6176  $echo \
6177"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6178
6179Remove files from the build directory.
6180
6181RM is the name of the program to use to delete files associated with each FILE
6182(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6183to RM.
6184
6185If FILE is a libtool library, object or program, all the files associated
6186with it are deleted. Otherwise, only FILE itself is deleted using RM."
6187  ;;
6188
6189compile)
6190  $echo \
6191"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6192
6193Compile a source file into a libtool library object.
6194
6195This mode accepts the following additional options:
6196
6197  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
6198  -prefer-pic       try to building PIC objects only
6199  -prefer-non-pic   try to building non-PIC objects only
6200  -static           always build a \`.o' file suitable for static linking
6201
6202COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6203from the given SOURCEFILE.
6204
6205The output file name is determined by removing the directory component from
6206SOURCEFILE, then substituting the C source code suffix \`.c' with the
6207library object suffix, \`.lo'."
6208  ;;
6209
6210execute)
6211  $echo \
6212"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6213
6214Automatically set library path, then run a program.
6215
6216This mode accepts the following additional options:
6217
6218  -dlopen FILE      add the directory containing FILE to the library path
6219
6220This mode sets the library path environment variable according to \`-dlopen'
6221flags.
6222
6223If any of the ARGS are libtool executable wrappers, then they are translated
6224into their corresponding uninstalled binary, and any of their required library
6225directories are added to the library path.
6226
6227Then, COMMAND is executed, with ARGS as arguments."
6228  ;;
6229
6230finish)
6231  $echo \
6232"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6233
6234Complete the installation of libtool libraries.
6235
6236Each LIBDIR is a directory that contains libtool libraries.
6237
6238The commands that this mode executes may require superuser privileges.  Use
6239the \`--dry-run' option if you just want to see what would be executed."
6240  ;;
6241
6242install)
6243  $echo \
6244"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6245
6246Install executables or libraries.
6247
6248INSTALL-COMMAND is the installation command.  The first component should be
6249either the \`install' or \`cp' program.
6250
6251The rest of the components are interpreted as arguments to that command (only
6252BSD-compatible install options are recognized)."
6253  ;;
6254
6255link)
6256  $echo \
6257"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6258
6259Link object files or libraries together to form another library, or to
6260create an executable program.
6261
6262LINK-COMMAND is a command using the C compiler that you would use to create
6263a program from several object files.
6264
6265The following components of LINK-COMMAND are treated specially:
6266
6267  -all-static       do not do any dynamic linking at all
6268  -avoid-version    do not add a version suffix if possible
6269  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
6270  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6271  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6272  -export-symbols SYMFILE
6273		    try to export only the symbols listed in SYMFILE
6274  -export-symbols-regex REGEX
6275		    try to export only the symbols matching REGEX
6276  -LLIBDIR          search LIBDIR for required installed libraries
6277  -lNAME            OUTPUT-FILE requires the installed library libNAME
6278  -module           build a library that can dlopened
6279  -no-fast-install  disable the fast-install mode
6280  -no-install       link a not-installable executable
6281  -no-undefined     declare that a library does not refer to external symbols
6282  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6283  -objectlist FILE  Use a list of object files found in FILE to specify objects
6284  -release RELEASE  specify package release information
6285  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6286  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6287  -static           do not do any dynamic linking of libtool libraries
6288  -version-info CURRENT[:REVISION[:AGE]]
6289		    specify library version info [each variable defaults to 0]
6290
6291All other options (arguments beginning with \`-') are ignored.
6292
6293Every other argument is treated as a filename.  Files ending in \`.la' are
6294treated as uninstalled libtool libraries, other files are standard or library
6295object files.
6296
6297If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6298only library objects (\`.lo' files) may be specified, and \`-rpath' is
6299required, except when creating a convenience library.
6300
6301If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6302using \`ar' and \`ranlib', or on Windows using \`lib'.
6303
6304If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6305is created, otherwise an executable program is created."
6306  ;;
6307
6308uninstall)
6309  $echo \
6310"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6311
6312Remove libraries from an installation directory.
6313
6314RM is the name of the program to use to delete files associated with each FILE
6315(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6316to RM.
6317
6318If FILE is a libtool library, all the files associated with it are deleted.
6319Otherwise, only FILE itself is deleted using RM."
6320  ;;
6321
6322*)
6323  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6324  $echo "$help" 1>&2
6325  exit 1
6326  ;;
6327esac
6328
6329$echo
6330$echo "Try \`$modename --help' for more information about other modes."
6331
6332exit 0
6333
6334# The TAGs below are defined such that we never get into a situation
6335# in which we disable both kinds of libraries.  Given conflicting
6336# choices, we go for a static library, that is the most portable,
6337# since we can't tell whether shared libraries were disabled because
6338# the user asked for that or because the platform doesn't support
6339# them.  This is particularly important on AIX, because we don't
6340# support having both static and shared libraries enabled at the same
6341# time on that platform, so we default to a shared-only configuration.
6342# If a disable-shared tag is given, we'll fallback to a static-only
6343# configuration.  But we'll never go from static-only to shared-only.
6344
6345# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6346build_libtool_libs=no
6347build_old_libs=yes
6348# ### END LIBTOOL TAG CONFIG: disable-shared
6349
6350# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6351build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6352# ### END LIBTOOL TAG CONFIG: disable-static
6353
6354# Local Variables:
6355# mode:shell-script
6356# sh-indentation:2
6357# End:
6358