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