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