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