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