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