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