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