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