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