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