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