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