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, 2003
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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.5a
59TIMESTAMP=" (1.1240 2003/06/26 06:55:19)"
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# test EBCDIC or ASCII
73case `echo A|tr A '\301'` in
74 A) # EBCDIC based system
75  SP2NL="tr '\100' '\n'"
76  NL2SP="tr '\r\n' '\100\100'"
77  ;;
78 *) # Assume ASCII based system
79  SP2NL="tr '\040' '\012'"
80  NL2SP="tr '\015\012' '\040\040'"
81  ;;
82esac
83
84# NLS nuisances.
85# Only set LANG and LC_ALL to C if already set.
86# These must not be set unconditionally because not all systems understand
87# e.g. LANG=C (notably SCO).
88# We save the old values to restore during execute mode.
89if test "${LC_ALL+set}" = set; then
90  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
91fi
92if test "${LANG+set}" = set; then
93  save_LANG="$LANG"; LANG=C; export LANG
94fi
95
96# Make sure IFS has a sensible default
97: ${IFS=" 	"}
98
99if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
100  $echo "$modename: not configured to build any kind of library" 1>&2
101  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
102  exit 1
103fi
104
105# Global variables.
106mode=$default_mode
107nonopt=
108prev=
109prevopt=
110run=
111show="$echo"
112show_help=
113execute_dlfiles=
114lo2o="s/\\.lo\$/.${objext}/"
115o2lo="s/\\.${objext}\$/.lo/"
116
117#####################################
118# Shell function definitions:
119# This seems to be the best place for them
120
121# Need a lot of goo to handle *both* DLLs and import libs
122# Has to be a shell function in order to 'eat' the argument
123# that is supplied when $file_magic_command is called.
124win32_libid () {
125  win32_libid_type="unknown"
126  win32_fileres=`file -L $1 2>/dev/null`
127  case $win32_fileres in
128  *ar\ archive\ import\ library*) # definitely import
129    win32_libid_type="x86 archive import"
130    ;;
131  *ar\ archive*) # could be an import, or static
132    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
133      grep -E 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
134      win32_nmres=`eval $NM -f posix -A $1 | \
135	sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
136      if test "X$win32_nmres" = "Ximport" ; then
137        win32_libid_type="x86 archive import"
138      else
139        win32_libid_type="x86 archive static"
140      fi
141    fi
142    ;;
143  *DLL*)
144    win32_libid_type="x86 DLL"
145    ;;
146  *executable*) # but shell scripts are "executable" too...
147    case $win32_fileres in
148    *MS\ Windows\ PE\ Intel*)
149      win32_libid_type="x86 DLL"
150      ;;
151    esac
152    ;;
153  esac
154  $echo $win32_libid_type
155}
156
157# End of Shell function definitions
158#####################################
159
160# Parse our command line options once, thoroughly.
161while test "$#" -gt 0
162do
163  arg="$1"
164  shift
165
166  case $arg in
167  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
168  *) optarg= ;;
169  esac
170
171  # If the previous option needs an argument, assign it.
172  if test -n "$prev"; then
173    case $prev in
174    execute_dlfiles)
175      execute_dlfiles="$execute_dlfiles $arg"
176      ;;
177    tag)
178      tagname="$arg"
179
180      # Check whether tagname contains only valid characters
181      case $tagname in
182      *[!-_A-Za-z0-9,/]*)
183	$echo "$progname: invalid tag name: $tagname" 1>&2
184	exit 1
185	;;
186      esac
187
188      case $tagname in
189      CC)
190	# Don't test for the "default" C tag, as we know, it's there, but
191	# not specially marked.
192	;;
193      *)
194	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$0" > /dev/null; then
195	  taglist="$taglist $tagname"
196	  # Evaluate the configuration.
197	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $0`"
198	else
199	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
200	fi
201	;;
202      esac
203      ;;
204    *)
205      eval "$prev=\$arg"
206      ;;
207    esac
208
209    prev=
210    prevopt=
211    continue
212  fi
213
214  # Have we seen a non-optional argument yet?
215  case $arg in
216  --help)
217    show_help=yes
218    ;;
219
220  --version)
221    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
222    $echo
223    $echo "Copyright (C) 2003  Free Software Foundation, Inc."
224    $echo "This is free software; see the source for copying conditions.  There is NO"
225    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
226    exit 0
227    ;;
228
229  --config)
230    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $0
231    # Now print the configurations for the tags.
232    for tagname in $taglist; do
233      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$0"
234    done
235    exit 0
236    ;;
237
238  --debug)
239    $echo "$progname: enabling shell trace mode"
240    set -x
241    ;;
242
243  --dry-run | -n)
244    run=:
245    ;;
246
247  --features)
248    $echo "host: $host"
249    if test "$build_libtool_libs" = yes; then
250      $echo "enable shared libraries"
251    else
252      $echo "disable shared libraries"
253    fi
254    if test "$build_old_libs" = yes; then
255      $echo "enable static libraries"
256    else
257      $echo "disable static libraries"
258    fi
259    exit 0
260    ;;
261
262  --finish) mode="finish" ;;
263
264  --mode) prevopt="--mode" prev=mode ;;
265  --mode=*) mode="$optarg" ;;
266
267  --preserve-dup-deps) duplicate_deps="yes" ;;
268
269  --quiet | --silent)
270    show=:
271    ;;
272
273  --tag) prevopt="--tag" prev=tag ;;
274  --tag=*)
275    set tag "$optarg" ${1+"$@"}
276    shift
277    prev=tag
278    ;;
279
280  -dlopen)
281    prevopt="-dlopen"
282    prev=execute_dlfiles
283    ;;
284
285  -*)
286    $echo "$modename: unrecognized option \`$arg'" 1>&2
287    $echo "$help" 1>&2
288    exit 1
289    ;;
290
291  *)
292    nonopt="$arg"
293    break
294    ;;
295  esac
296done
297
298if test -n "$prevopt"; then
299  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
300  $echo "$help" 1>&2
301  exit 1
302fi
303
304# If this variable is set in any of the actions, the command in it
305# will be execed at the end.  This prevents here-documents from being
306# left over by shells.
307exec_cmd=
308
309if test -z "$show_help"; then
310
311  # Infer the operation mode.
312  if test -z "$mode"; then
313    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
314    $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2
315    case $nonopt in
316    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
317      mode=link
318      for arg
319      do
320	case $arg in
321	-c)
322	   mode=compile
323	   break
324	   ;;
325	esac
326      done
327      ;;
328    *db | *dbx | *strace | *truss)
329      mode=execute
330      ;;
331    *install*|cp|mv)
332      mode=install
333      ;;
334    *rm)
335      mode=uninstall
336      ;;
337    *)
338      # If we have no mode, but dlfiles were specified, then do execute mode.
339      test -n "$execute_dlfiles" && mode=execute
340
341      # Just use the default operation mode.
342      if test -z "$mode"; then
343	if test -n "$nonopt"; then
344	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
345	else
346	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
347	fi
348      fi
349      ;;
350    esac
351  fi
352
353  # Only execute mode is allowed to have -dlopen flags.
354  if test -n "$execute_dlfiles" && test "$mode" != execute; then
355    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
356    $echo "$help" 1>&2
357    exit 1
358  fi
359
360  # Change the help message to a mode-specific one.
361  generic_help="$help"
362  help="Try \`$modename --help --mode=$mode' for more information."
363
364  # These modes are in order of execution frequency so that they run quickly.
365  case $mode in
366  # libtool compile mode
367  compile)
368    modename="$modename: compile"
369    # Get the compilation command and the source file.
370    base_compile=
371    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
372    suppress_output=
373    arg_mode=normal
374    libobj=
375
376    for arg
377    do
378      case "$arg_mode" in
379      arg  )
380	# do not "continue".  Instead, add this to base_compile
381	lastarg="$arg"
382	arg_mode=normal
383	;;
384
385      target )
386	libobj="$arg"
387	arg_mode=normal
388	continue
389	;;
390
391      normal )
392	# Accept any command-line options.
393	case $arg in
394	-o)
395	  if test -n "$libobj" ; then
396	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
397	    exit 1
398	  fi
399	  arg_mode=target
400	  continue
401	  ;;
402
403	-static)
404	  build_old_libs=yes
405	  continue
406	  ;;
407
408	-prefer-pic)
409	  pic_mode=yes
410	  continue
411	  ;;
412
413	-prefer-non-pic)
414	  pic_mode=no
415	  continue
416	  ;;
417
418	-Xcompiler)
419	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
420	  continue      #  The current "srcfile" will either be retained or
421	  ;;            #  replaced later.  I would guess that would be a bug.
422
423	-Wc,*)
424	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
425	  lastarg=
426	  save_ifs="$IFS"; IFS=','
427	  for arg in $args; do
428	    IFS="$save_ifs"
429
430	    # Double-quote args containing other shell metacharacters.
431	    # Many Bourne shells cannot handle close brackets correctly
432	    # in scan sets, so we specify it separately.
433	    case $arg in
434	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
435	      arg="\"$arg\""
436	      ;;
437	    esac
438	    lastarg="$lastarg $arg"
439	  done
440	  IFS="$save_ifs"
441	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
442
443	  # Add the arguments to base_compile.
444	  base_compile="$base_compile $lastarg"
445	  continue
446	  ;;
447
448	* )
449	  # Accept the current argument as the source file.
450	  # The previous "srcfile" becomes the current argument.
451	  #
452	  lastarg="$srcfile"
453	  srcfile="$arg"
454	  ;;
455	esac  #  case $arg
456	;;
457      esac    #  case $arg_mode
458
459      # Aesthetically quote the previous argument.
460      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
461
462      case $lastarg in
463      # Double-quote args containing other shell metacharacters.
464      # Many Bourne shells cannot handle close brackets correctly
465      # in scan sets, so we specify it separately.
466      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
467	lastarg="\"$lastarg\""
468	;;
469      esac
470
471      base_compile="$base_compile $lastarg"
472    done # for arg
473
474    case $arg_mode in
475    arg)
476      $echo "$modename: you must specify an argument for -Xcompile"
477      exit 1
478      ;;
479    target)
480      $echo "$modename: you must specify a target with \`-o'" 1>&2
481      exit 1
482      ;;
483    *)
484      # Get the name of the library object.
485      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
486      ;;
487    esac
488
489    # Recognize several different file suffixes.
490    # If the user specifies -o file.o, it is replaced with file.lo
491    xform='[cCFSifmso]'
492    case $libobj in
493    *.ada) xform=ada ;;
494    *.adb) xform=adb ;;
495    *.ads) xform=ads ;;
496    *.asm) xform=asm ;;
497    *.c++) xform=c++ ;;
498    *.cc) xform=cc ;;
499    *.ii) xform=ii ;;
500    *.class) xform=class ;;
501    *.cpp) xform=cpp ;;
502    *.cxx) xform=cxx ;;
503    *.f90) xform=f90 ;;
504    *.for) xform=for ;;
505    *.java) xform=java ;;
506    esac
507
508    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
509
510    case $libobj in
511    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
512    *)
513      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
514      exit 1
515      ;;
516    esac
517
518    # Infer tagged configuration to use if any are available and
519    # if one wasn't chosen via the "--tag" command line option.
520    # Only attempt this if the compiler in the base compile
521    # command doesn't match the default compiler.
522    if test -n "$available_tags" && test -z "$tagname"; then
523      case $base_compile in
524      # Blanks in the command may have been stripped by the calling shell,
525      # but not from the CC environment variable when configure was run.
526      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "*) ;;
527      # Blanks at the start of $base_compile will cause this to fail
528      # if we don't check for them as well.
529      *)
530	for z in $available_tags; do
531	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
532	    # Evaluate the configuration.
533	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
534	    case "$base_compile " in
535	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
536	      # The compiler in the base compile command matches
537	      # the one in the tagged configuration.
538	      # Assume this is the tagged configuration we want.
539	      tagname=$z
540	      break
541	      ;;
542	    esac
543	  fi
544	done
545	# If $tagname still isn't set, then no tagged configuration
546	# was found and let the user know that the "--tag" command
547	# line option must be used.
548	if test -z "$tagname"; then
549	  $echo "$modename: unable to infer tagged configuration"
550	  $echo "$modename: specify a tag with \`--tag'" 1>&2
551	  exit 1
552#        else
553#          $echo "$modename: using $tagname tagged configuration"
554	fi
555	;;
556      esac
557    fi
558
559    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
560    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
561    if test "X$xdir" = "X$obj"; then
562      xdir=
563    else
564      xdir=$xdir/
565    fi
566    lobj=${xdir}$objdir/$objname
567
568    if test -z "$base_compile"; then
569      $echo "$modename: you must specify a compilation command" 1>&2
570      $echo "$help" 1>&2
571      exit 1
572    fi
573
574    # Delete any leftover library objects.
575    if test "$build_old_libs" = yes; then
576      removelist="$obj $lobj $libobj ${libobj}T"
577    else
578      removelist="$lobj $libobj ${libobj}T"
579    fi
580
581    $run $rm $removelist
582    trap "$run $rm $removelist; exit 1" 1 2 15
583
584    # On Cygwin there's no "real" PIC flag so we must build both object types
585    case $host_os in
586    cygwin* | mingw* | pw32* | os2*)
587      pic_mode=default
588      ;;
589    esac
590    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
591      # non-PIC code in shared libraries is not supported
592      pic_mode=default
593    fi
594
595    # Calculate the filename of the output object if compiler does
596    # not support -o with -c
597    if test "$compiler_c_o" = no; then
598      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
599      lockfile="$output_obj.lock"
600      removelist="$removelist $output_obj $lockfile"
601      trap "$run $rm $removelist; exit 1" 1 2 15
602    else
603      output_obj=
604      need_locks=no
605      lockfile=
606    fi
607
608    # Lock this critical section if it is needed
609    # We use this script file to make the link, it avoids creating a new file
610    if test "$need_locks" = yes; then
611      until $run ln "$0" "$lockfile" 2>/dev/null; do
612	$show "Waiting for $lockfile to be removed"
613	sleep 2
614      done
615    elif test "$need_locks" = warn; then
616      if test -f "$lockfile"; then
617	$echo "\
618*** ERROR, $lockfile exists and contains:
619`cat $lockfile 2>/dev/null`
620
621This indicates that another process is trying to use the same
622temporary object file, and libtool could not work around it because
623your compiler does not support \`-c' and \`-o' together.  If you
624repeat this compilation, it may succeed, by chance, but you had better
625avoid parallel builds (make -j) in this platform, or get a better
626compiler."
627
628	$run $rm $removelist
629	exit 1
630      fi
631      $echo $srcfile > "$lockfile"
632    fi
633
634    if test -n "$fix_srcfile_path"; then
635      eval srcfile=\"$fix_srcfile_path\"
636    fi
637
638    $run $rm "$libobj" "${libobj}T"
639
640    # Create a libtool object file (analogous to a ".la" file),
641    # but don't create it if we're doing a dry run.
642    test -z "$run" && cat > ${libobj}T <<EOF
643# $libobj - a libtool object file
644# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
645#
646# Please DO NOT delete this file!
647# It is necessary for linking the library.
648
649# Name of the PIC object.
650EOF
651
652    # Only build a PIC object if we are building libtool libraries.
653    if test "$build_libtool_libs" = yes; then
654      # Without this assignment, base_compile gets emptied.
655      fbsd_hideous_sh_bug=$base_compile
656
657      if test "$pic_mode" != no; then
658	command="$base_compile $srcfile $pic_flag"
659      else
660	# Don't build PIC code
661	command="$base_compile $srcfile"
662      fi
663
664      if test ! -d "${xdir}$objdir"; then
665	$show "$mkdir ${xdir}$objdir"
666	$run $mkdir ${xdir}$objdir
667	status=$?
668	if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
669	  exit $status
670	fi
671      fi
672
673      if test -z "$output_obj"; then
674	# Place PIC objects in $objdir
675	command="$command -o $lobj"
676      fi
677
678      $run $rm "$lobj" "$output_obj"
679
680      $show "$command"
681      if $run eval "$command"; then :
682      else
683	test -n "$output_obj" && $run $rm $removelist
684	exit 1
685      fi
686
687      if test "$need_locks" = warn &&
688	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
689	$echo "\
690*** ERROR, $lockfile contains:
691`cat $lockfile 2>/dev/null`
692
693but it should contain:
694$srcfile
695
696This indicates that another process is trying to use the same
697temporary object file, and libtool could not work around it because
698your compiler does not support \`-c' and \`-o' together.  If you
699repeat this compilation, it may succeed, by chance, but you had better
700avoid parallel builds (make -j) in this platform, or get a better
701compiler."
702
703	$run $rm $removelist
704	exit 1
705      fi
706
707      # Just move the object if needed, then go on to compile the next one
708      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
709	$show "$mv $output_obj $lobj"
710	if $run $mv $output_obj $lobj; then :
711	else
712	  error=$?
713	  $run $rm $removelist
714	  exit $error
715	fi
716      fi
717
718      # Append the name of the PIC object to the libtool object file.
719      test -z "$run" && cat >> ${libobj}T <<EOF
720pic_object='$objdir/$objname'
721
722EOF
723
724      # Allow error messages only from the first compilation.
725      suppress_output=' >/dev/null 2>&1'
726    else
727      # No PIC object so indicate it doesn't exist in the libtool
728      # object file.
729      test -z "$run" && cat >> ${libobj}T <<EOF
730pic_object=none
731
732EOF
733    fi
734
735    # Only build a position-dependent object if we build old libraries.
736    if test "$build_old_libs" = yes; then
737      if test "$pic_mode" != yes; then
738	# Don't build PIC code
739	command="$base_compile $srcfile"
740      else
741	command="$base_compile $srcfile $pic_flag"
742      fi
743      if test "$compiler_c_o" = yes; then
744	command="$command -o $obj"
745      fi
746
747      # Suppress compiler output if we already did a PIC compilation.
748      command="$command$suppress_output"
749      $run $rm "$obj" "$output_obj"
750      $show "$command"
751      if $run eval "$command"; then :
752      else
753	$run $rm $removelist
754	exit 1
755      fi
756
757      if test "$need_locks" = warn &&
758	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
759	$echo "\
760*** ERROR, $lockfile contains:
761`cat $lockfile 2>/dev/null`
762
763but it should contain:
764$srcfile
765
766This indicates that another process is trying to use the same
767temporary object file, and libtool could not work around it because
768your compiler does not support \`-c' and \`-o' together.  If you
769repeat this compilation, it may succeed, by chance, but you had better
770avoid parallel builds (make -j) in this platform, or get a better
771compiler."
772
773	$run $rm $removelist
774	exit 1
775      fi
776
777      # Just move the object if needed
778      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
779	$show "$mv $output_obj $obj"
780	if $run $mv $output_obj $obj; then :
781	else
782	  error=$?
783	  $run $rm $removelist
784	  exit $error
785	fi
786      fi
787
788      # Append the name of the non-PIC object the libtool object file.
789      # Only append if the libtool object file exists.
790      test -z "$run" && cat >> ${libobj}T <<EOF
791# Name of the non-PIC object.
792non_pic_object='$objname'
793
794EOF
795    else
796      # Append the name of the non-PIC object the libtool object file.
797      # Only append if the libtool object file exists.
798      test -z "$run" && cat >> ${libobj}T <<EOF
799# Name of the non-PIC object.
800non_pic_object=none
801
802EOF
803    fi
804
805    $run $mv "${libobj}T" "${libobj}"
806
807    # Unlock the critical section if it was locked
808    if test "$need_locks" != no; then
809      $run $rm "$lockfile"
810    fi
811
812    exit 0
813    ;;
814
815  # libtool link mode
816  link | relink)
817    modename="$modename: link"
818    case $host in
819    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
820      # It is impossible to link a dll without this setting, and
821      # we shouldn't force the makefile maintainer to figure out
822      # which system we are compiling for in order to pass an extra
823      # flag for every libtool invocation.
824      # allow_undefined=no
825
826      # FIXME: Unfortunately, there are problems with the above when trying
827      # to make a dll which has undefined symbols, in which case not
828      # even a static library is built.  For now, we need to specify
829      # -no-undefined on the libtool link line when we can be certain
830      # that all symbols are satisfied, otherwise we get a static library.
831      allow_undefined=yes
832      ;;
833    *)
834      allow_undefined=yes
835      ;;
836    esac
837    libtool_args="$nonopt"
838    base_compile="$nonopt"
839    compile_command="$nonopt"
840    finalize_command="$nonopt"
841
842    compile_rpath=
843    finalize_rpath=
844    compile_shlibpath=
845    finalize_shlibpath=
846    convenience=
847    old_convenience=
848    deplibs=
849    old_deplibs=
850    add_flags=
851    compiler_flags=
852    linker_flags=
853    dllsearchpath=
854    lib_search_path=`pwd`
855    inst_prefix_dir=
856
857    avoid_version=no
858    dlfiles=
859    dlprefiles=
860    dlself=no
861    export_dynamic=no
862    export_symbols=
863    export_symbols_regex=
864    generated=
865    libobjs=
866    ltlibs=
867    module=no
868    no_install=no
869    objs=
870    non_pic_objects=
871    prefer_static_libs=no
872    preload=no
873    prev=
874    prevarg=
875    release=
876    rpath=
877    xrpath=
878    perm_rpath=
879    temp_rpath=
880    thread_safe=no
881    vinfo=
882    vinfo_number=no
883
884    # We need to know -static, to get the right output filenames.
885    for arg
886    do
887      case $arg in
888      -all-static | -static)
889	if test "X$arg" = "X-all-static"; then
890	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
891	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
892	  fi
893	  if test -n "$link_static_flag"; then
894	    dlopen_self=$dlopen_self_static
895	  fi
896	else
897	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
898	    dlopen_self=$dlopen_self_static
899	  fi
900	fi
901	build_libtool_libs=no
902	build_old_libs=yes
903	prefer_static_libs=yes
904	break
905	;;
906      esac
907    done
908
909    # See if our shared archives depend on static archives.
910    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
911
912    # Go through the arguments, transforming them on the way.
913    while test "$#" -gt 0; do
914      arg="$1"
915      base_compile="$base_compile $arg"
916      shift
917      case $arg in
918      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
919	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
920	;;
921      *) qarg=$arg ;;
922      esac
923      libtool_args="$libtool_args $qarg"
924
925      # If the previous option needs an argument, assign it.
926      if test -n "$prev"; then
927	case $prev in
928	output)
929	  compile_command="$compile_command @OUTPUT@"
930	  finalize_command="$finalize_command @OUTPUT@"
931	  ;;
932	esac
933
934	case $prev in
935	dlfiles|dlprefiles)
936	  if test "$preload" = no; then
937	    # Add the symbol object into the linking commands.
938	    compile_command="$compile_command @SYMFILE@"
939	    finalize_command="$finalize_command @SYMFILE@"
940	    preload=yes
941	  fi
942	  case $arg in
943	  *.la | *.lo) ;;  # We handle these cases below.
944	  force)
945	    if test "$dlself" = no; then
946	      dlself=needless
947	      export_dynamic=yes
948	    fi
949	    prev=
950	    continue
951	    ;;
952	  self)
953	    if test "$prev" = dlprefiles; then
954	      dlself=yes
955	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
956	      dlself=yes
957	    else
958	      dlself=needless
959	      export_dynamic=yes
960	    fi
961	    prev=
962	    continue
963	    ;;
964	  *)
965	    if test "$prev" = dlfiles; then
966	      dlfiles="$dlfiles $arg"
967	    else
968	      dlprefiles="$dlprefiles $arg"
969	    fi
970	    prev=
971	    continue
972	    ;;
973	  esac
974	  ;;
975	expsyms)
976	  export_symbols="$arg"
977	  if test ! -f "$arg"; then
978	    $echo "$modename: symbol file \`$arg' does not exist"
979	    exit 1
980	  fi
981	  prev=
982	  continue
983	  ;;
984	expsyms_regex)
985	  export_symbols_regex="$arg"
986	  prev=
987	  continue
988	  ;;
989	inst_prefix)
990	  inst_prefix_dir="$arg"
991	  prev=
992	  continue
993	  ;;
994	release)
995	  release="-$arg"
996	  prev=
997	  continue
998	  ;;
999	objectlist)
1000	  if test -f "$arg"; then
1001	    save_arg=$arg
1002	    moreargs=
1003	    for fil in `cat $save_arg`
1004	    do
1005#	      moreargs="$moreargs $fil"
1006	      arg=$fil
1007	      # A libtool-controlled object.
1008
1009	      # Check to see that this really is a libtool object.
1010	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1011		pic_object=
1012		non_pic_object=
1013
1014		# Read the .lo file
1015		# If there is no directory component, then add one.
1016		case $arg in
1017		*/* | *\\*) . $arg ;;
1018		*) . ./$arg ;;
1019		esac
1020
1021		if test -z "$pic_object" || \
1022		   test -z "$non_pic_object" ||
1023		   test "$pic_object" = none && \
1024		   test "$non_pic_object" = none; then
1025		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1026		  exit 1
1027		fi
1028
1029		# Extract subdirectory from the argument.
1030		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1031		if test "X$xdir" = "X$arg"; then
1032		  xdir=
1033		else
1034		  xdir="$xdir/"
1035		fi
1036
1037		if test "$pic_object" != none; then
1038		  # Prepend the subdirectory the object is found in.
1039		  pic_object="$xdir$pic_object"
1040
1041		  if test "$prev" = dlfiles; then
1042		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1043		      dlfiles="$dlfiles $pic_object"
1044		      prev=
1045		      continue
1046		    else
1047		      # If libtool objects are unsupported, then we need to preload.
1048		      prev=dlprefiles
1049		    fi
1050		  fi
1051
1052		  # CHECK ME:  I think I busted this.  -Ossama
1053		  if test "$prev" = dlprefiles; then
1054		    # Preload the old-style object.
1055		    dlprefiles="$dlprefiles $pic_object"
1056		    prev=
1057		  fi
1058
1059		  # A PIC object.
1060		  libobjs="$libobjs $pic_object"
1061		  arg="$pic_object"
1062		fi
1063
1064		# Non-PIC object.
1065		if test "$non_pic_object" != none; then
1066		  # Prepend the subdirectory the object is found in.
1067		  non_pic_object="$xdir$non_pic_object"
1068
1069		  # A standard non-PIC object
1070		  non_pic_objects="$non_pic_objects $non_pic_object"
1071		  if test -z "$pic_object" || test "$pic_object" = none ; then
1072		    arg="$non_pic_object"
1073		  fi
1074		fi
1075	      else
1076		# Only an error if not doing a dry-run.
1077		if test -z "$run"; then
1078		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1079		  exit 1
1080		else
1081		  # Dry-run case.
1082
1083		  # Extract subdirectory from the argument.
1084		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1085		  if test "X$xdir" = "X$arg"; then
1086		    xdir=
1087		  else
1088		    xdir="$xdir/"
1089		  fi
1090
1091		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1092		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1093		  libobjs="$libobjs $pic_object"
1094		  non_pic_objects="$non_pic_objects $non_pic_object"
1095		fi
1096	      fi
1097	    done
1098	  else
1099	    $echo "$modename: link input file \`$save_arg' does not exist"
1100	    exit 1
1101	  fi
1102	  arg=$save_arg
1103	  prev=
1104	  continue
1105	  ;;
1106	rpath | xrpath)
1107	  # We need an absolute path.
1108	  case $arg in
1109	  [\\/]* | [A-Za-z]:[\\/]*) ;;
1110	  *)
1111	    $echo "$modename: only absolute run-paths are allowed" 1>&2
1112	    exit 1
1113	    ;;
1114	  esac
1115	  if test "$prev" = rpath; then
1116	    case "$rpath " in
1117	    *" $arg "*) ;;
1118	    *) rpath="$rpath $arg" ;;
1119	    esac
1120	  else
1121	    case "$xrpath " in
1122	    *" $arg "*) ;;
1123	    *) xrpath="$xrpath $arg" ;;
1124	    esac
1125	  fi
1126	  prev=
1127	  continue
1128	  ;;
1129	xcompiler)
1130	  compiler_flags="$compiler_flags $qarg"
1131	  prev=
1132	  compile_command="$compile_command $qarg"
1133	  finalize_command="$finalize_command $qarg"
1134	  continue
1135	  ;;
1136	xlinker)
1137	  linker_flags="$linker_flags $qarg"
1138	  compiler_flags="$compiler_flags $wl$qarg"
1139	  prev=
1140	  compile_command="$compile_command $wl$qarg"
1141	  finalize_command="$finalize_command $wl$qarg"
1142	  continue
1143	  ;;
1144	xcclinker)
1145	  linker_flags="$linker_flags $qarg"
1146	  compiler_flags="$compiler_flags $qarg"
1147	  prev=
1148	  compile_command="$compile_command $qarg"
1149	  finalize_command="$finalize_command $qarg"
1150	  continue
1151	  ;;
1152	framework)
1153	  case $host in
1154	    *-*-darwin*)
1155	      case "$deplibs " in
1156	        *" $qarg.ltframework "*) ;;
1157		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
1158		   ;;
1159              esac
1160              ;;
1161   	  esac
1162	  prev=
1163	  continue
1164	  ;;
1165	*)
1166	  eval "$prev=\"\$arg\""
1167	  prev=
1168	  continue
1169	  ;;
1170	esac
1171      fi # test -n "$prev"
1172
1173      prevarg="$arg"
1174
1175      case $arg in
1176      -all-static)
1177	if test -n "$link_static_flag"; then
1178	  compile_command="$compile_command $link_static_flag"
1179	  finalize_command="$finalize_command $link_static_flag"
1180	fi
1181	continue
1182	;;
1183
1184      -allow-undefined)
1185	# FIXME: remove this flag sometime in the future.
1186	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1187	continue
1188	;;
1189
1190      -avoid-version)
1191	avoid_version=yes
1192	continue
1193	;;
1194
1195      -dlopen)
1196	prev=dlfiles
1197	continue
1198	;;
1199
1200      -dlpreopen)
1201	prev=dlprefiles
1202	continue
1203	;;
1204
1205      -export-dynamic)
1206	export_dynamic=yes
1207	continue
1208	;;
1209
1210      -export-symbols | -export-symbols-regex)
1211	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1212	  $echo "$modename: more than one -exported-symbols argument is not allowed"
1213	  exit 1
1214	fi
1215	if test "X$arg" = "X-export-symbols"; then
1216	  prev=expsyms
1217	else
1218	  prev=expsyms_regex
1219	fi
1220	continue
1221	;;
1222
1223      -inst-prefix-dir)
1224	prev=inst_prefix
1225	continue
1226	;;
1227
1228      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1229      # so, if we see these flags be careful not to treat them like -L
1230      -L[A-Z][A-Z]*:*)
1231	case $with_gcc/$host in
1232	no/*-*-irix* | /*-*-irix*)
1233	  compile_command="$compile_command $arg"
1234	  finalize_command="$finalize_command $arg"
1235	  ;;
1236	esac
1237	continue
1238	;;
1239
1240      -L*)
1241	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1242	# We need an absolute path.
1243	case $dir in
1244	[\\/]* | [A-Za-z]:[\\/]*) ;;
1245	*)
1246	  absdir=`cd "$dir" && pwd`
1247	  if test -z "$absdir"; then
1248	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1249	    exit 1
1250	  fi
1251	  dir="$absdir"
1252	  ;;
1253	esac
1254	case "$deplibs " in
1255	*" -L$dir "*) ;;
1256	*)
1257	  deplibs="$deplibs -L$dir"
1258	  lib_search_path="$lib_search_path $dir"
1259	  ;;
1260	esac
1261	case $host in
1262	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1263	  case :$dllsearchpath: in
1264	  *":$dir:"*) ;;
1265	  *) dllsearchpath="$dllsearchpath:$dir";;
1266	  esac
1267	  ;;
1268	esac
1269	continue
1270	;;
1271
1272      -l*)
1273	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1274	  case $host in
1275	  *-*-cygwin* | *-*-pw32* | *-*-beos*)
1276	    # These systems don't actually have a C or math library (as such)
1277	    continue
1278	    ;;
1279	  *-*-mingw* | *-*-os2*)
1280	    # These systems don't actually have a C library (as such)
1281	    test "X$arg" = "X-lc" && continue
1282	    ;;
1283	  *-*-openbsd* | *-*-freebsd*)
1284	    # Do not include libc due to us having libc/libc_r.
1285	    test "X$arg" = "X-lc" && continue
1286	    ;;
1287	  *-*-rhapsody* | *-*-darwin1.[012])
1288	    # Rhapsody C and math libraries are in the System framework
1289	    deplibs="$deplibs System.ltframework"
1290	    continue
1291	  esac
1292	elif test "X$arg" = "X-lc_r"; then
1293	 case $host in
1294	 *-*-openbsd*)
1295	   # Do not include libc_r directly, use -pthread flag.
1296	   continue
1297	   ;;
1298	 esac
1299	fi
1300	deplibs="$deplibs $arg"
1301	continue
1302	;;
1303
1304      -module)
1305	module=yes
1306	continue
1307	;;
1308
1309      # gcc -m* arguments should be passed to the linker via $compiler_flags
1310      # in order to pass architecture information to the linker
1311      # (e.g. 32 vs 64-bit).  This may also be accomplished via -Wl,-mfoo
1312      # but this is not reliable with gcc because gcc may use -mfoo to
1313      # select a different linker, different libraries, etc, while
1314      # -Wl,-mfoo simply passes -mfoo to the linker.
1315      -m*)
1316	# Unknown arguments in both finalize_command and compile_command need
1317	# to be aesthetically quoted because they are evaled later.
1318	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1319	case $arg in
1320	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1321	  arg="\"$arg\""
1322	  ;;
1323	esac
1324        compile_command="$compile_command $arg"
1325        finalize_command="$finalize_command $arg"
1326        if test "$with_gcc" = "yes" ; then
1327          compiler_flags="$compiler_flags $arg"
1328        fi
1329        continue
1330        ;;
1331
1332      -shrext)
1333	prev=shrext
1334	continue
1335	;;
1336
1337      -no-fast-install)
1338	fast_install=no
1339	continue
1340	;;
1341
1342      -no-install)
1343	case $host in
1344	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1345	  # The PATH hackery in wrapper scripts is required on Windows
1346	  # in order for the loader to find any dlls it needs.
1347	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1348	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1349	  fast_install=no
1350	  ;;
1351	*) no_install=yes ;;
1352	esac
1353	continue
1354	;;
1355
1356      -no-undefined)
1357	allow_undefined=no
1358	continue
1359	;;
1360
1361      -objectlist)
1362	prev=objectlist
1363	continue
1364	;;
1365
1366      -o) prev=output ;;
1367
1368      -release)
1369	prev=release
1370	continue
1371	;;
1372
1373      -rpath)
1374	prev=rpath
1375	continue
1376	;;
1377
1378      -R)
1379	prev=xrpath
1380	continue
1381	;;
1382
1383      -R*)
1384	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1385	# We need an absolute path.
1386	case $dir in
1387	[\\/]* | [A-Za-z]:[\\/]*) ;;
1388	*)
1389	  $echo "$modename: only absolute run-paths are allowed" 1>&2
1390	  exit 1
1391	  ;;
1392	esac
1393	case "$xrpath " in
1394	*" $dir "*) ;;
1395	*) xrpath="$xrpath $dir" ;;
1396	esac
1397	continue
1398	;;
1399
1400      -static)
1401	# The effects of -static are defined in a previous loop.
1402	# We used to do the same as -all-static on platforms that
1403	# didn't have a PIC flag, but the assumption that the effects
1404	# would be equivalent was wrong.  It would break on at least
1405	# Digital Unix and AIX.
1406	continue
1407	;;
1408
1409      -thread-safe)
1410	thread_safe=yes
1411	continue
1412	;;
1413
1414      -version-info)
1415	prev=vinfo
1416	continue
1417	;;
1418      -version-number)
1419	prev=vinfo
1420	vinfo_number=yes
1421	continue
1422	;;
1423
1424      -Wc,*)
1425	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1426	arg=
1427	save_ifs="$IFS"; IFS=','
1428	for flag in $args; do
1429	  IFS="$save_ifs"
1430	  case $flag in
1431	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1432	    flag="\"$flag\""
1433	    ;;
1434	  esac
1435	  arg="$arg $wl$flag"
1436	  compiler_flags="$compiler_flags $flag"
1437	done
1438	IFS="$save_ifs"
1439	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1440	;;
1441
1442      -Wl,*)
1443	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1444	arg=
1445	save_ifs="$IFS"; IFS=','
1446	for flag in $args; do
1447	  IFS="$save_ifs"
1448	  case $flag in
1449	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1450	    flag="\"$flag\""
1451	    ;;
1452	  esac
1453	  arg="$arg $wl$flag"
1454	  compiler_flags="$compiler_flags $wl$flag"
1455	  linker_flags="$linker_flags $flag"
1456	done
1457	IFS="$save_ifs"
1458	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1459	;;
1460
1461      -Xcompiler)
1462	prev=xcompiler
1463	continue
1464	;;
1465
1466      -Xlinker)
1467	prev=xlinker
1468	continue
1469	;;
1470
1471      -XCClinker)
1472	prev=xcclinker
1473	continue
1474	;;
1475
1476      -framework)
1477        prev=framework
1478	continue
1479	;;
1480
1481      # Some other compiler flag.
1482      -* | +*)
1483	# Unknown arguments in both finalize_command and compile_command need
1484	# to be aesthetically quoted because they are evaled later.
1485	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1486	case $arg in
1487	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1488	  arg="\"$arg\""
1489	  ;;
1490	esac
1491	add_flags="$add_flags $arg"
1492	;;
1493
1494      *.$objext)
1495	# A standard object.
1496	objs="$objs $arg"
1497	;;
1498
1499      *.lo)
1500	# A libtool-controlled object.
1501
1502	# Check to see that this really is a libtool object.
1503	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1504	  pic_object=
1505	  non_pic_object=
1506
1507	  # Read the .lo file
1508	  # If there is no directory component, then add one.
1509	  case $arg in
1510	  */* | *\\*) . $arg ;;
1511	  *) . ./$arg ;;
1512	  esac
1513
1514	  if test -z "$pic_object" || \
1515	     test -z "$non_pic_object" ||
1516	     test "$pic_object" = none && \
1517	     test "$non_pic_object" = none; then
1518	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1519	    exit 1
1520	  fi
1521
1522	  # Extract subdirectory from the argument.
1523	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1524	  if test "X$xdir" = "X$arg"; then
1525	    xdir=
1526 	  else
1527	    xdir="$xdir/"
1528	  fi
1529
1530	  if test "$pic_object" != none; then
1531	    # Prepend the subdirectory the object is found in.
1532	    pic_object="$xdir$pic_object"
1533
1534	    if test "$prev" = dlfiles; then
1535	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1536		dlfiles="$dlfiles $pic_object"
1537		prev=
1538		continue
1539	      else
1540		# If libtool objects are unsupported, then we need to preload.
1541		prev=dlprefiles
1542	      fi
1543	    fi
1544
1545	    # CHECK ME:  I think I busted this.  -Ossama
1546	    if test "$prev" = dlprefiles; then
1547	      # Preload the old-style object.
1548	      dlprefiles="$dlprefiles $pic_object"
1549	      prev=
1550	    fi
1551
1552	    # A PIC object.
1553	    libobjs="$libobjs $pic_object"
1554	    arg="$pic_object"
1555	  fi
1556
1557	  # Non-PIC object.
1558	  if test "$non_pic_object" != none; then
1559	    # Prepend the subdirectory the object is found in.
1560	    non_pic_object="$xdir$non_pic_object"
1561
1562	    # A standard non-PIC object
1563	    non_pic_objects="$non_pic_objects $non_pic_object"
1564	    if test -z "$pic_object" || test "$pic_object" = none ; then
1565	      arg="$non_pic_object"
1566	    fi
1567	  fi
1568	else
1569	  # Only an error if not doing a dry-run.
1570	  if test -z "$run"; then
1571	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1572	    exit 1
1573	  else
1574	    # Dry-run case.
1575
1576	    # Extract subdirectory from the argument.
1577	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1578	    if test "X$xdir" = "X$arg"; then
1579	      xdir=
1580	    else
1581	      xdir="$xdir/"
1582	    fi
1583
1584	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1585	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1586	    libobjs="$libobjs $pic_object"
1587	    non_pic_objects="$non_pic_objects $non_pic_object"
1588	  fi
1589	fi
1590	;;
1591
1592      *.$libext)
1593	# An archive.
1594	deplibs="$deplibs $arg"
1595	old_deplibs="$old_deplibs $arg"
1596	continue
1597	;;
1598
1599      *.la)
1600	# A libtool-controlled library.
1601
1602	if test "$prev" = dlfiles; then
1603	  # This library was specified with -dlopen.
1604	  dlfiles="$dlfiles $arg"
1605	  prev=
1606	elif test "$prev" = dlprefiles; then
1607	  # The library was specified with -dlpreopen.
1608	  dlprefiles="$dlprefiles $arg"
1609	  prev=
1610	else
1611	  deplibs="$deplibs $arg"
1612	fi
1613	continue
1614	;;
1615
1616      # Some other compiler argument.
1617      *)
1618	# Unknown arguments in both finalize_command and compile_command need
1619	# to be aesthetically quoted because they are evaled later.
1620	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1621	case $arg in
1622	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
1623	  arg="\"$arg\""
1624	  ;;
1625	esac
1626	add_flags="$add_flags $arg"
1627	;;
1628      esac # arg
1629
1630      # Now actually substitute the argument into the commands.
1631      if test -n "$arg"; then
1632	compile_command="$compile_command $arg"
1633	finalize_command="$finalize_command $arg"
1634      fi
1635    done # argument parsing loop
1636
1637    if test -n "$prev"; then
1638      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1639      $echo "$help" 1>&2
1640      exit 1
1641    fi
1642
1643    # Infer tagged configuration to use if any are available and
1644    # if one wasn't chosen via the "--tag" command line option.
1645    # Only attempt this if the compiler in the base link
1646    # command doesn't match the default compiler.
1647    if test -n "$available_tags" && test -z "$tagname"; then
1648      case $base_compile in
1649      # Blanks in the command may have been stripped by the calling shell,
1650      # but not from the CC environment variable when configure was run.
1651      "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*) ;;
1652      # Blanks at the start of $base_compile will cause this to fail
1653      # if we don't check for them as well.
1654      *)
1655	for z in $available_tags; do
1656	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$0" > /dev/null; then
1657	    # Evaluate the configuration.
1658	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $0`"
1659	    case $base_compile in
1660	    "$CC "* | " $CC "* | "`$echo $CC` "* | " `$echo $CC` "*)
1661	      # The compiler in $compile_command matches
1662	      # the one in the tagged configuration.
1663	      # Assume this is the tagged configuration we want.
1664	      tagname=$z
1665	      break
1666	      ;;
1667	    esac
1668	  fi
1669	done
1670	# If $tagname still isn't set, then no tagged configuration
1671	# was found and let the user know that the "--tag" command
1672	# line option must be used.
1673	if test -z "$tagname"; then
1674	  $echo "$modename: unable to infer tagged configuration"
1675	  $echo "$modename: specify a tag with \`--tag'" 1>&2
1676	  exit 1
1677#       else
1678#         $echo "$modename: using $tagname tagged configuration"
1679	fi
1680	;;
1681      esac
1682    fi
1683
1684    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1685      eval arg=\"$export_dynamic_flag_spec\"
1686      compile_command="$compile_command $arg"
1687      finalize_command="$finalize_command $arg"
1688    fi
1689
1690    oldlibs=
1691    # calculate the name of the file, without its directory
1692    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1693    libobjs_save="$libobjs"
1694
1695    if test -n "$shlibpath_var"; then
1696      # get the directories listed in $shlibpath_var
1697      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
1698    else
1699      shlib_search_path=
1700    fi
1701    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
1702    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
1703
1704    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
1705    if test "X$output_objdir" = "X$output"; then
1706      output_objdir="$objdir"
1707    else
1708      output_objdir="$output_objdir/$objdir"
1709    fi
1710    # Create the object directory.
1711    if test ! -d "$output_objdir"; then
1712      $show "$mkdir $output_objdir"
1713      $run $mkdir $output_objdir
1714      status=$?
1715      if test "$status" -ne 0 && test ! -d "$output_objdir"; then
1716	exit $status
1717      fi
1718    fi
1719
1720    # Determine the type of output
1721    case $output in
1722    "")
1723      $echo "$modename: you must specify an output file" 1>&2
1724      $echo "$help" 1>&2
1725      exit 1
1726      ;;
1727    *.$libext) linkmode=oldlib ;;
1728    *.lo | *.$objext) linkmode=obj ;;
1729    *.la) linkmode=lib ;;
1730    *) linkmode=prog ;; # Anything else should be a program.
1731    esac
1732
1733    case $host in
1734    *cygwin* | *mingw* | *pw32*)
1735      # don't eliminate duplcations in $postdeps and $predeps
1736      duplicate_compiler_generated_deps=yes
1737      ;;
1738    *)
1739      duplicate_compiler_generated_deps=$duplicate_deps
1740      ;;
1741    esac
1742    specialdeplibs=
1743
1744    libs=
1745    # Find all interdependent deplibs by searching for libraries
1746    # that are linked more than once (e.g. -la -lb -la)
1747    for deplib in $deplibs; do
1748      if test "X$duplicate_deps" = "Xyes" ; then
1749	case "$libs " in
1750	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
1751	esac
1752      fi
1753      libs="$libs $deplib"
1754    done
1755
1756    if test "$linkmode" = lib; then
1757      libs="$predeps $libs $compiler_lib_search_path $postdeps"
1758
1759      # Compute libraries that are listed more than once in $predeps
1760      # $postdeps and mark them as special (i.e., whose duplicates are
1761      # not to be eliminated).
1762      pre_post_deps=
1763      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
1764	for pre_post_dep in $predeps $postdeps; do
1765	  case "$pre_post_deps " in
1766	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
1767	  esac
1768	  pre_post_deps="$pre_post_deps $pre_post_dep"
1769	done
1770      fi
1771      pre_post_deps=
1772    fi
1773
1774    deplibs=
1775    newdependency_libs=
1776    newlib_search_path=
1777    need_relink=no # whether we're linking any uninstalled libtool libraries
1778    notinst_deplibs= # not-installed libtool libraries
1779    notinst_path= # paths that contain not-installed libtool libraries
1780    case $linkmode in
1781    lib)
1782	passes="conv link"
1783	for file in $dlfiles $dlprefiles; do
1784	  case $file in
1785	  *.la) ;;
1786	  *)
1787	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
1788	    exit 1
1789	    ;;
1790	  esac
1791	done
1792	;;
1793    prog)
1794	compile_deplibs=
1795	finalize_deplibs=
1796	alldeplibs=no
1797	newdlfiles=
1798	newdlprefiles=
1799	passes="conv scan dlopen dlpreopen link"
1800	;;
1801    *)  passes="conv"
1802	;;
1803    esac
1804    for pass in $passes; do
1805      if test "$linkmode,$pass" = "lib,link" ||
1806	 test "$linkmode,$pass" = "prog,scan"; then
1807	libs="$deplibs"
1808	deplibs=
1809      fi
1810      if test "$linkmode" = prog; then
1811	case $pass in
1812	dlopen) libs="$dlfiles" ;;
1813	dlpreopen) libs="$dlprefiles" ;;
1814	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
1815	esac
1816      fi
1817      if test "$pass" = dlopen; then
1818	# Collect dlpreopened libraries
1819	save_deplibs="$deplibs"
1820	deplibs=
1821      fi
1822      for deplib in $libs; do
1823	lib=
1824	found=no
1825	case $deplib in
1826	-l*)
1827	  if test "$linkmode" != lib && test "$linkmode" != prog; then
1828	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
1829	    continue
1830	  fi
1831	  if test "$pass" = conv && test "$allow_undefined" = yes; then
1832	    deplibs="$deplib $deplibs"
1833	    continue
1834	  fi
1835	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
1836	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
1837	    for search_ext in .la $shrext .so .a; do
1838	      # Search the libtool library
1839	      lib="$searchdir/lib${name}${search_ext}"
1840	      if test -f "$lib"; then
1841		if test "$search_ext" = ".la"; then
1842		  found=yes
1843		else
1844		  found=no
1845		fi
1846		break 2
1847	      fi
1848	    done
1849	  done
1850	  if test "$found" != yes; then
1851	    # deplib doesn't seem to be a libtool library
1852	    if test "$linkmode,$pass" = "prog,link"; then
1853	      compile_deplibs="$deplib $compile_deplibs"
1854	      finalize_deplibs="$deplib $finalize_deplibs"
1855	    else
1856	      deplibs="$deplib $deplibs"
1857	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1858	    fi
1859	    continue
1860	  else # deplib is a libtool library
1861	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
1862	    # We need to do some special things here, and not later.
1863	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
1864	      case " $predeps $postdeps " in
1865	      *" $deplib "*)
1866		if (${SED} -e '2q' $lib |
1867                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1868		  library_names=
1869		  old_library=
1870		  case $lib in
1871		  */* | *\\*) . $lib ;;
1872		  *) . ./$lib ;;
1873		  esac
1874		  for l in $old_library $library_names; do
1875		    ll="$l"
1876		  done
1877		  if test "X$ll" = "X$old_library" ; then # only static version available
1878		    found=no
1879		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
1880		    test "X$ladir" = "X$lib" && ladir="."
1881		    lib=$ladir/$old_library
1882		    if test "$linkmode,$pass" = "prog,link"; then
1883		      compile_deplibs="$deplib $compile_deplibs"
1884		      finalize_deplibs="$deplib $finalize_deplibs"
1885		    else
1886		      deplibs="$deplib $deplibs"
1887		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
1888		    fi
1889		    continue
1890		  fi
1891		fi
1892	        ;;
1893	      *) ;;
1894	      esac
1895	    fi
1896	  fi
1897	  ;; # -l
1898	*.ltframework)
1899	  if test "$linkmode,$pass" = "prog,link"; then
1900	    compile_deplibs="$deplib $compile_deplibs"
1901	    finalize_deplibs="$deplib $finalize_deplibs"
1902	  else
1903	    deplibs="$deplib $deplibs"
1904	    if test "$linkmode" = lib ; then
1905	      newdependency_libs="$deplib $newdependency_libs"
1906	    fi
1907	  fi
1908	  continue
1909	  ;;
1910	-L*)
1911	  case $linkmode in
1912	  lib)
1913	    deplibs="$deplib $deplibs"
1914	    test "$pass" = conv && continue
1915	    newdependency_libs="$deplib $newdependency_libs"
1916	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1917	    ;;
1918	  prog)
1919	    if test "$pass" = conv; then
1920	      deplibs="$deplib $deplibs"
1921	      continue
1922	    fi
1923	    if test "$pass" = scan; then
1924	      deplibs="$deplib $deplibs"
1925	      newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
1926	    else
1927	      compile_deplibs="$deplib $compile_deplibs"
1928	      finalize_deplibs="$deplib $finalize_deplibs"
1929	    fi
1930	    ;;
1931	  *)
1932	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
1933	    ;;
1934	  esac # linkmode
1935	  continue
1936	  ;; # -L
1937	-R*)
1938	  if test "$pass" = link; then
1939	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
1940	    # Make sure the xrpath contains only unique directories.
1941	    case "$xrpath " in
1942	    *" $dir "*) ;;
1943	    *) xrpath="$xrpath $dir" ;;
1944	    esac
1945	  fi
1946	  deplibs="$deplib $deplibs"
1947	  continue
1948	  ;;
1949	*.la) lib="$deplib" ;;
1950	*.$libext)
1951	  if test "$pass" = conv; then
1952	    deplibs="$deplib $deplibs"
1953	    continue
1954	  fi
1955	  case $linkmode in
1956	  lib)
1957	    if test "$deplibs_check_method" != pass_all; then
1958	      $echo
1959	      $echo "*** Warning: Trying to link with static lib archive $deplib."
1960	      $echo "*** I have the capability to make that library automatically link in when"
1961	      $echo "*** you link to this library.  But I can only do this if you have a"
1962	      $echo "*** shared version of the library, which you do not appear to have"
1963	      $echo "*** because the file extensions .$libext of this argument makes me believe"
1964	      $echo "*** that it is just a static archive that I should not used here."
1965	    else
1966	      $echo
1967	      $echo "*** Warning: Linking the shared library $output against the"
1968	      $echo "*** static library $deplib is not portable!"
1969	      deplibs="$deplib $deplibs"
1970	    fi
1971	    continue
1972	    ;;
1973	  prog)
1974	    if test "$pass" != link; then
1975	      deplibs="$deplib $deplibs"
1976	    else
1977	      compile_deplibs="$deplib $compile_deplibs"
1978	      finalize_deplibs="$deplib $finalize_deplibs"
1979	    fi
1980	    continue
1981	    ;;
1982	  esac # linkmode
1983	  ;; # *.$libext
1984	*.lo | *.$objext)
1985	  if test "$pass" = conv; then
1986	    deplibs="$deplib $deplibs"
1987	  elif test "$linkmode" = prog; then
1988	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
1989	      # If there is no dlopen support or we're linking statically,
1990	      # we need to preload.
1991	      newdlprefiles="$newdlprefiles $deplib"
1992	      compile_deplibs="$deplib $compile_deplibs"
1993	      finalize_deplibs="$deplib $finalize_deplibs"
1994	    else
1995	      newdlfiles="$newdlfiles $deplib"
1996	    fi
1997	  fi
1998	  continue
1999	  ;;
2000	%DEPLIBS%)
2001	  alldeplibs=yes
2002	  continue
2003	  ;;
2004	esac # case $deplib
2005	if test "$found" = yes || test -f "$lib"; then :
2006	else
2007	  $echo "$modename: cannot find the library \`$lib'" 1>&2
2008	  exit 1
2009	fi
2010
2011	# Check to see that this really is a libtool archive.
2012	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2013	else
2014	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2015	  exit 1
2016	fi
2017
2018	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2019	test "X$ladir" = "X$lib" && ladir="."
2020
2021	dlname=
2022	dlopen=
2023	dlpreopen=
2024	libdir=
2025	library_names=
2026	old_library=
2027	# If the library was installed with an old release of libtool,
2028	# it will not redefine variables installed, or shouldnotlink
2029	installed=yes
2030	shouldnotlink=no
2031
2032	# Read the .la file
2033	case $lib in
2034	*/* | *\\*) . $lib ;;
2035	*) . ./$lib ;;
2036	esac
2037
2038	case $host in
2039	*-*-darwin*)
2040	  # Convert "-framework foo" to "foo.ltframework" in dependency_libs
2041	  test -n "$dependency_libs" && dependency_libs=`$echo "X$dependency_libs" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
2042	  ;;
2043	esac
2044
2045	if test "$linkmode,$pass" = "lib,link" ||
2046	   test "$linkmode,$pass" = "prog,scan" ||
2047	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2048	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2049	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2050	fi
2051
2052	if test "$pass" = conv; then
2053	  # Only check for convenience libraries
2054	  deplibs="$lib $deplibs"
2055	  tmp_libs=
2056	  for deplib in $dependency_libs; do
2057	    #echo "Adding $deplib to \$deplibs"
2058	    deplibs="$deplib $deplibs"
2059            if test "X$duplicate_deps" = "Xyes" ; then
2060	      case "$tmp_libs " in
2061	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2062	      esac
2063            fi
2064	    tmp_libs="$tmp_libs $deplib"
2065	  done
2066	  if test -z "$libdir"; then
2067	    if test -z "$old_library"; then
2068	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2069	      exit 1
2070	    fi
2071	    # It is a libtool convenience library, so add in its objects.
2072	    convenience="$convenience $ladir/$objdir/$old_library"
2073	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
2074	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
2075	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
2076	    exit 1
2077	  fi
2078	  continue
2079	fi # $pass = conv
2080
2081
2082	# Get the name of the library we link against.
2083	linklib=
2084	for l in $old_library $library_names; do
2085	  linklib="$l"
2086	done
2087	if test -z "$linklib"; then
2088	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2089	  exit 1
2090	fi
2091
2092	# This library was specified with -dlopen.
2093	if test "$pass" = dlopen; then
2094	  if test -z "$libdir"; then
2095	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2096	    exit 1
2097	  fi
2098	  if test -z "$dlname" || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2099	    # If there is no dlname, no dlopen support or we're linking
2100	    # statically, we need to preload.  We also need to preload any
2101	    # dependent libraries so libltdl's deplib preloader doesn't
2102	    # bomb out in the load deplibs phase.
2103	    dlprefiles="$dlprefiles $lib $dependency_libs"
2104	  else
2105	    newdlfiles="$newdlfiles $lib"
2106	  fi
2107	  continue
2108	fi # $pass = dlopen
2109
2110	# We need an absolute path.
2111	case $ladir in
2112	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2113	*)
2114	  abs_ladir=`cd "$ladir" && pwd`
2115	  if test -z "$abs_ladir"; then
2116	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2117	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2118	    abs_ladir="$ladir"
2119	  fi
2120	  ;;
2121	esac
2122	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2123
2124	# Find the relevant object directory and library name.
2125	if test "X$installed" = Xyes; then
2126	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2127	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
2128	    dir="$ladir"
2129	    absdir="$abs_ladir"
2130	    libdir="$abs_ladir"
2131	  else
2132	    dir="$libdir"
2133	    absdir="$libdir"
2134	  fi
2135	else
2136	  dir="$ladir/$objdir"
2137	  absdir="$abs_ladir/$objdir"
2138	  # Remove this search path later
2139	  notinst_path="$notinst_path $abs_ladir"
2140	fi # $installed = yes
2141	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2142
2143	# This library was specified with -dlpreopen.
2144	if test "$pass" = dlpreopen; then
2145	  if test -z "$libdir"; then
2146	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2147	    exit 1
2148	  fi
2149	  # Prefer using a static library (so that no silly _DYNAMIC symbols
2150	  # are required to link).
2151	  if test -n "$old_library"; then
2152	    newdlprefiles="$newdlprefiles $dir/$old_library"
2153	  # Otherwise, use the dlname, so that lt_dlopen finds it.
2154	  elif test -n "$dlname"; then
2155	    newdlprefiles="$newdlprefiles $dir/$dlname"
2156	  else
2157	    newdlprefiles="$newdlprefiles $dir/$linklib"
2158	  fi
2159	fi # $pass = dlpreopen
2160
2161	if test -z "$libdir"; then
2162	  # Link the convenience library
2163	  if test "$linkmode" = lib; then
2164	    deplibs="$dir/$old_library $deplibs"
2165	  elif test "$linkmode,$pass" = "prog,link"; then
2166	    compile_deplibs="$dir/$old_library $compile_deplibs"
2167	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
2168	  else
2169	    deplibs="$lib $deplibs" # used for prog,scan pass
2170	  fi
2171	  continue
2172	fi
2173
2174
2175	if test "$linkmode" = prog && test "$pass" != link; then
2176	  newlib_search_path="$newlib_search_path $ladir"
2177	  deplibs="$lib $deplibs"
2178
2179	  linkalldeplibs=no
2180	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
2181	     test "$build_libtool_libs" = no; then
2182	    linkalldeplibs=yes
2183	  fi
2184
2185	  tmp_libs=
2186	  for deplib in $dependency_libs; do
2187	    case $deplib in
2188	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2189	    esac
2190	    # Need to link against all dependency_libs?
2191	    if test "$linkalldeplibs" = yes; then
2192	      deplibs="$deplib $deplibs"
2193	    else
2194	      # Need to hardcode shared library paths
2195	      # or/and link against static libraries
2196	      newdependency_libs="$deplib $newdependency_libs"
2197	    fi
2198	    if test "X$duplicate_deps" = "Xyes" ; then
2199	      case "$tmp_libs " in
2200	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2201	      esac
2202	    fi
2203	    tmp_libs="$tmp_libs $deplib"
2204	  done # for deplib
2205	  continue
2206	fi # $linkmode = prog...
2207
2208	if test "$linkmode,$pass" = "prog,link"; then
2209	  if test -n "$library_names" &&
2210	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2211	    # We need to hardcode the library path
2212	    if test -n "$shlibpath_var"; then
2213	      # Make sure the rpath contains only unique directories.
2214	      case "$temp_rpath " in
2215	      *" $dir "*) ;;
2216	      *" $absdir "*) ;;
2217	      *) temp_rpath="$temp_rpath $dir" ;;
2218	      esac
2219	    fi
2220
2221	    # Hardcode the library path.
2222	    # Skip directories that are in the system default run-time
2223	    # search path.
2224	    case " $sys_lib_dlsearch_path " in
2225	    *" $absdir "*) ;;
2226	    *)
2227	      case "$compile_rpath " in
2228	      *" $absdir "*) ;;
2229	      *) compile_rpath="$compile_rpath $absdir"
2230	      esac
2231	      ;;
2232	    esac
2233	    case " $sys_lib_dlsearch_path " in
2234	    *" $libdir "*) ;;
2235	    *)
2236	      case "$finalize_rpath " in
2237	      *" $libdir "*) ;;
2238	      *) finalize_rpath="$finalize_rpath $libdir"
2239	      esac
2240	      ;;
2241	    esac
2242	  fi # $linkmode,$pass = prog,link...
2243
2244	  if test "$alldeplibs" = yes &&
2245	     { test "$deplibs_check_method" = pass_all ||
2246	       { test "$build_libtool_libs" = yes &&
2247		 test -n "$library_names"; }; }; then
2248	    # We only need to search for static libraries
2249	    continue
2250	  fi
2251	fi
2252
2253	link_static=no # Whether the deplib will be linked statically
2254	if test -n "$library_names" &&
2255	   { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
2256	  if test "$installed" = no; then
2257	    notinst_deplibs="$notinst_deplibs $lib"
2258	    need_relink=yes
2259	  fi
2260	  # This is a shared library
2261
2262      # Warn about portability, can't link against -module's on some systems (darwin)
2263      if test "$shouldnotlink" = yes && test "$pass" = link ; then
2264	    $echo
2265	    if test "$linkmode" = prog; then
2266	      $echo "*** Warning: Linking the executable $output against the loadable module"
2267	    else
2268	      $echo "*** Warning: Linking the shared library $output against the loadable module"
2269	    fi
2270	    $echo "*** $linklib is not portable!"
2271      fi
2272	  if test "$linkmode" = lib &&
2273	     test "$hardcode_into_libs" = yes; then
2274	    # Hardcode the library path.
2275	    # Skip directories that are in the system default run-time
2276	    # search path.
2277	    case " $sys_lib_dlsearch_path " in
2278	    *" $absdir "*) ;;
2279	    *)
2280	      case "$compile_rpath " in
2281	      *" $absdir "*) ;;
2282	      *) compile_rpath="$compile_rpath $absdir"
2283	      esac
2284	      ;;
2285	    esac
2286	    case " $sys_lib_dlsearch_path " in
2287	    *" $libdir "*) ;;
2288	    *)
2289	      case "$finalize_rpath " in
2290	      *" $libdir "*) ;;
2291	      *) finalize_rpath="$finalize_rpath $libdir"
2292	      esac
2293	      ;;
2294	    esac
2295	  fi
2296
2297	  if test -n "$old_archive_from_expsyms_cmds"; then
2298	    # figure out the soname
2299	    set dummy $library_names
2300	    realname="$2"
2301	    shift; shift
2302	    libname=`eval \\$echo \"$libname_spec\"`
2303	    # use dlname if we got it. it's perfectly good, no?
2304	    if test -n "$dlname"; then
2305	      soname="$dlname"
2306	    elif test -n "$soname_spec"; then
2307	      # bleh windows
2308	      case $host in
2309	      *cygwin* | mingw*)
2310		major=`expr $current - $age`
2311		versuffix="-$major"
2312		;;
2313	      esac
2314	      eval soname=\"$soname_spec\"
2315	    else
2316	      soname="$realname"
2317	    fi
2318
2319	    # Make a new name for the extract_expsyms_cmds to use
2320	    soroot="$soname"
2321	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2322	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2323
2324	    # If the library has no export list, then create one now
2325	    if test -f "$output_objdir/$soname-def"; then :
2326	    else
2327	      $show "extracting exported symbol list from \`$soname'"
2328	      save_ifs="$IFS"; IFS='~'
2329	      eval cmds=\"$extract_expsyms_cmds\"
2330	      for cmd in $cmds; do
2331		IFS="$save_ifs"
2332		$show "$cmd"
2333		$run eval "$cmd" || exit $?
2334	      done
2335	      IFS="$save_ifs"
2336	    fi
2337
2338	    # Create $newlib
2339	    if test -f "$output_objdir/$newlib"; then :; else
2340	      $show "generating import library for \`$soname'"
2341	      save_ifs="$IFS"; IFS='~'
2342	      eval cmds=\"$old_archive_from_expsyms_cmds\"
2343	      for cmd in $cmds; do
2344		IFS="$save_ifs"
2345		$show "$cmd"
2346		$run eval "$cmd" || exit $?
2347	      done
2348	      IFS="$save_ifs"
2349	    fi
2350	    # make sure the library variables are pointing to the new library
2351	    dir=$output_objdir
2352	    linklib=$newlib
2353	  fi # test -n "$old_archive_from_expsyms_cmds"
2354
2355	  if test "$linkmode" = prog || test "$mode" != relink; then
2356	    add_shlibpath=
2357	    add_dir=
2358	    add=
2359	    lib_linked=yes
2360	    case $hardcode_action in
2361	    immediate | unsupported)
2362	      if test "$hardcode_direct" = no; then
2363		add="$dir/$linklib"
2364		case $host in
2365		  *-*-sco3.2v5* ) add_dir="-L$dir" ;;
2366		  *-*-darwin* )
2367		    # if the lib is a module then we can not link against it, someone
2368		    # is ignoring the new warnings I added
2369		    if /usr/bin/file -L $add 2> /dev/null | grep "bundle" >/dev/null ; then
2370		      $echo "** Warning, lib $linklib is a module, not a shared library"
2371		      if test -z "$old_library" ; then
2372		        $echo
2373		        $echo "** And there doesn't seem to be a static archive available"
2374		        $echo "** The link will probably fail, sorry"
2375		      else
2376		        add="$dir/$old_library"
2377		      fi
2378		    fi
2379		esac
2380	      elif test "$hardcode_minus_L" = no; then
2381		case $host in
2382		*-*-sunos*) add_shlibpath="$dir" ;;
2383		esac
2384		add_dir="-L$dir"
2385		add="-l$name"
2386	      elif test "$hardcode_shlibpath_var" = no; then
2387		add_shlibpath="$dir"
2388		add="-l$name"
2389	      else
2390		lib_linked=no
2391	      fi
2392	      ;;
2393	    relink)
2394	      if test "$hardcode_direct" = yes; then
2395		add="$dir/$linklib"
2396	      elif test "$hardcode_minus_L" = yes; then
2397		add_dir="-L$dir"
2398		# Try looking first in the location we're being installed to.
2399		if test -n "$inst_prefix_dir"; then
2400		  case "$libdir" in
2401		    [\\/]*)
2402		      add_dir="-L$inst_prefix_dir$libdir $add_dir"
2403		      ;;
2404		  esac
2405		fi
2406		add="-l$name"
2407	      elif test "$hardcode_shlibpath_var" = yes; then
2408		add_shlibpath="$dir"
2409		add="-l$name"
2410	      else
2411		lib_linked=no
2412	      fi
2413	      ;;
2414	    *) lib_linked=no ;;
2415	    esac
2416
2417	    if test "$lib_linked" != yes; then
2418	      $echo "$modename: configuration error: unsupported hardcode properties"
2419	      exit 1
2420	    fi
2421
2422	    if test -n "$add_shlibpath"; then
2423	      case :$compile_shlibpath: in
2424	      *":$add_shlibpath:"*) ;;
2425	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2426	      esac
2427	    fi
2428	    if test "$linkmode" = prog; then
2429	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2430	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
2431	    else
2432	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2433	      test -n "$add" && deplibs="$add $deplibs"
2434	      if test "$hardcode_direct" != yes && \
2435		 test "$hardcode_minus_L" != yes && \
2436		 test "$hardcode_shlibpath_var" = yes; then
2437		case :$finalize_shlibpath: in
2438		*":$libdir:"*) ;;
2439		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2440		esac
2441	      fi
2442	    fi
2443	  fi
2444
2445	  if test "$linkmode" = prog || test "$mode" = relink; then
2446	    add_shlibpath=
2447	    add_dir=
2448	    add=
2449	    # Finalize command for both is simple: just hardcode it.
2450	    if test "$hardcode_direct" = yes; then
2451	      add="$libdir/$linklib"
2452	    elif test "$hardcode_minus_L" = yes; then
2453	      add_dir="-L$libdir"
2454	      add="-l$name"
2455	    elif test "$hardcode_shlibpath_var" = yes; then
2456	      case :$finalize_shlibpath: in
2457	      *":$libdir:"*) ;;
2458	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2459	      esac
2460	      add="-l$name"
2461	    elif test "$hardcode_automatic" = yes; then
2462	      if test -n "$inst_prefix_dir" && test -f "$inst_prefix_dir$libdir/$linklib" ; then
2463	        add="$inst_prefix_dir$libdir/$linklib"
2464	      else
2465	        add="$libdir/$linklib"
2466	      fi
2467	    else
2468	      # We cannot seem to hardcode it, guess we'll fake it.
2469	      add_dir="-L$libdir"
2470	      # Try looking first in the location we're being installed to.
2471	      if test -n "$inst_prefix_dir"; then
2472		case "$libdir" in
2473		  [\\/]*)
2474		    add_dir="-L$inst_prefix_dir$libdir $add_dir"
2475		    ;;
2476		esac
2477	      fi
2478	      add="-l$name"
2479	    fi
2480
2481	    if test "$linkmode" = prog; then
2482	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2483	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2484	    else
2485	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
2486	      test -n "$add" && deplibs="$add $deplibs"
2487	    fi
2488	  fi
2489	elif test "$linkmode" = prog; then
2490	  # Here we assume that one of hardcode_direct or hardcode_minus_L
2491	  # is not unsupported.  This is valid on all known static and
2492	  # shared platforms.
2493	  if test "$hardcode_direct" != unsupported; then
2494	    test -n "$old_library" && linklib="$old_library"
2495	    compile_deplibs="$dir/$linklib $compile_deplibs"
2496	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
2497	  else
2498	    compile_deplibs="-l$name -L$dir $compile_deplibs"
2499	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2500	  fi
2501	elif test "$build_libtool_libs" = yes; then
2502	  # Not a shared library
2503	  if test "$deplibs_check_method" != pass_all; then
2504	    # We're trying link a shared library against a static one
2505	    # but the system doesn't support it.
2506
2507	    # Just print a warning and add the library to dependency_libs so
2508	    # that the program can be linked against the static library.
2509	    $echo
2510	    $echo "*** Warning: This system can not link to static lib archive $lib."
2511	    $echo "*** I have the capability to make that library automatically link in when"
2512	    $echo "*** you link to this library.  But I can only do this if you have a"
2513	    $echo "*** shared version of the library, which you do not appear to have."
2514	    if test "$module" = yes; then
2515	      $echo "*** But as you try to build a module library, libtool will still create "
2516	      $echo "*** a static module, that should work as long as the dlopening application"
2517	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2518	      if test -z "$global_symbol_pipe"; then
2519		$echo
2520		$echo "*** However, this would only work if libtool was able to extract symbol"
2521		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2522		$echo "*** not find such a program.  So, this module is probably useless."
2523		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
2524	      fi
2525	      if test "$build_old_libs" = no; then
2526		build_libtool_libs=module
2527		build_old_libs=yes
2528	      else
2529		build_libtool_libs=no
2530	      fi
2531	    fi
2532	  else
2533	    convenience="$convenience $dir/$old_library"
2534	    old_convenience="$old_convenience $dir/$old_library"
2535	    deplibs="$dir/$old_library $deplibs"
2536	    link_static=yes
2537	  fi
2538	fi # link shared/static library?
2539
2540	if test "$linkmode" = lib; then
2541	  #if test -n "$dependency_libs" &&
2542	  #   { test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes ||
2543	  #     test "$link_static" = yes; }; then
2544	    # Extract -R from dependency_libs
2545	    temp_deplibs=
2546	    for libdir in $dependency_libs; do
2547	      case $libdir in
2548	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2549		   case " $xrpath " in
2550		   *" $temp_xrpath "*) ;;
2551		   *) xrpath="$xrpath $temp_xrpath";;
2552		   esac;;
2553	      *) temp_deplibs="$temp_deplibs $libdir";;
2554	      esac
2555	    done
2556	    dependency_libs="$temp_deplibs"
2557	  #fi
2558
2559	  newlib_search_path="$newlib_search_path $absdir"
2560	  # Link against this library
2561	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2562	  # ... and its dependency_libs
2563	  tmp_libs=
2564	  for deplib in $dependency_libs; do
2565	    newdependency_libs="$deplib $newdependency_libs"
2566	    if test "X$duplicate_deps" = "Xyes" ; then
2567	      case "$tmp_libs " in
2568	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2569	      esac
2570	    fi
2571	    tmp_libs="$tmp_libs $deplib"
2572	  done
2573
2574	  if test "$link_all_deplibs" != no; then
2575	    # Add the search paths of all dependency libraries
2576	    for deplib in $dependency_libs; do
2577	      case $deplib in
2578	      -L*) path="$deplib" ;;
2579	      *.la)
2580		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2581		test "X$dir" = "X$deplib" && dir="."
2582		# We need an absolute path.
2583		case $dir in
2584		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2585		*)
2586		  absdir=`cd "$dir" && pwd`
2587		  if test -z "$absdir"; then
2588		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2589		    absdir="$dir"
2590		  fi
2591		  ;;
2592		esac
2593		if grep "^installed=no" $deplib > /dev/null; then
2594		  path="$absdir/$objdir"
2595		else
2596		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2597		  if test -z "$libdir"; then
2598		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2599		    exit 1
2600		  fi
2601		  if test "$absdir" != "$libdir"; then
2602		    # Sure, some shells/systems don't implement the -ef.
2603		    # Those will have to live with the warning.
2604		    test "$absdir" -ef "$libdir" > /dev/null 2>&1 ||
2605		      $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2606		  fi
2607		  path="$absdir"
2608		fi
2609		depdepl=
2610		case $host in
2611		*-*-darwin*)
2612		  # we do not want to link against static libs, but need to link against shared
2613		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2614		  if test -n "$deplibrary_names" ; then
2615		    for tmp in $deplibrary_names ; do
2616		      depdepl=$tmp
2617		    done
2618		    if test -f "$path/$depdepl" ; then
2619		      depdepl="$path/$depdepl"
2620		   fi
2621		    # do not add paths which are already there
2622		    case " $newlib_search_path " in
2623		    *" $path "*) ;;
2624		    *) newlib_search_path="$newlib_search_path $path";;
2625		    esac
2626		    path=""
2627		  fi
2628		  ;;
2629		*)
2630		path="-L$path"
2631		;;
2632		esac
2633
2634		;;
2635		  -l*)
2636		case $host in
2637		*-*-darwin*)
2638		 # Again, we only want to link against shared libraries
2639		 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2640		 for tmp in $newlib_search_path ; do
2641		     if test -f "$tmp/lib$tmp_libs.dylib" ; then
2642		       eval depdepl="$tmp/lib$tmp_libs.dylib"
2643		       break
2644		     fi
2645         done
2646         path=""
2647		  ;;
2648		*) continue ;;
2649		esac
2650		;;
2651
2652	      *.ltframework)
2653		case $host in
2654		  *-*-darwin*)
2655		    depdepl="$deplib"
2656		    ;;
2657		esac
2658		;;
2659
2660	      *) continue ;;
2661	      esac
2662	      case " $deplibs " in
2663	      *" $depdepl "*) ;;
2664	      *) deplibs="$deplibs $depdepl" ;;
2665	      esac
2666	      case " $deplibs " in
2667	      *" $path "*) ;;
2668	      *) deplibs="$deplibs $path" ;;
2669	      esac
2670	    done
2671	  fi # link_all_deplibs != no
2672	fi # linkmode = lib
2673      done # for deplib in $libs
2674      dependency_libs="$newdependency_libs"
2675      if test "$pass" = dlpreopen; then
2676	# Link the dlpreopened libraries before other libraries
2677	for deplib in $save_deplibs; do
2678	  deplibs="$deplib $deplibs"
2679	done
2680      fi
2681      if test "$pass" != dlopen; then
2682	if test "$pass" != conv; then
2683	  # Make sure lib_search_path contains only unique directories.
2684	  lib_search_path=
2685	  for dir in $newlib_search_path; do
2686	    case "$lib_search_path " in
2687	    *" $dir "*) ;;
2688	    *) lib_search_path="$lib_search_path $dir" ;;
2689	    esac
2690	  done
2691	  newlib_search_path=
2692	fi
2693
2694	if test "$linkmode,$pass" != "prog,link"; then
2695	  vars="deplibs"
2696	else
2697	  vars="compile_deplibs finalize_deplibs"
2698	fi
2699	for var in $vars dependency_libs; do
2700	  # Add libraries to $var in reverse order
2701	  eval tmp_libs=\"\$$var\"
2702	  new_libs=
2703	  for deplib in $tmp_libs; do
2704	    # FIXME: Pedantically, this is the right thing to do, so
2705	    #        that some nasty dependency loop isn't accidentally
2706	    #        broken:
2707	    #new_libs="$deplib $new_libs"
2708	    # Pragmatically, this seems to cause very few problems in
2709	    # practice:
2710	    case $deplib in
2711	    -L*) new_libs="$deplib $new_libs" ;;
2712	    -R*) ;;
2713	    *)
2714	      # And here is the reason: when a library appears more
2715	      # than once as an explicit dependence of a library, or
2716	      # is implicitly linked in more than once by the
2717	      # compiler, it is considered special, and multiple
2718	      # occurrences thereof are not removed.  Compare this
2719	      # with having the same library being listed as a
2720	      # dependency of multiple other libraries: in this case,
2721	      # we know (pedantically, we assume) the library does not
2722	      # need to be listed more than once, so we keep only the
2723	      # last copy.  This is not always right, but it is rare
2724	      # enough that we require users that really mean to play
2725	      # such unportable linking tricks to link the library
2726	      # using -Wl,-lname, so that libtool does not consider it
2727	      # for duplicate removal.
2728	      case " $specialdeplibs " in
2729	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
2730	      *)
2731		case " $new_libs " in
2732		*" $deplib "*) ;;
2733		*) new_libs="$deplib $new_libs" ;;
2734		esac
2735		;;
2736	      esac
2737	      ;;
2738	    esac
2739	  done
2740	  tmp_libs=
2741	  for deplib in $new_libs; do
2742	    case $deplib in
2743	    -L*)
2744	      case " $tmp_libs " in
2745	      *" $deplib "*) ;;
2746	      *) tmp_libs="$tmp_libs $deplib" ;;
2747	      esac
2748	      ;;
2749	    *) tmp_libs="$tmp_libs $deplib" ;;
2750	    esac
2751	  done
2752	  eval $var=\"$tmp_libs\"
2753	done # for var
2754      fi
2755      # Last step: remove runtime libs from dependency_libs (they stay in deplibs)
2756      tmp_libs=
2757      for i in $dependency_libs ; do
2758	case " $predeps $postdeps $compiler_lib_search_path " in
2759	*" $i "*)
2760	  i=""
2761	  ;;
2762	esac
2763	if test -n "$i" ; then
2764	  tmp_libs="$tmp_libs $i"
2765	fi
2766      done
2767      dependency_libs=$tmp_libs
2768    done # for pass
2769    if test "$linkmode" = prog; then
2770      dlfiles="$newdlfiles"
2771      dlprefiles="$newdlprefiles"
2772    fi
2773
2774    case $linkmode in
2775    oldlib)
2776      if test -n "$deplibs"; then
2777	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
2778      fi
2779
2780      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
2781	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
2782      fi
2783
2784      if test -n "$rpath"; then
2785	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
2786      fi
2787
2788      if test -n "$xrpath"; then
2789	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
2790      fi
2791
2792      if test -n "$vinfo"; then
2793	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
2794      fi
2795
2796      if test -n "$release"; then
2797	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
2798      fi
2799
2800      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
2801	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
2802      fi
2803
2804      # Now set the variables for building old libraries.
2805      build_libtool_libs=no
2806      oldlibs="$output"
2807      objs="$objs$old_deplibs"
2808      ;;
2809
2810    lib)
2811      # Make sure we only generate libraries of the form `libNAME.la'.
2812      case $outputname in
2813      lib*)
2814	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2815	eval shared_ext=\"$shrext\"
2816	eval libname=\"$libname_spec\"
2817	;;
2818      *)
2819	if test "$module" = no; then
2820	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
2821	  $echo "$help" 1>&2
2822	  exit 1
2823	fi
2824	if test "$need_lib_prefix" != no; then
2825	  # Add the "lib" prefix for modules if required
2826	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2827	  eval shared_ext=\"$shrext\"
2828	  eval libname=\"$libname_spec\"
2829	else
2830	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
2831	fi
2832	;;
2833      esac
2834
2835      if test -n "$objs"; then
2836	if test "$deplibs_check_method" != pass_all; then
2837	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
2838	  exit 1
2839	else
2840	  $echo
2841	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
2842	  $echo "*** objects $objs is not portable!"
2843	  libobjs="$libobjs $objs"
2844	fi
2845      fi
2846
2847      if test "$dlself" != no; then
2848	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
2849      fi
2850
2851      set dummy $rpath
2852      if test "$#" -gt 2; then
2853	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
2854      fi
2855      install_libdir="$2"
2856
2857      oldlibs=
2858      if test -z "$rpath"; then
2859	if test "$build_libtool_libs" = yes; then
2860	  # Building a libtool convenience library.
2861	  # Some compilers have problems with a `.al' extension so
2862	  # convenience libraries should have the same extension an
2863	  # archive normally would.
2864	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
2865	  build_libtool_libs=convenience
2866	  build_old_libs=yes
2867	fi
2868
2869	if test -n "$vinfo"; then
2870	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
2871	fi
2872
2873	if test -n "$release"; then
2874	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
2875	fi
2876      else
2877
2878	# Parse the version information argument.
2879	save_ifs="$IFS"; IFS=':'
2880	set dummy $vinfo 0 0 0
2881	IFS="$save_ifs"
2882
2883	if test -n "$8"; then
2884	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
2885	  $echo "$help" 1>&2
2886	  exit 1
2887	fi
2888
2889	# convert absolute version numbers to libtool ages
2890	# this retains compatibility with .la files and attempts
2891	# to make the code below a bit more comprehensible
2892
2893	case $vinfo_number in
2894	yes)
2895	  number_major="$2"
2896	  number_minor="$3"
2897	  number_revision="$4"
2898	  #
2899	  # There are really only two kinds -- those that
2900	  # use the current revision as the major version
2901	  # and those that subtract age and use age as
2902	  # a minor version.  But, then there is irix
2903	  # which has an extra 1 added just for fun
2904	  #
2905	  case $version_type in
2906	  darwin|linux|osf|windows)
2907	    current=`expr $number_major + $number_minor`
2908	    age="$number_minor"
2909	    revision="$number_revision"
2910	    ;;
2911	  freebsd-aout|freebsd-elf|sunos)
2912	    current="$number_major"
2913	    revision="$number_minor"
2914	    age="0"
2915	    ;;
2916	  irix|nonstopux)
2917	    current=`expr $number_major + $number_minor - 1`
2918	    age="$number_minor"
2919	    revision="$number_minor"
2920	    ;;
2921	  esac
2922	  ;;
2923	no)
2924	  current="$2"
2925	  revision="$3"
2926	  age="$4"
2927	  ;;
2928	esac
2929
2930	# Check that each of the things are valid numbers.
2931	case $current in
2932	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2933	*)
2934	  $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2
2935	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2936	  exit 1
2937	  ;;
2938	esac
2939
2940	case $revision in
2941	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2942	*)
2943	  $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2
2944	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2945	  exit 1
2946	  ;;
2947	esac
2948
2949	case $age in
2950	0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;;
2951	*)
2952	  $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2
2953	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2954	  exit 1
2955	  ;;
2956	esac
2957
2958	if test "$age" -gt "$current"; then
2959	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
2960	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
2961	  exit 1
2962	fi
2963
2964	# Calculate the version variables.
2965	major=
2966	versuffix=
2967	verstring=
2968	case $version_type in
2969	none) ;;
2970
2971	darwin)
2972	  # Like Linux, but with the current version available in
2973	  # verstring for coding it into the library header
2974	  major=.`expr $current - $age`
2975	  versuffix="$major.$age.$revision"
2976	  # Darwin ld doesn't like 0 for these options...
2977	  minor_current=`expr $current + 1`
2978	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
2979	  ;;
2980
2981	freebsd-aout)
2982	  major=".$current"
2983	  versuffix=".$current.$revision";
2984	  ;;
2985
2986	freebsd-elf)
2987	  major=".$current"
2988	  versuffix=".$current";
2989	  ;;
2990
2991	irix | nonstopux)
2992	  major=`expr $current - $age + 1`
2993
2994	  case $version_type in
2995	    nonstopux) verstring_prefix=nonstopux ;;
2996	    *)         verstring_prefix=sgi ;;
2997	  esac
2998	  verstring="$verstring_prefix$major.$revision"
2999
3000	  # Add in all the interfaces that we are compatible with.
3001	  loop=$revision
3002	  while test "$loop" -ne 0; do
3003	    iface=`expr $revision - $loop`
3004	    loop=`expr $loop - 1`
3005	    verstring="$verstring_prefix$major.$iface:$verstring"
3006	  done
3007
3008	  # Before this point, $major must not contain `.'.
3009	  major=.$major
3010	  versuffix="$major.$revision"
3011	  ;;
3012
3013	linux)
3014	  major=.`expr $current - $age`
3015	  versuffix="$major.$age.$revision"
3016	  ;;
3017
3018	osf)
3019	  major=.`expr $current - $age`
3020	  versuffix=".$current.$age.$revision"
3021	  verstring="$current.$age.$revision"
3022
3023	  # Add in all the interfaces that we are compatible with.
3024	  loop=$age
3025	  while test "$loop" -ne 0; do
3026	    iface=`expr $current - $loop`
3027	    loop=`expr $loop - 1`
3028	    verstring="$verstring:${iface}.0"
3029	  done
3030
3031	  # Make executables depend on our current version.
3032	  verstring="$verstring:${current}.0"
3033	  ;;
3034
3035	sunos)
3036	  major=".$current"
3037	  versuffix=".$current.$revision"
3038	  ;;
3039
3040	windows)
3041	  # Use '-' rather than '.', since we only want one
3042	  # extension on DOS 8.3 filesystems.
3043	  major=`expr $current - $age`
3044	  versuffix="-$major"
3045	  ;;
3046
3047	*)
3048	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
3049	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
3050	  exit 1
3051	  ;;
3052	esac
3053
3054	# Clear the version info if we defaulted, and they specified a release.
3055	if test -z "$vinfo" && test -n "$release"; then
3056	  major=
3057	  case $version_type in
3058	  darwin)
3059	    # we can't check for "0.0" in archive_cmds due to quoting
3060	    # problems, so we reset it completely
3061	    verstring=
3062	    ;;
3063	  *)
3064	    verstring="0.0"
3065	    ;;
3066	  esac
3067	  if test "$need_version" = no; then
3068	    versuffix=
3069	  else
3070	    versuffix=".0.0"
3071	  fi
3072	fi
3073
3074	# Remove version info from name if versioning should be avoided
3075	if test "$avoid_version" = yes && test "$need_version" = no; then
3076	  major=
3077	  versuffix=
3078	  verstring=""
3079	fi
3080
3081	# Check to see if the archive will have undefined symbols.
3082	if test "$allow_undefined" = yes; then
3083	  if test "$allow_undefined_flag" = unsupported; then
3084	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3085	    build_libtool_libs=no
3086	    build_old_libs=yes
3087	  fi
3088	else
3089	  # Don't allow undefined symbols.
3090	  allow_undefined_flag="$no_undefined_flag"
3091	fi
3092      fi
3093
3094      if test "$mode" != relink; then
3095	# Remove our outputs, but don't remove object files since they
3096	# may have been created when compiling PIC objects.
3097	removelist=
3098	tempremovelist=`$echo "$output_objdir/*"`
3099	for p in $tempremovelist; do
3100	  case $p in
3101	    *.$objext | *$exeext)
3102	       ;;
3103	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3104	       removelist="$removelist $p"
3105	       ;;
3106	    *) ;;
3107	  esac
3108	done
3109	if test -n "$removelist"; then
3110	  $show "${rm}r $removelist"
3111	  $run ${rm}r $removelist
3112	fi
3113      fi
3114
3115      # Now set the variables for building old libraries.
3116      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3117	oldlibs="$oldlibs $output_objdir/$libname.$libext"
3118
3119	# Transform .lo files to .o files.
3120	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3121      fi
3122
3123      # Eliminate all temporary directories.
3124      for path in $notinst_path; do
3125	lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'`
3126	deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'`
3127	dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'`
3128      done
3129
3130      if test -n "$xrpath"; then
3131	# If the user specified any rpath flags, then add them.
3132	temp_xrpath=
3133	for libdir in $xrpath; do
3134	  temp_xrpath="$temp_xrpath -R$libdir"
3135	  case "$finalize_rpath " in
3136	  *" $libdir "*) ;;
3137	  *) finalize_rpath="$finalize_rpath $libdir" ;;
3138	  esac
3139	done
3140	if true || test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3141	  dependency_libs="$temp_xrpath $dependency_libs"
3142	fi
3143      fi
3144
3145      # Make sure dlfiles contains only unique files that won't be dlpreopened
3146      old_dlfiles="$dlfiles"
3147      dlfiles=
3148      for lib in $old_dlfiles; do
3149	case " $dlprefiles $dlfiles " in
3150	*" $lib "*) ;;
3151	*) dlfiles="$dlfiles $lib" ;;
3152	esac
3153      done
3154
3155      # Make sure dlprefiles contains only unique files
3156      old_dlprefiles="$dlprefiles"
3157      dlprefiles=
3158      for lib in $old_dlprefiles; do
3159	case "$dlprefiles " in
3160	*" $lib "*) ;;
3161	*) dlprefiles="$dlprefiles $lib" ;;
3162	esac
3163      done
3164
3165      if test "$build_libtool_libs" = yes; then
3166	if test -n "$rpath"; then
3167	  case $host in
3168	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3169	    # these systems don't actually have a c library (as such)!
3170	    ;;
3171	  *-*-rhapsody* | *-*-darwin1.[012])
3172	    # Rhapsody C library is in the System framework
3173	    deplibs="$deplibs System.ltframework"
3174	    ;;
3175	  *-*-netbsd*)
3176	    # Don't link with libc until the a.out ld.so is fixed.
3177	    ;;
3178	  *-*-openbsd* | *-*-freebsd*)
3179	    # Do not include libc due to us having libc/libc_r.
3180	    test "X$arg" = "X-lc" && continue
3181	    ;;
3182 	  *)
3183	    # Add libc to deplibs on all other systems if necessary.
3184	    if test "$build_libtool_need_lc" = "yes"; then
3185	      deplibs="$deplibs -lc"
3186	    fi
3187	    ;;
3188	  esac
3189	fi
3190
3191	# Transform deplibs into only deplibs that can be linked in shared.
3192	name_save=$name
3193	libname_save=$libname
3194	release_save=$release
3195	versuffix_save=$versuffix
3196	major_save=$major
3197	# I'm not sure if I'm treating the release correctly.  I think
3198	# release should show up in the -l (ie -lgmp5) so we don't want to
3199	# add it in twice.  Is that correct?
3200	release=""
3201	versuffix=""
3202	major=""
3203	newdeplibs=
3204	droppeddeps=no
3205	case $deplibs_check_method in
3206	pass_all)
3207	  # Don't check for shared/static.  Everything works.
3208	  # This might be a little naive.  We might want to check
3209	  # whether the library exists or not.  But this is on
3210	  # osf3 & osf4 and I'm not really sure... Just
3211	  # implementing what was already the behavior.
3212	  newdeplibs=$deplibs
3213	  ;;
3214	test_compile)
3215	  # This code stresses the "libraries are programs" paradigm to its
3216	  # limits. Maybe even breaks it.  We compile a program, linking it
3217	  # against the deplibs as a proxy for the library.  Then we can check
3218	  # whether they linked in statically or dynamically with ldd.
3219	  $rm conftest.c
3220	  cat > conftest.c <<EOF
3221	  int main() { return 0; }
3222EOF
3223	  $rm conftest
3224	  $LTCC -o conftest conftest.c $deplibs
3225	  if test "$?" -eq 0 ; then
3226	    ldd_output=`ldd conftest`
3227	    for i in $deplibs; do
3228	      name="`expr $i : '-l\(.*\)'`"
3229	      # If $name is empty we are operating on a -L argument.
3230              if test "$name" != "" && test "$name" -ne "0"; then
3231		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3232		  case " $predeps $postdeps " in
3233		  *" $i "*)
3234		    newdeplibs="$newdeplibs $i"
3235		    i=""
3236		    ;;
3237		  esac
3238	        fi
3239		if test -n "$i" ; then
3240		  libname=`eval \\$echo \"$libname_spec\"`
3241		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
3242		  set dummy $deplib_matches
3243		  deplib_match=$2
3244		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3245		    newdeplibs="$newdeplibs $i"
3246		  else
3247		    droppeddeps=yes
3248		    $echo
3249		    $echo "*** Warning: dynamic linker does not accept needed library $i."
3250		    $echo "*** I have the capability to make that library automatically link in when"
3251		    $echo "*** you link to this library.  But I can only do this if you have a"
3252		    $echo "*** shared version of the library, which I believe you do not have"
3253		    $echo "*** because a test_compile did reveal that the linker did not use it for"
3254		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3255		  fi
3256		fi
3257	      else
3258		newdeplibs="$newdeplibs $i"
3259	      fi
3260	    done
3261	  else
3262	    # Error occurred in the first compile.  Let's try to salvage
3263	    # the situation: Compile a separate program for each library.
3264	    for i in $deplibs; do
3265	      name="`expr $i : '-l\(.*\)'`"
3266	      # If $name is empty we are operating on a -L argument.
3267              if test "$name" != "" && test "$name" != "0"; then
3268		$rm conftest
3269		$LTCC -o conftest conftest.c $i
3270		# Did it work?
3271		if test "$?" -eq 0 ; then
3272		  ldd_output=`ldd conftest`
3273		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3274		    case " $predeps $postdeps " in
3275		    *" $i "*)
3276		      newdeplibs="$newdeplibs $i"
3277		      i=""
3278		      ;;
3279		    esac
3280		  fi
3281		  if test -n "$i" ; then
3282		    libname=`eval \\$echo \"$libname_spec\"`
3283		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
3284		    set dummy $deplib_matches
3285		    deplib_match=$2
3286		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3287		      newdeplibs="$newdeplibs $i"
3288		    else
3289		      droppeddeps=yes
3290		      $echo
3291		      $echo "*** Warning: dynamic linker does not accept needed library $i."
3292		      $echo "*** I have the capability to make that library automatically link in when"
3293		      $echo "*** you link to this library.  But I can only do this if you have a"
3294		      $echo "*** shared version of the library, which you do not appear to have"
3295		      $echo "*** because a test_compile did reveal that the linker did not use this one"
3296		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
3297		    fi
3298		  fi
3299		else
3300		  droppeddeps=yes
3301		  $echo
3302		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
3303		  $echo "***  make it link in!  You will probably need to install it or some"
3304		  $echo "*** library that it depends on before this library will be fully"
3305		  $echo "*** functional.  Installing it before continuing would be even better."
3306		fi
3307	      else
3308		newdeplibs="$newdeplibs $i"
3309	      fi
3310	    done
3311	  fi
3312	  ;;
3313	file_magic*)
3314	  set dummy $deplibs_check_method
3315	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3316	  for a_deplib in $deplibs; do
3317	    name="`expr $a_deplib : '-l\(.*\)'`"
3318	    # If $name is empty we are operating on a -L argument.
3319            if test "$name" != "" && test  "$name" != "0"; then
3320	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3321		case " $predeps $postdeps " in
3322		*" $a_deplib "*)
3323		  newdeplibs="$newdeplibs $a_deplib"
3324		  a_deplib=""
3325		  ;;
3326		esac
3327	      fi
3328	      if test -n "$a_deplib" ; then
3329		libname=`eval \\$echo \"$libname_spec\"`
3330		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3331		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3332		  for potent_lib in $potential_libs; do
3333		      # Follow soft links.
3334		      if ls -lLd "$potent_lib" 2>/dev/null \
3335			 | grep " -> " >/dev/null; then
3336			continue
3337		      fi
3338		      # The statement above tries to avoid entering an
3339		      # endless loop below, in case of cyclic links.
3340		      # We might still enter an endless loop, since a link
3341		      # loop can be closed while we follow links,
3342		      # but so what?
3343		      potlib="$potent_lib"
3344		      while test -h "$potlib" 2>/dev/null; do
3345			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
3346			case $potliblink in
3347			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
3348			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
3349			esac
3350		      done
3351		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
3352			 | ${SED} 10q \
3353			 | $EGREP "$file_magic_regex" > /dev/null; then
3354			newdeplibs="$newdeplibs $a_deplib"
3355			a_deplib=""
3356			break 2
3357		      fi
3358		  done
3359		done
3360	      fi
3361	      if test -n "$a_deplib" ; then
3362		droppeddeps=yes
3363		$echo
3364		$echo "*** Warning: linker path does not have real file for library $a_deplib."
3365		$echo "*** I have the capability to make that library automatically link in when"
3366		$echo "*** you link to this library.  But I can only do this if you have a"
3367		$echo "*** shared version of the library, which you do not appear to have"
3368		$echo "*** because I did check the linker path looking for a file starting"
3369		if test -z "$potlib" ; then
3370		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
3371		else
3372		  $echo "*** with $libname and none of the candidates passed a file format test"
3373		  $echo "*** using a file magic. Last file checked: $potlib"
3374		fi
3375	      fi
3376	    else
3377	      # Add a -L argument.
3378	      newdeplibs="$newdeplibs $a_deplib"
3379	    fi
3380	  done # Gone through all deplibs.
3381	  ;;
3382	match_pattern*)
3383	  set dummy $deplibs_check_method
3384	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
3385	  for a_deplib in $deplibs; do
3386	    name="`expr $a_deplib : '-l\(.*\)'`"
3387	    # If $name is empty we are operating on a -L argument.
3388	    if test -n "$name" && test "$name" != "0"; then
3389	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3390		case " $predeps $postdeps " in
3391		*" $a_deplib "*)
3392		  newdeplibs="$newdeplibs $a_deplib"
3393		  a_deplib=""
3394		  ;;
3395		esac
3396	      fi
3397	      if test -n "$a_deplib" ; then
3398		libname=`eval \\$echo \"$libname_spec\"`
3399		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
3400		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
3401		  for potent_lib in $potential_libs; do
3402		    potlib="$potent_lib" # see symlink-check above in file_magic test
3403		    if eval $echo \"$potent_lib\" 2>/dev/null \
3404		        | ${SED} 10q \
3405		        | $EGREP "$match_pattern_regex" > /dev/null; then
3406		      newdeplibs="$newdeplibs $a_deplib"
3407		      a_deplib=""
3408		      break 2
3409		    fi
3410		  done
3411		done
3412	      fi
3413	      if test -n "$a_deplib" ; then
3414		droppeddeps=yes
3415		$echo
3416		$echo "*** Warning: linker path does not have real file for library $a_deplib."
3417		$echo "*** I have the capability to make that library automatically link in when"
3418		$echo "*** you link to this library.  But I can only do this if you have a"
3419		$echo "*** shared version of the library, which you do not appear to have"
3420		$echo "*** because I did check the linker path looking for a file starting"
3421		if test -z "$potlib" ; then
3422		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
3423		else
3424		  $echo "*** with $libname and none of the candidates passed a file format test"
3425		  $echo "*** using a regex pattern. Last file checked: $potlib"
3426		fi
3427	      fi
3428	    else
3429	      # Add a -L argument.
3430	      newdeplibs="$newdeplibs $a_deplib"
3431	    fi
3432	  done # Gone through all deplibs.
3433	  ;;
3434	none | unknown | *)
3435	  newdeplibs=""
3436	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
3437	    -e 's/ -[LR][^ ]*//g'`
3438	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3439	    for i in $predeps $postdeps ; do
3440	      # can't use Xsed below, because $i might contain '/'
3441	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
3442	    done
3443	  fi
3444	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
3445	    | grep . >/dev/null; then
3446	    $echo
3447	    if test "X$deplibs_check_method" = "Xnone"; then
3448	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
3449	    else
3450	      $echo "*** Warning: inter-library dependencies are not known to be supported."
3451	    fi
3452	    $echo "*** All declared inter-library dependencies are being dropped."
3453	    droppeddeps=yes
3454	  fi
3455	  ;;
3456	esac
3457	versuffix=$versuffix_save
3458	major=$major_save
3459	release=$release_save
3460	libname=$libname_save
3461	name=$name_save
3462
3463	case $host in
3464	*-*-rhapsody* | *-*-darwin1.[012])
3465	  # On Rhapsody replace the C library is the System framework
3466	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
3467	  ;;
3468	esac
3469
3470	if test "$droppeddeps" = yes; then
3471	  if test "$module" = yes; then
3472	    $echo
3473	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
3474	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
3475	    $echo "*** a static module, that should work as long as the dlopening"
3476	    $echo "*** application is linked with the -dlopen flag."
3477	    if test -z "$global_symbol_pipe"; then
3478	      $echo
3479	      $echo "*** However, this would only work if libtool was able to extract symbol"
3480	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
3481	      $echo "*** not find such a program.  So, this module is probably useless."
3482	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
3483	    fi
3484	    if test "$build_old_libs" = no; then
3485	      oldlibs="$output_objdir/$libname.$libext"
3486	      build_libtool_libs=module
3487	      build_old_libs=yes
3488	    else
3489	      build_libtool_libs=no
3490	    fi
3491	  else
3492	    $echo "*** The inter-library dependencies that have been dropped here will be"
3493	    $echo "*** automatically added whenever a program is linked with this library"
3494	    $echo "*** or is declared to -dlopen it."
3495
3496	    if test "$allow_undefined" = no; then
3497	      $echo
3498	      $echo "*** Since this library must not contain undefined symbols,"
3499	      $echo "*** because either the platform does not support them or"
3500	      $echo "*** it was explicitly requested with -no-undefined,"
3501	      $echo "*** libtool will only create a static version of it."
3502	      if test "$build_old_libs" = no; then
3503		oldlibs="$output_objdir/$libname.$libext"
3504		build_libtool_libs=module
3505		build_old_libs=yes
3506	      else
3507		build_libtool_libs=no
3508	      fi
3509	    fi
3510	  fi
3511	fi
3512	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
3513	case $host in
3514	  *-*-darwin*)
3515	    newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3516	    dependency_libs=`$echo "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
3517	    ;;
3518	esac
3519	# Done checking deplibs!
3520	deplibs=$newdeplibs
3521      fi
3522
3523      # All the library-specific variables (install_libdir is set above).
3524      library_names=
3525      old_library=
3526      dlname=
3527
3528      # Test again, we may have decided not to build it any more
3529      if test "$build_libtool_libs" = yes; then
3530	if test "$hardcode_into_libs" = yes; then
3531	  # Hardcode the library paths
3532	  hardcode_libdirs=
3533	  dep_rpath=
3534	  rpath="$finalize_rpath"
3535	  test "$mode" != relink && test "$fast_install" = no && rpath="$compile_rpath$rpath"
3536	  for libdir in $rpath; do
3537	    if test -n "$hardcode_libdir_flag_spec"; then
3538	      if test -n "$hardcode_libdir_separator"; then
3539		if test -z "$hardcode_libdirs"; then
3540		  hardcode_libdirs="$libdir"
3541		else
3542		  # Just accumulate the unique libdirs.
3543		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
3544		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
3545		    ;;
3546		  *)
3547		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
3548		    ;;
3549		  esac
3550		fi
3551	      else
3552		eval flag=\"$hardcode_libdir_flag_spec\"
3553		dep_rpath="$dep_rpath $flag"
3554	      fi
3555	    elif test -n "$runpath_var"; then
3556	      case "$perm_rpath " in
3557	      *" $libdir "*) ;;
3558	      *) perm_rpath="$perm_rpath $libdir" ;;
3559	      esac
3560	    fi
3561	  done
3562	  # Substitute the hardcoded libdirs into the rpath.
3563	  if test -n "$hardcode_libdir_separator" &&
3564	     test -n "$hardcode_libdirs"; then
3565	    libdir="$hardcode_libdirs"
3566	    if test -n "$hardcode_libdir_flag_spec_ld"; then
3567	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
3568	    else
3569	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
3570	    fi
3571	  fi
3572	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
3573	    # We should set the runpath_var.
3574	    rpath=
3575	    for dir in $perm_rpath; do
3576	      rpath="$rpath$dir:"
3577	    done
3578	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
3579	  fi
3580	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
3581	fi
3582
3583	shlibpath="$finalize_shlibpath"
3584	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
3585	if test -n "$shlibpath"; then
3586	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
3587	fi
3588
3589	# Get the real and link names of the library.
3590	eval shared_ext=\"$shrext\"
3591	eval library_names=\"$library_names_spec\"
3592	set dummy $library_names
3593	realname="$2"
3594	shift; shift
3595
3596	if test -n "$soname_spec"; then
3597	  eval soname=\"$soname_spec\"
3598	else
3599	  soname="$realname"
3600	fi
3601	if test -z "$dlname"; then
3602	  dlname=$soname
3603	fi
3604
3605	lib="$output_objdir/$realname"
3606	for link
3607	do
3608	  linknames="$linknames $link"
3609	done
3610
3611	# Use standard objects if they are pic
3612	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
3613
3614	# Prepare the list of exported symbols
3615	if test -z "$export_symbols"; then
3616	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
3617	    $show "generating symbol list for \`$libname.la'"
3618	    export_symbols="$output_objdir/$libname.exp"
3619	    $run $rm $export_symbols
3620	    eval cmds=\"$export_symbols_cmds\"
3621	    save_ifs="$IFS"; IFS='~'
3622	    for cmd in $cmds; do
3623	      IFS="$save_ifs"
3624	      if len=`expr "X$cmd" : ".*"` &&
3625	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3626	        $show "$cmd"
3627	        $run eval "$cmd" || exit $?
3628	        skipped_export=false
3629	      else
3630	        # The command line is too long to execute in one step.
3631	        $show "using reloadable object file for export list..."
3632	        skipped_export=:
3633	      fi
3634	    done
3635	    IFS="$save_ifs"
3636	    if test -n "$export_symbols_regex"; then
3637	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
3638	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
3639	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
3640	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
3641	    fi
3642	  fi
3643	fi
3644
3645	if test -n "$export_symbols" && test -n "$include_expsyms"; then
3646	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
3647	fi
3648
3649	tmp_deplibs=
3650	for test_deplib in $deplibs; do
3651		case " $convenience " in
3652		*" $test_deplib "*) ;;
3653		*)
3654			tmp_deplibs="$tmp_deplibs $test_deplib"
3655			;;
3656		esac
3657	done
3658	deplibs="$tmp_deplibs"
3659
3660	if test -n "$convenience"; then
3661	  if test -n "$whole_archive_flag_spec"; then
3662	    save_libobjs=$libobjs
3663	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3664	  else
3665	    gentop="$output_objdir/${outputname}x"
3666	    $show "${rm}r $gentop"
3667	    $run ${rm}r "$gentop"
3668	    $show "$mkdir $gentop"
3669	    $run $mkdir "$gentop"
3670	    status=$?
3671	    if test "$status" -ne 0 && test ! -d "$gentop"; then
3672	      exit $status
3673	    fi
3674	    generated="$generated $gentop"
3675
3676	    for xlib in $convenience; do
3677	      # Extract the objects.
3678	      case $xlib in
3679	      [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3680	      *) xabs=`pwd`"/$xlib" ;;
3681	      esac
3682	      xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3683	      xdir="$gentop/$xlib"
3684
3685	      $show "${rm}r $xdir"
3686	      $run ${rm}r "$xdir"
3687	      $show "$mkdir $xdir"
3688	      $run $mkdir "$xdir"
3689	      status=$?
3690	      if test "$status" -ne 0 && test ! -d "$xdir"; then
3691		exit $status
3692	      fi
3693	      # We will extract separately just the conflicting names and we will no
3694	      # longer touch any unique names. It is faster to leave these extract
3695	      # automatically by $AR in one run.
3696	      $show "(cd $xdir && $AR x $xabs)"
3697	      $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3698	      if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3699		:
3700	      else
3701		$echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3702		$echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3703		$AR t "$xabs" | sort | uniq -cd | while read -r count name
3704		do
3705		  i=1
3706		  while test "$i" -le "$count"
3707		  do
3708		   # Put our $i before any first dot (extension)
3709		   # Never overwrite any file
3710		   name_to="$name"
3711		   while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
3712		   do
3713		     name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
3714		   done
3715		   $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
3716		   $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
3717		   i=`expr $i + 1`
3718		  done
3719		done
3720	      fi
3721
3722	      libobjs="$libobjs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3723	    done
3724	  fi
3725	fi
3726
3727	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
3728	  eval flag=\"$thread_safe_flag_spec\"
3729	  linker_flags="$linker_flags $flag"
3730	fi
3731
3732	# Make a backup of the uninstalled library when relinking
3733	if test "$mode" = relink; then
3734	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
3735	fi
3736
3737	# Add all flags from the command line.  We here create a library,
3738	# but those flags were only added to compile_command and
3739	# finalize_command, which are only used when creating executables.
3740	# So do it by hand here.
3741	compiler_flags="$compiler_flags $add_flags"
3742	# Only add it to commands which use CC, instead of LD, i.e.
3743	# only to $compiler_flags
3744	#linker_flags="$linker_flags $add_flags"
3745
3746	# Do each of the archive commands.
3747	if test "$module" = yes && test -n "$module_cmds" ; then
3748	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
3749	    eval cmds=\"$module_expsym_cmds\"
3750	  else
3751	    eval cmds=\"$module_cmds\"
3752	  fi
3753	else
3754	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3755	  eval cmds=\"$archive_expsym_cmds\"
3756	else
3757	  eval cmds=\"$archive_cmds\"
3758	  fi
3759	fi
3760
3761	if test "X$skipped_export" != "X:" && len=`expr "X$cmds" : ".*"` &&
3762	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
3763	  :
3764	else
3765	  # The command line is too long to link in one step, link piecewise.
3766	  $echo "creating reloadable object files..."
3767
3768	  # Save the value of $output and $libobjs because we want to
3769	  # use them later.  If we have whole_archive_flag_spec, we
3770	  # want to use save_libobjs as it was before
3771	  # whole_archive_flag_spec was expanded, because we can't
3772	  # assume the linker understands whole_archive_flag_spec.
3773	  # This may have to be revisited, in case too many
3774	  # convenience libraries get linked in and end up exceeding
3775	  # the spec.
3776	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
3777	    save_libobjs=$libobjs
3778	  fi
3779	  save_output=$output
3780
3781	  # Clear the reloadable object creation command queue and
3782	  # initialize k to one.
3783	  test_cmds=
3784	  concat_cmds=
3785	  objlist=
3786	  delfiles=
3787	  last_robj=
3788	  k=1
3789	  output=$output_objdir/$save_output-${k}.$objext
3790	  # Loop over the list of objects to be linked.
3791	  for obj in $save_libobjs
3792	  do
3793	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
3794	    if test "X$objlist" = X ||
3795	       { len=`expr "X$test_cmds" : ".*"` &&
3796		 test "$len" -le "$max_cmd_len"; }; then
3797	      objlist="$objlist $obj"
3798	    else
3799	      # The command $test_cmds is almost too long, add a
3800	      # command to the queue.
3801	      if test "$k" -eq 1 ; then
3802		# The first file doesn't have a previous command to add.
3803		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
3804	      else
3805		# All subsequent reloadable object files will link in
3806		# the last one created.
3807		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
3808	      fi
3809	      last_robj=$output_objdir/$save_output-${k}.$objext
3810	      k=`expr $k + 1`
3811	      output=$output_objdir/$save_output-${k}.$objext
3812	      objlist=$obj
3813	      len=1
3814	    fi
3815	  done
3816	  # Handle the remaining objects by creating one last
3817	  # reloadable object file.  All subsequent reloadable object
3818	  # files will link in the last one created.
3819	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
3820	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
3821
3822	  if ${skipped_export-false}; then
3823	    $show "generating symbol list for \`$libname.la'"
3824	    export_symbols="$output_objdir/$libname.exp"
3825	    $run $rm $export_symbols
3826	    libobjs=$output
3827	    # Append the command to create the export file.
3828	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
3829          fi
3830
3831	  # Set up a command to remove the reloadale object files
3832	  # after they are used.
3833	  i=0
3834	  while test "$i" -lt "$k"
3835	  do
3836	    i=`expr $i + 1`
3837	    delfiles="$delfiles $output_objdir/$save_output-${i}.$objext"
3838	  done
3839
3840	  $echo "creating a temporary reloadable object file: $output"
3841
3842	  # Loop through the commands generated above and execute them.
3843	  save_ifs="$IFS"; IFS='~'
3844	  for cmd in $concat_cmds; do
3845	    IFS="$save_ifs"
3846	    $show "$cmd"
3847	    $run eval "$cmd" || exit $?
3848	  done
3849	  IFS="$save_ifs"
3850
3851	  libobjs=$output
3852	  # Restore the value of output.
3853	  output=$save_output
3854
3855	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
3856	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
3857	  fi
3858	  # Expand the library linking commands again to reset the
3859	  # value of $libobjs for piecewise linking.
3860
3861	  # Do each of the archive commands.
3862	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
3863	    eval cmds=\"$archive_expsym_cmds\"
3864	  else
3865	    eval cmds=\"$archive_cmds\"
3866	  fi
3867
3868	  # Append the command to remove the reloadable object files
3869	  # to the just-reset $cmds.
3870	  eval cmds=\"\$cmds~$rm $delfiles\"
3871	fi
3872	save_ifs="$IFS"; IFS='~'
3873	for cmd in $cmds; do
3874	  IFS="$save_ifs"
3875	  $show "$cmd"
3876	  $run eval "$cmd" || exit $?
3877	done
3878	IFS="$save_ifs"
3879
3880	# Restore the uninstalled library and exit
3881	if test "$mode" = relink; then
3882	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
3883	  exit 0
3884	fi
3885
3886	# Create links to the real library.
3887	for linkname in $linknames; do
3888	  if test "$realname" != "$linkname"; then
3889	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
3890	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
3891	  fi
3892	done
3893
3894	# If -module or -export-dynamic was specified, set the dlname.
3895	if test "$module" = yes || test "$export_dynamic" = yes; then
3896	  # On all known operating systems, these are identical.
3897	  dlname="$soname"
3898	fi
3899      fi
3900      ;;
3901
3902    obj)
3903      if test -n "$deplibs"; then
3904	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
3905      fi
3906
3907      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3908	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
3909      fi
3910
3911      if test -n "$rpath"; then
3912	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
3913      fi
3914
3915      if test -n "$xrpath"; then
3916	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
3917      fi
3918
3919      if test -n "$vinfo"; then
3920	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
3921      fi
3922
3923      if test -n "$release"; then
3924	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
3925      fi
3926
3927      case $output in
3928      *.lo)
3929	if test -n "$objs$old_deplibs"; then
3930	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
3931	  exit 1
3932	fi
3933	libobj="$output"
3934	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
3935	;;
3936      *)
3937	libobj=
3938	obj="$output"
3939	;;
3940      esac
3941
3942      # Delete the old objects.
3943      $run $rm $obj $libobj
3944
3945      # Objects from convenience libraries.  This assumes
3946      # single-version convenience libraries.  Whenever we create
3947      # different ones for PIC/non-PIC, this we'll have to duplicate
3948      # the extraction.
3949      reload_conv_objs=
3950      gentop=
3951      # reload_cmds runs $LD directly, so let us get rid of
3952      # -Wl from whole_archive_flag_spec
3953      wl=
3954
3955      if test -n "$convenience"; then
3956	if test -n "$whole_archive_flag_spec"; then
3957	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
3958	else
3959	  gentop="$output_objdir/${obj}x"
3960	  $show "${rm}r $gentop"
3961	  $run ${rm}r "$gentop"
3962	  $show "$mkdir $gentop"
3963	  $run $mkdir "$gentop"
3964	  status=$?
3965	  if test "$status" -ne 0 && test ! -d "$gentop"; then
3966	    exit $status
3967	  fi
3968	  generated="$generated $gentop"
3969
3970	  for xlib in $convenience; do
3971	    # Extract the objects.
3972	    case $xlib in
3973	    [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
3974	    *) xabs=`pwd`"/$xlib" ;;
3975	    esac
3976	    xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
3977	    xdir="$gentop/$xlib"
3978
3979	    $show "${rm}r $xdir"
3980	    $run ${rm}r "$xdir"
3981	    $show "$mkdir $xdir"
3982	    $run $mkdir "$xdir"
3983	    status=$?
3984	    if test "$status" -ne 0 && test ! -d "$xdir"; then
3985	      exit $status
3986	    fi
3987	    # We will extract separately just the conflicting names and we will no
3988	    # longer touch any unique names. It is faster to leave these extract
3989	    # automatically by $AR in one run.
3990	    $show "(cd $xdir && $AR x $xabs)"
3991	    $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
3992	    if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
3993	      :
3994	    else
3995	      $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
3996	      $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
3997	      $AR t "$xabs" | sort | uniq -cd | while read -r count name
3998	      do
3999		i=1
4000		while test "$i" -le "$count"
4001		do
4002		 # Put our $i before any first dot (extension)
4003		 # Never overwrite any file
4004		 name_to="$name"
4005		 while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
4006		 do
4007		   name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
4008		 done
4009		 $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
4010		 $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
4011		 i=`expr $i + 1`
4012		done
4013	      done
4014	    fi
4015
4016	    reload_conv_objs="$reload_objs "`find $xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4017	  done
4018	fi
4019      fi
4020
4021      # Create the old-style object.
4022      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
4023
4024      output="$obj"
4025      eval cmds=\"$reload_cmds\"
4026      save_ifs="$IFS"; IFS='~'
4027      for cmd in $cmds; do
4028	IFS="$save_ifs"
4029	$show "$cmd"
4030	$run eval "$cmd" || exit $?
4031      done
4032      IFS="$save_ifs"
4033
4034      # Exit if we aren't doing a library object file.
4035      if test -z "$libobj"; then
4036	if test -n "$gentop"; then
4037	  $show "${rm}r $gentop"
4038	  $run ${rm}r $gentop
4039	fi
4040
4041	exit 0
4042      fi
4043
4044      if test "$build_libtool_libs" != yes; then
4045	if test -n "$gentop"; then
4046	  $show "${rm}r $gentop"
4047	  $run ${rm}r $gentop
4048	fi
4049
4050	# Create an invalid libtool object if no PIC, so that we don't
4051	# accidentally link it into a program.
4052	# $show "echo timestamp > $libobj"
4053	# $run eval "echo timestamp > $libobj" || exit $?
4054	exit 0
4055      fi
4056
4057      if test -n "$pic_flag" || test "$pic_mode" != default; then
4058	# Only do commands if we really have different PIC objects.
4059	reload_objs="$libobjs $reload_conv_objs"
4060	output="$libobj"
4061	eval cmds=\"$reload_cmds\"
4062	save_ifs="$IFS"; IFS='~'
4063	for cmd in $cmds; do
4064	  IFS="$save_ifs"
4065	  $show "$cmd"
4066	  $run eval "$cmd" || exit $?
4067	done
4068	IFS="$save_ifs"
4069      fi
4070
4071      if test -n "$gentop"; then
4072	$show "${rm}r $gentop"
4073	$run ${rm}r $gentop
4074      fi
4075
4076      exit 0
4077      ;;
4078
4079    prog)
4080      case $host in
4081	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
4082      esac
4083      if test -n "$vinfo"; then
4084	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
4085      fi
4086
4087      if test -n "$release"; then
4088	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
4089      fi
4090
4091      if test "$preload" = yes; then
4092	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
4093	   test "$dlopen_self_static" = unknown; then
4094	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
4095	fi
4096      fi
4097
4098      case $host in
4099      *-*-rhapsody* | *-*-darwin1.[012])
4100	# On Rhapsody replace the C library is the System framework
4101	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
4102	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
4103	;;
4104      esac
4105
4106      case $host in
4107      *-*-darwin*)
4108        # Don't allow lazy linking, it breaks C++ global constructors
4109        if test "$tagname" = CXX ; then
4110        compile_command="$compile_command ${wl}-bind_at_load"
4111        finalize_command="$finalize_command ${wl}-bind_at_load"
4112        fi
4113	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
4114	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
4115	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
4116        ;;
4117      esac
4118
4119      compile_command="$compile_command $compile_deplibs"
4120      finalize_command="$finalize_command $finalize_deplibs"
4121
4122      if test -n "$rpath$xrpath"; then
4123	# If the user specified any rpath flags, then add them.
4124	for libdir in $rpath $xrpath; do
4125	  # This is the magic to use -rpath.
4126	  case "$finalize_rpath " in
4127	  *" $libdir "*) ;;
4128	  *) finalize_rpath="$finalize_rpath $libdir" ;;
4129	  esac
4130	done
4131      fi
4132
4133      # Now hardcode the library paths
4134      rpath=
4135      hardcode_libdirs=
4136      for libdir in $compile_rpath $finalize_rpath; do
4137	if test -n "$hardcode_libdir_flag_spec"; then
4138	  if test -n "$hardcode_libdir_separator"; then
4139	    if test -z "$hardcode_libdirs"; then
4140	      hardcode_libdirs="$libdir"
4141	    else
4142	      # Just accumulate the unique libdirs.
4143	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4144	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4145		;;
4146	      *)
4147		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4148		;;
4149	      esac
4150	    fi
4151	  else
4152	    eval flag=\"$hardcode_libdir_flag_spec\"
4153	    rpath="$rpath $flag"
4154	  fi
4155	elif test -n "$runpath_var"; then
4156	  case "$perm_rpath " in
4157	  *" $libdir "*) ;;
4158	  *) perm_rpath="$perm_rpath $libdir" ;;
4159	  esac
4160	fi
4161	case $host in
4162	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4163	  case :$dllsearchpath: in
4164	  *":$libdir:"*) ;;
4165	  *) dllsearchpath="$dllsearchpath:$libdir";;
4166	  esac
4167	  ;;
4168	esac
4169      done
4170      # Substitute the hardcoded libdirs into the rpath.
4171      if test -n "$hardcode_libdir_separator" &&
4172	 test -n "$hardcode_libdirs"; then
4173	libdir="$hardcode_libdirs"
4174	eval rpath=\" $hardcode_libdir_flag_spec\"
4175      fi
4176      compile_rpath="$rpath"
4177
4178      rpath=
4179      hardcode_libdirs=
4180      for libdir in $finalize_rpath; do
4181	if test -n "$hardcode_libdir_flag_spec"; then
4182	  if test -n "$hardcode_libdir_separator"; then
4183	    if test -z "$hardcode_libdirs"; then
4184	      hardcode_libdirs="$libdir"
4185	    else
4186	      # Just accumulate the unique libdirs.
4187	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
4188	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
4189		;;
4190	      *)
4191		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
4192		;;
4193	      esac
4194	    fi
4195	  else
4196	    eval flag=\"$hardcode_libdir_flag_spec\"
4197	    rpath="$rpath $flag"
4198	  fi
4199	elif test -n "$runpath_var"; then
4200	  case "$finalize_perm_rpath " in
4201	  *" $libdir "*) ;;
4202	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
4203	  esac
4204	fi
4205      done
4206      # Substitute the hardcoded libdirs into the rpath.
4207      if test -n "$hardcode_libdir_separator" &&
4208	 test -n "$hardcode_libdirs"; then
4209	libdir="$hardcode_libdirs"
4210	eval rpath=\" $hardcode_libdir_flag_spec\"
4211      fi
4212      finalize_rpath="$rpath"
4213
4214      if test -n "$libobjs" && test "$build_old_libs" = yes; then
4215	# Transform all the library objects into standard objects.
4216	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4217	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4218      fi
4219
4220      dlsyms=
4221      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
4222	if test -n "$NM" && test -n "$global_symbol_pipe"; then
4223	  dlsyms="${outputname}S.c"
4224	else
4225	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
4226	fi
4227      fi
4228
4229      if test -n "$dlsyms"; then
4230	case $dlsyms in
4231	"") ;;
4232	*.c)
4233	  # Discover the nlist of each of the dlfiles.
4234	  nlist="$output_objdir/${outputname}.nm"
4235
4236	  $show "$rm $nlist ${nlist}S ${nlist}T"
4237	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
4238
4239	  # Parse the name list into a source file.
4240	  $show "creating $output_objdir/$dlsyms"
4241
4242	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
4243/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
4244/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
4245
4246#ifdef __cplusplus
4247extern \"C\" {
4248#endif
4249
4250/* Prevent the only kind of declaration conflicts we can make. */
4251#define lt_preloaded_symbols some_other_symbol
4252
4253/* External symbol declarations for the compiler. */\
4254"
4255
4256	  if test "$dlself" = yes; then
4257	    $show "generating symbol list for \`$output'"
4258
4259	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
4260
4261	    # Add our own program objects to the symbol list.
4262	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
4263	    for arg in $progfiles; do
4264	      $show "extracting global C symbols from \`$arg'"
4265	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4266	    done
4267
4268	    if test -n "$exclude_expsyms"; then
4269	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
4270	      $run eval '$mv "$nlist"T "$nlist"'
4271	    fi
4272
4273	    if test -n "$export_symbols_regex"; then
4274	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
4275	      $run eval '$mv "$nlist"T "$nlist"'
4276	    fi
4277
4278	    # Prepare the list of exported symbols
4279	    if test -z "$export_symbols"; then
4280	      export_symbols="$output_objdir/$output.exp"
4281	      $run $rm $export_symbols
4282	      $run eval "${SED} -n -e '/^: @PROGRAM@$/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4283	    else
4284	      $run eval "${SED} -e 's/\([][.*^$]\)/\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$output.exp"'
4285	      $run eval 'grep -f "$output_objdir/$output.exp" < "$nlist" > "$nlist"T'
4286	      $run eval 'mv "$nlist"T "$nlist"'
4287	    fi
4288	  fi
4289
4290	  for arg in $dlprefiles; do
4291	    $show "extracting global C symbols from \`$arg'"
4292	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
4293	    $run eval '$echo ": $name " >> "$nlist"'
4294	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
4295	  done
4296
4297	  if test -z "$run"; then
4298	    # Make sure we have at least an empty file.
4299	    test -f "$nlist" || : > "$nlist"
4300
4301	    if test -n "$exclude_expsyms"; then
4302	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
4303	      $mv "$nlist"T "$nlist"
4304	    fi
4305
4306	    # Try sorting and uniquifying the output.
4307	    if grep -v "^: " < "$nlist" |
4308		if sort -k 3 </dev/null >/dev/null 2>&1; then
4309		  sort -k 3
4310		else
4311		  sort +2
4312		fi |
4313		uniq > "$nlist"S; then
4314	      :
4315	    else
4316	      grep -v "^: " < "$nlist" > "$nlist"S
4317	    fi
4318
4319	    if test -f "$nlist"S; then
4320	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
4321	    else
4322	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
4323	    fi
4324
4325	    $echo >> "$output_objdir/$dlsyms" "\
4326
4327#undef lt_preloaded_symbols
4328
4329#if defined (__STDC__) && __STDC__
4330# define lt_ptr void *
4331#else
4332# define lt_ptr char *
4333# define const
4334#endif
4335
4336/* The mapping between symbol names and symbols. */
4337const struct {
4338  const char *name;
4339  lt_ptr address;
4340}
4341lt_preloaded_symbols[] =
4342{\
4343"
4344
4345	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
4346
4347	    $echo >> "$output_objdir/$dlsyms" "\
4348  {0, (lt_ptr) 0}
4349};
4350
4351/* This works around a problem in FreeBSD linker */
4352#ifdef FREEBSD_WORKAROUND
4353static const void *lt_preloaded_setup() {
4354  return lt_preloaded_symbols;
4355}
4356#endif
4357
4358#ifdef __cplusplus
4359}
4360#endif\
4361"
4362	  fi
4363
4364	  pic_flag_for_symtable=
4365	  case $host in
4366	  # compiling the symbol table file with pic_flag works around
4367	  # a FreeBSD bug that causes programs to crash when -lm is
4368	  # linked before any other PIC object.  But we must not use
4369	  # pic_flag when linking with -static.  The problem exists in
4370	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4371	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
4372	    case "$compile_command " in
4373	    *" -static "*) ;;
4374	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
4375	    esac;;
4376	  *-*-hpux*)
4377	    case "$compile_command " in
4378	    *" -static "*) ;;
4379	    *) pic_flag_for_symtable=" $pic_flag";;
4380	    esac
4381	  esac
4382
4383	  # Now compile the dynamic symbol file.
4384	  $show "(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4385	  $run eval '(cd $output_objdir && $LTCC -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
4386
4387	  # Clean up the generated files.
4388	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
4389	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
4390
4391	  # Transform the symbol file into the correct name.
4392	  compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4393	  finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4394	  ;;
4395	*)
4396	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
4397	  exit 1
4398	  ;;
4399	esac
4400      else
4401	# We keep going just in case the user didn't refer to
4402	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
4403	# really was required.
4404
4405	# Nullify the symbol file.
4406	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
4407	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
4408      fi
4409
4410      # AIX runtime linking requires linking programs with -Wl,-brtl and libs with -Wl,-G
4411      # Also add -bnolibpath to the beginning of the link line, to clear the hardcoded runpath.
4412      # Otherwise, things like the -L path to libgcc.a are accidentally hardcoded by ld.
4413      # This does not apply on AIX for ia64, which uses a SysV linker.
4414      case "$host" in
4415        ia64-*-aix5*) ;;
4416        *-*-aix4* | *-*-aix5*)
4417                   compile_command=`$echo "X$compile_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"`
4418                   finalize_command=`$echo "X$finalize_command $wl-brtl" | $Xsed -e "s/\$CC/\$CC $wl-bnolibpath/1"` ;;
4419      esac
4420
4421      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
4422	# Replace the output file specification.
4423	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4424	link_command="$compile_command$compile_rpath"
4425
4426	# We have no uninstalled library dependencies, so finalize right now.
4427	$show "$link_command"
4428	$run eval "$link_command"
4429	status=$?
4430
4431	# Delete the generated files.
4432	if test -n "$dlsyms"; then
4433	  $show "$rm $output_objdir/${outputname}S.${objext}"
4434	  $run $rm "$output_objdir/${outputname}S.${objext}"
4435	fi
4436
4437	exit $status
4438      fi
4439
4440      if test -n "$shlibpath_var"; then
4441	# We should set the shlibpath_var
4442	rpath=
4443	for dir in $temp_rpath; do
4444	  case $dir in
4445	  [\\/]* | [A-Za-z]:[\\/]*)
4446	    # Absolute path.
4447	    rpath="$rpath$dir:"
4448	    ;;
4449	  *)
4450	    # Relative path: add a thisdir entry.
4451	    rpath="$rpath\$thisdir/$dir:"
4452	    ;;
4453	  esac
4454	done
4455	temp_rpath="$rpath"
4456      fi
4457
4458      if test -n "$compile_shlibpath$finalize_shlibpath"; then
4459	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
4460      fi
4461      if test -n "$finalize_shlibpath"; then
4462	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
4463      fi
4464
4465      compile_var=
4466      finalize_var=
4467      if test -n "$runpath_var"; then
4468	if test -n "$perm_rpath"; then
4469	  # We should set the runpath_var.
4470	  rpath=
4471	  for dir in $perm_rpath; do
4472	    rpath="$rpath$dir:"
4473	  done
4474	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
4475	fi
4476	if test -n "$finalize_perm_rpath"; then
4477	  # We should set the runpath_var.
4478	  rpath=
4479	  for dir in $finalize_perm_rpath; do
4480	    rpath="$rpath$dir:"
4481	  done
4482	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
4483	fi
4484      fi
4485
4486      if test "$no_install" = yes; then
4487	# We don't need to create a wrapper script.
4488	link_command="$compile_var$compile_command$compile_rpath"
4489	# Replace the output file specification.
4490	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
4491	# Delete the old output file.
4492	$run $rm $output
4493	# Link the executable and exit
4494	$show "$link_command"
4495	$run eval "$link_command" || exit $?
4496	exit 0
4497      fi
4498
4499      if test "$hardcode_action" = relink; then
4500	# Fast installation is not supported
4501	link_command="$compile_var$compile_command$compile_rpath"
4502	relink_command="$finalize_var$finalize_command$finalize_rpath"
4503
4504	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
4505	$echo "$modename: \`$output' will be relinked during installation" 1>&2
4506      else
4507	if test "$fast_install" != no; then
4508	  link_command="$finalize_var$compile_command$finalize_rpath"
4509	  if test "$fast_install" = yes; then
4510	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
4511	  else
4512	    # fast_install is set to needless
4513	    relink_command=
4514	  fi
4515	else
4516	  link_command="$compile_var$compile_command$compile_rpath"
4517	  relink_command="$finalize_var$finalize_command$finalize_rpath"
4518	fi
4519      fi
4520
4521      # Replace the output file specification.
4522      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
4523
4524      # Delete the old output files.
4525      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
4526
4527      $show "$link_command"
4528      $run eval "$link_command" || exit $?
4529
4530      # Now create the wrapper script.
4531      $show "creating $output"
4532
4533      # Quote the relink command for shipping.
4534      if test -n "$relink_command"; then
4535	# Preserve any variables that may affect compiler behavior
4536	for var in $variables_saved_for_relink; do
4537	  if eval test -z \"\${$var+set}\"; then
4538	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
4539	  elif eval var_value=\$$var; test -z "$var_value"; then
4540	    relink_command="$var=; export $var; $relink_command"
4541	  else
4542	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
4543	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
4544	  fi
4545	done
4546	relink_command="(cd `pwd`; $relink_command)"
4547	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
4548      fi
4549
4550      # Quote $echo for shipping.
4551      if test "X$echo" = "X$SHELL $0 --fallback-echo"; then
4552	case $0 in
4553	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $0 --fallback-echo";;
4554	*) qecho="$SHELL `pwd`/$0 --fallback-echo";;
4555	esac
4556	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
4557      else
4558	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
4559      fi
4560
4561      # Only actually do things if our run command is non-null.
4562      if test -z "$run"; then
4563	# win32 will think the script is a binary if it has
4564	# a .exe suffix, so we strip it off here.
4565	case $output in
4566	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
4567	esac
4568	# test for cygwin because mv fails w/o .exe extensions
4569	case $host in
4570	  *cygwin*)
4571	    exeext=.exe
4572	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
4573	  *) exeext= ;;
4574	esac
4575	case $host in
4576	  *mingw* )
4577	    cwrappersource=`$echo ${output_objdir}/lt-${outputname}.c`
4578	    cwrapper=`$echo ${output}.exe`
4579	    $rm $cwrappersource $cwrapper
4580	    trap "$rm $cwrappersource $cwrapper; exit 1" 1 2 15
4581
4582	    cat > $cwrappersource <<EOF
4583
4584/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
4585   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4586
4587   The $output program cannot be directly executed until all the libtool
4588   libraries that it depends on are installed.
4589   
4590   This wrapper executable should never be moved out of the build directory.
4591   If it is, it will not operate correctly.
4592
4593   Currently, it simply execs the wrapper *script* "/bin/sh $output",
4594   but could eventually absorb all of the scripts functionality and
4595   exec $objdir/$outputname directly.
4596*/
4597EOF
4598	    cat >> $cwrappersource<<"EOF"
4599#include <stdio.h>
4600#include <stdlib.h>
4601#include <unistd.h>
4602#include <malloc.h>
4603#include <stdarg.h>
4604#include <assert.h>
4605
4606#if defined(PATH_MAX)
4607# define LT_PATHMAX PATH_MAX
4608#elif defined(MAXPATHLEN)
4609# define LT_PATHMAX MAXPATHLEN
4610#else
4611# define LT_PATHMAX 1024
4612#endif
4613
4614#ifndef DIR_SEPARATOR
4615#define DIR_SEPARATOR '/'
4616#endif
4617
4618#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
4619  defined (__OS2__)
4620#define HAVE_DOS_BASED_FILE_SYSTEM
4621#ifndef DIR_SEPARATOR_2
4622#define DIR_SEPARATOR_2 '\\'
4623#endif
4624#endif
4625
4626#ifndef DIR_SEPARATOR_2
4627# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
4628#else /* DIR_SEPARATOR_2 */
4629# define IS_DIR_SEPARATOR(ch) \
4630        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
4631#endif /* DIR_SEPARATOR_2 */
4632
4633#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
4634#define XFREE(stale) do { \
4635  if (stale) { free ((void *) stale); stale = 0; } \
4636} while (0)
4637
4638const char *program_name = NULL;
4639
4640void * xmalloc (size_t num);
4641char * xstrdup (const char *string);
4642char * basename (const char *name);
4643char * fnqualify(const char *path);
4644char * strendzap(char *str, const char *pat);
4645void lt_fatal (const char *message, ...);
4646
4647int
4648main (int argc, char *argv[])
4649{
4650  char **newargz;
4651  int i;
4652
4653  program_name = (char *) xstrdup ((char *) basename (argv[0]));
4654  newargz = XMALLOC(char *, argc+2);
4655EOF
4656
4657	    cat >> $cwrappersource <<EOF
4658  newargz[0] = "$SHELL";
4659EOF
4660
4661	    cat >> $cwrappersource <<"EOF"
4662  newargz[1] = fnqualify(argv[0]);
4663  /* we know the script has the same name, without the .exe */
4664  /* so make sure newargz[1] doesn't end in .exe */
4665  strendzap(newargz[1],".exe");
4666  for (i = 1; i < argc; i++)
4667    newargz[i+1] = xstrdup(argv[i]);
4668  newargz[argc+1] = NULL;
4669EOF
4670
4671	    cat >> $cwrappersource <<EOF
4672  execv("$SHELL",newargz);
4673EOF
4674
4675	    cat >> $cwrappersource <<"EOF"
4676}
4677
4678void *
4679xmalloc (size_t num)
4680{
4681  void * p = (void *) malloc (num);
4682  if (!p)
4683    lt_fatal ("Memory exhausted");
4684
4685  return p;
4686}
4687
4688char *
4689xstrdup (const char *string)
4690{
4691  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
4692;
4693}
4694
4695char *
4696basename (const char *name)
4697{
4698  const char *base;
4699
4700#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4701  /* Skip over the disk name in MSDOS pathnames. */
4702  if (isalpha (name[0]) && name[1] == ':')
4703    name += 2;
4704#endif
4705
4706  for (base = name; *name; name++)
4707    if (IS_DIR_SEPARATOR (*name))
4708      base = name + 1;
4709  return (char *) base;
4710}
4711
4712char *
4713fnqualify(const char *path)
4714{
4715  size_t size;
4716  char *p;
4717  char tmp[LT_PATHMAX + 1];
4718
4719  assert(path != NULL);
4720
4721  /* Is it qualified already? */
4722#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
4723  if (isalpha (path[0]) && path[1] == ':')
4724    return xstrdup (path);
4725#endif
4726  if (IS_DIR_SEPARATOR (path[0]))
4727    return xstrdup (path);
4728
4729  /* prepend the current directory */
4730  /* doesn't handle '~' */
4731  if (getcwd (tmp, LT_PATHMAX) == NULL)
4732    lt_fatal ("getcwd failed");
4733  size = strlen(tmp) + 1 + strlen(path) + 1; /* +2 for '/' and '\0' */
4734  p = XMALLOC(char, size);
4735  sprintf(p, "%s%c%s", tmp, DIR_SEPARATOR, path);
4736  return p;
4737}
4738
4739char *
4740strendzap(char *str, const char *pat)
4741{
4742  size_t len, patlen;
4743
4744  assert(str != NULL);
4745  assert(pat != NULL);
4746
4747  len = strlen(str);
4748  patlen = strlen(pat);
4749
4750  if (patlen <= len)
4751  {
4752    str += len - patlen;
4753    if (strcmp(str, pat) == 0)
4754      *str = '\0';
4755  }
4756  return str;
4757}
4758
4759static void
4760lt_error_core (int exit_status, const char * mode,
4761          const char * message, va_list ap)
4762{
4763  fprintf (stderr, "%s: %s: ", program_name, mode);
4764  vfprintf (stderr, message, ap);
4765  fprintf (stderr, ".\n");
4766
4767  if (exit_status >= 0)
4768    exit (exit_status);
4769}
4770
4771void
4772lt_fatal (const char *message, ...)
4773{
4774  va_list ap;
4775  va_start (ap, message);
4776  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
4777  va_end (ap);
4778}
4779EOF
4780	  # we should really use a build-platform specific compiler
4781	  # here, but OTOH, the wrappers (shell script and this C one)
4782	  # are only useful if you want to execute the "real" binary.
4783	  # Since the "real" binary is built for $host, then this
4784	  # wrapper might as well be built for $host, too.
4785	  $run $LTCC -s -o $cwrapper $cwrappersource
4786	  ;;
4787	esac
4788	$rm $output
4789	trap "$rm $output; exit 1" 1 2 15
4790
4791	$echo > $output "\
4792#! $SHELL
4793
4794# $output - temporary wrapper script for $objdir/$outputname
4795# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
4796#
4797# The $output program cannot be directly executed until all the libtool
4798# libraries that it depends on are installed.
4799#
4800# This wrapper script should never be moved out of the build directory.
4801# If it is, it will not operate correctly.
4802
4803# Sed substitution that helps us do robust quoting.  It backslashifies
4804# metacharacters that are still active within double-quoted strings.
4805Xsed='${SED} -e 1s/^X//'
4806sed_quote_subst='$sed_quote_subst'
4807
4808# The HP-UX ksh and POSIX shell print the target directory to stdout
4809# if CDPATH is set.
4810if test \"\${CDPATH+set}\" = set; then CDPATH=:; export CDPATH; fi
4811
4812relink_command=\"$relink_command\"
4813
4814# This environment variable determines our operation mode.
4815if test \"\$libtool_install_magic\" = \"$magic\"; then
4816  # install mode needs the following variable:
4817  notinst_deplibs='$notinst_deplibs'
4818else
4819  # When we are sourced in execute mode, \$file and \$echo are already set.
4820  if test \"\$libtool_execute_magic\" != \"$magic\"; then
4821    echo=\"$qecho\"
4822    file=\"\$0\"
4823    # Make sure echo works.
4824    if test \"X\$1\" = X--no-reexec; then
4825      # Discard the --no-reexec flag, and continue.
4826      shift
4827    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
4828      # Yippee, \$echo works!
4829      :
4830    else
4831      # Restart under the correct shell, and then maybe \$echo will work.
4832      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
4833    fi
4834  fi\
4835"
4836	$echo >> $output "\
4837
4838  # Find the directory that this script lives in.
4839  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
4840  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
4841
4842  # Follow symbolic links until we get to the real thisdir.
4843  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
4844  while test -n \"\$file\"; do
4845    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
4846
4847    # If there was a directory component, then change thisdir.
4848    if test \"x\$destdir\" != \"x\$file\"; then
4849      case \"\$destdir\" in
4850      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
4851      *) thisdir=\"\$thisdir/\$destdir\" ;;
4852      esac
4853    fi
4854
4855    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
4856    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
4857  done
4858
4859  # Try to get the absolute directory name.
4860  absdir=\`cd \"\$thisdir\" && pwd\`
4861  test -n \"\$absdir\" && thisdir=\"\$absdir\"
4862"
4863
4864	if test "$fast_install" = yes; then
4865	  $echo >> $output "\
4866  program=lt-'$outputname'$exeext
4867  progdir=\"\$thisdir/$objdir\"
4868
4869  if test ! -f \"\$progdir/\$program\" || \\
4870     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
4871       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
4872
4873    file=\"\$\$-\$program\"
4874
4875    if test ! -d \"\$progdir\"; then
4876      $mkdir \"\$progdir\"
4877    else
4878      $rm \"\$progdir/\$file\"
4879    fi"
4880
4881	  $echo >> $output "\
4882
4883    # relink executable if necessary
4884    if test -n \"\$relink_command\"; then
4885      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
4886      else
4887	$echo \"\$relink_command_output\" >&2
4888	$rm \"\$progdir/\$file\"
4889	exit 1
4890      fi
4891    fi
4892
4893    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
4894    { $rm \"\$progdir/\$program\";
4895      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
4896    $rm \"\$progdir/\$file\"
4897  fi"
4898	else
4899	  $echo >> $output "\
4900  program='$outputname'
4901  progdir=\"\$thisdir/$objdir\"
4902"
4903	fi
4904
4905	$echo >> $output "\
4906
4907  if test -f \"\$progdir/\$program\"; then"
4908
4909	# Export our shlibpath_var if we have one.
4910	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
4911	  $echo >> $output "\
4912    # Add our own library path to $shlibpath_var
4913    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
4914
4915    # Some systems cannot cope with colon-terminated $shlibpath_var
4916    # The second colon is a workaround for a bug in BeOS R4 sed
4917    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
4918
4919    export $shlibpath_var
4920"
4921	fi
4922
4923	# fixup the dll searchpath if we need to.
4924	if test -n "$dllsearchpath"; then
4925	  $echo >> $output "\
4926    # Add the dll search path components to the executable PATH
4927    PATH=$dllsearchpath:\$PATH
4928"
4929	fi
4930
4931	$echo >> $output "\
4932    if test \"\$libtool_execute_magic\" != \"$magic\"; then
4933      # Run the actual program with our arguments.
4934"
4935	case $host in
4936	# Backslashes separate directories on plain windows
4937	*-*-mingw | *-*-os2*)
4938	  $echo >> $output "\
4939      exec \$progdir\\\\\$program \${1+\"\$@\"}
4940"
4941	  ;;
4942
4943	*)
4944	  # Need to set LD_LIBRARY_PATH, to the value already
4945	  # computed within libtool.
4946	  $echo >> $output "\
4947      LD_LIBRARY_PATH=\"$rpath\" exec \$progdir/\$program \${1+\"\$@\"}
4948"
4949	  ;;
4950	esac
4951	$echo >> $output "\
4952      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
4953      exit 1
4954    fi
4955  else
4956    # The program doesn't exist.
4957    \$echo \"\$0: error: \$progdir/\$program does not exist\" 1>&2
4958    \$echo \"This script is just a wrapper for \$program.\" 1>&2
4959    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
4960    exit 1
4961  fi
4962fi\
4963"
4964	chmod +x $output
4965      fi
4966      exit 0
4967      ;;
4968    esac
4969
4970    # See if we need to build an old-fashioned archive.
4971    for oldlib in $oldlibs; do
4972
4973      if test "$build_libtool_libs" = convenience; then
4974	oldobjs="$libobjs_save"
4975	addlibs="$convenience"
4976	build_libtool_libs=no
4977      else
4978	if test "$build_libtool_libs" = module; then
4979	  oldobjs="$libobjs_save"
4980	  build_libtool_libs=no
4981	else
4982	  oldobjs="$old_deplibs $non_pic_objects"
4983	fi
4984	addlibs="$old_convenience"
4985      fi
4986
4987      if test -n "$addlibs"; then
4988	gentop="$output_objdir/${outputname}x"
4989	$show "${rm}r $gentop"
4990	$run ${rm}r "$gentop"
4991	$show "$mkdir $gentop"
4992	$run $mkdir "$gentop"
4993	status=$?
4994	if test "$status" -ne 0 && test ! -d "$gentop"; then
4995	  exit $status
4996	fi
4997	generated="$generated $gentop"
4998
4999	# Add in members from convenience archives.
5000	for xlib in $addlibs; do
5001	  # Extract the objects.
5002	  case $xlib in
5003	  [\\/]* | [A-Za-z]:[\\/]*) xabs="$xlib" ;;
5004	  *) xabs=`pwd`"/$xlib" ;;
5005	  esac
5006	  xlib=`$echo "X$xlib" | $Xsed -e 's%^.*/%%'`
5007	  xdir="$gentop/$xlib"
5008
5009	  $show "${rm}r $xdir"
5010	  $run ${rm}r "$xdir"
5011	  $show "$mkdir $xdir"
5012	  $run $mkdir "$xdir"
5013	  status=$?
5014	  if test "$status" -ne 0 && test ! -d "$xdir"; then
5015	    exit $status
5016	  fi
5017	  # We will extract separately just the conflicting names and we will no
5018	  # longer touch any unique names. It is faster to leave these extract
5019	  # automatically by $AR in one run.
5020	  $show "(cd $xdir && $AR x $xabs)"
5021	  $run eval "(cd \$xdir && $AR x \$xabs)" || exit $?
5022	  if ($AR t "$xabs" | sort | sort -uc >/dev/null 2>&1); then
5023	    :
5024	  else
5025	    $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
5026	    $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
5027	    $AR t "$xabs" | sort | uniq -cd | while read -r count name
5028	    do
5029	      i=1
5030	      while test "$i" -le "$count"
5031	      do
5032	       # Put our $i before any first dot (extension)
5033	       # Never overwrite any file
5034	       name_to="$name"
5035	       while test "X$name_to" = "X$name" || test -f "$xdir/$name_to"
5036	       do
5037		 name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
5038	       done
5039	       $show "(cd $xdir && $AR xN $i $xabs '$name' && $mv '$name' '$name_to')"
5040	       $run eval "(cd \$xdir && $AR xN $i \$xabs '$name' && $mv '$name' '$name_to')" || exit $?
5041	       i=`expr $i + 1`
5042	      done
5043	    done
5044	  fi
5045
5046	  oldobjs="$oldobjs "`find $xdir -name \*.${objext} -print -o -name \*.lo -print | $NL2SP`
5047	done
5048      fi
5049
5050      compiler_flags="$compiler_flags $add_flags"
5051
5052      # Do each command in the archive commands.
5053      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
5054	eval cmds=\"$old_archive_from_new_cmds\"
5055      else
5056	eval cmds=\"$old_archive_cmds\"
5057
5058	if len=`expr "X$cmds" : ".*"` &&
5059	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
5060	  :
5061	else
5062	  # the command line is too long to link in one step, link in parts
5063	  $echo "using piecewise archive linking..."
5064	  save_RANLIB=$RANLIB
5065	  RANLIB=:
5066	  objlist=
5067	  concat_cmds=
5068	  save_oldobjs=$oldobjs
5069	  # GNU ar 2.10+ was changed to match POSIX; thus no paths are
5070	  # encoded into archives.  This makes 'ar r' malfunction in
5071	  # this piecewise linking case whenever conflicting object
5072	  # names appear in distinct ar calls; check, warn and compensate.
5073	    if (for obj in $save_oldobjs
5074	    do
5075	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
5076	    done | sort | sort -uc >/dev/null 2>&1); then
5077	    :
5078	  else
5079	    $echo "$modename: warning: object name conflicts; overriding AR_FLAGS to 'cq'" 1>&2
5080	    $echo "$modename: warning: to ensure that POSIX-compatible ar will work" 1>&2
5081	    AR_FLAGS=cq
5082	  fi
5083	  # Is there a better way of finding the last object in the list?
5084	  for obj in $save_oldobjs
5085	  do
5086	    last_oldobj=$obj
5087	  done
5088	  for obj in $save_oldobjs
5089	  do
5090	    oldobjs="$objlist $obj"
5091	    objlist="$objlist $obj"
5092	    eval test_cmds=\"$old_archive_cmds\"
5093	    if len=`expr "X$test_cmds" : ".*"` &&
5094	       test "$len" -le "$max_cmd_len"; then
5095	      :
5096	    else
5097	      # the above command should be used before it gets too long
5098	      oldobjs=$objlist
5099	      if test "$obj" = "$last_oldobj" ; then
5100	        RANLIB=$save_RANLIB
5101	      fi
5102	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
5103	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
5104	      objlist=
5105	    fi
5106	  done
5107	  RANLIB=$save_RANLIB
5108	  oldobjs=$objlist
5109	  if test "X$oldobjs" = "X" ; then
5110	    eval cmds=\"\$concat_cmds\"
5111	  else
5112	    eval cmds=\"\$concat_cmds~$old_archive_cmds\"
5113	  fi
5114	fi
5115      fi
5116      save_ifs="$IFS"; IFS='~'
5117      for cmd in $cmds; do
5118	IFS="$save_ifs"
5119	$show "$cmd"
5120	$run eval "$cmd" || exit $?
5121      done
5122      IFS="$save_ifs"
5123    done
5124
5125    if test -n "$generated"; then
5126      $show "${rm}r$generated"
5127      $run ${rm}r$generated
5128    fi
5129
5130    # Now create the libtool archive.
5131    case $output in
5132    *.la)
5133      old_library=
5134      test "$build_old_libs" = yes && old_library="$libname.$libext"
5135      $show "creating $output"
5136
5137      # Preserve any variables that may affect compiler behavior
5138      for var in $variables_saved_for_relink; do
5139	if eval test -z \"\${$var+set}\"; then
5140	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
5141	elif eval var_value=\$$var; test -z "$var_value"; then
5142	  relink_command="$var=; export $var; $relink_command"
5143	else
5144	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
5145	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
5146	fi
5147      done
5148      # Quote the link command for shipping.
5149      relink_command="(cd `pwd`; $SHELL $0 --mode=relink $libtool_args @inst_prefix_dir@)"
5150      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
5151      if test "$hardcode_automatic" = yes ; then
5152        relink_command=
5153      fi
5154      # Only create the output if not a dry run.
5155      if test -z "$run"; then
5156	for installed in no yes; do
5157	  if test "$installed" = yes; then
5158	    if test -z "$install_libdir"; then
5159	      break
5160	    fi
5161	    output="$output_objdir/$outputname"i
5162	    # Replace all uninstalled libtool libraries with the installed ones
5163	    newdependency_libs=
5164	    for deplib in $dependency_libs; do
5165	      case $deplib in
5166	      *.la)
5167		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
5168		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
5169		if test -z "$libdir"; then
5170		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
5171		  exit 1
5172		fi
5173		newdependency_libs="$newdependency_libs $libdir/$name"
5174		;;
5175	      *) newdependency_libs="$newdependency_libs $deplib" ;;
5176	      esac
5177	    done
5178	    dependency_libs="$newdependency_libs"
5179	    newdlfiles=
5180	    for lib in $dlfiles; do
5181	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5182	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5183	      if test -z "$libdir"; then
5184		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5185		exit 1
5186	      fi
5187	      newdlfiles="$newdlfiles $libdir/$name"
5188	    done
5189	    dlfiles="$newdlfiles"
5190	    newdlprefiles=
5191	    for lib in $dlprefiles; do
5192	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
5193	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
5194	      if test -z "$libdir"; then
5195		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5196		exit 1
5197	      fi
5198	      newdlprefiles="$newdlprefiles $libdir/$name"
5199	    done
5200	    dlprefiles="$newdlprefiles"
5201	  fi
5202	  $rm $output
5203	  # place dlname in correct position for cygwin
5204	  tdlname=$dlname
5205	  case $host,$output,$installed,$module,$dlname in
5206	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
5207	  esac
5208	  $echo > $output "\
5209# $outputname - a libtool library file
5210# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
5211#
5212# Please DO NOT delete this file!
5213# It is necessary for linking the library.
5214
5215# The name that we can dlopen(3).
5216dlname='$tdlname'
5217
5218# Names of this library.
5219library_names='$library_names'
5220
5221# The name of the static archive.
5222old_library='$old_library'
5223
5224# Libraries that this one depends upon.
5225dependency_libs='$dependency_libs'
5226
5227# Version information for $libname.
5228current=$current
5229age=$age
5230revision=$revision
5231
5232# Is this an already installed library?
5233installed=$installed
5234
5235# Should we warn about portability when linking against -modules?
5236shouldnotlink=$module
5237
5238# Files to dlopen/dlpreopen
5239dlopen='$dlfiles'
5240dlpreopen='$dlprefiles'
5241
5242# Directory that this library needs to be installed in:
5243libdir='$install_libdir'"
5244	  if test "$installed" = no && test "$need_relink" = yes && test "$fast_install" = no; then
5245	    $echo >> $output "\
5246relink_command=\"$relink_command\""
5247	  fi
5248	done
5249      fi
5250
5251      # Do a symbolic link so that the libtool archive can be found in
5252      # LD_LIBRARY_PATH before the program is installed.
5253      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
5254      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
5255      ;;
5256    esac
5257    exit 0
5258    ;;
5259
5260  # libtool install mode
5261  install)
5262    modename="$modename: install"
5263
5264    # There may be an optional sh(1) argument at the beginning of
5265    # install_prog (especially on Windows NT).
5266    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
5267       # Allow the use of GNU shtool's install command.
5268       $echo "X$nonopt" | $Xsed | grep shtool > /dev/null; then
5269      # Aesthetically quote it.
5270      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
5271      case $arg in
5272      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
5273	arg="\"$arg\""
5274	;;
5275      esac
5276      install_prog="$arg "
5277      arg="$1"
5278      shift
5279    else
5280      install_prog=
5281      arg="$nonopt"
5282    fi
5283
5284    # The real first argument should be the name of the installation program.
5285    # Aesthetically quote it.
5286    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5287    case $arg in
5288    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
5289      arg="\"$arg\""
5290      ;;
5291    esac
5292    install_prog="$install_prog$arg"
5293
5294    # We need to accept at least all the BSD install flags.
5295    dest=
5296    files=
5297    opts=
5298    prev=
5299    install_type=
5300    isdir=no
5301    stripme=
5302    for arg
5303    do
5304      if test -n "$dest"; then
5305	files="$files $dest"
5306	dest="$arg"
5307	continue
5308      fi
5309
5310      case $arg in
5311      -d) isdir=yes ;;
5312      -f) prev="-f" ;;
5313      -g) prev="-g" ;;
5314      -m) prev="-m" ;;
5315      -o) prev="-o" ;;
5316      -s)
5317	stripme=" -s"
5318	continue
5319	;;
5320      -*) ;;
5321
5322      *)
5323	# If the previous option needed an argument, then skip it.
5324	if test -n "$prev"; then
5325	  prev=
5326	else
5327	  dest="$arg"
5328	  continue
5329	fi
5330	;;
5331      esac
5332
5333      # Aesthetically quote the argument.
5334      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
5335      case $arg in
5336      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*)
5337	arg="\"$arg\""
5338	;;
5339      esac
5340      install_prog="$install_prog $arg"
5341    done
5342
5343    if test -z "$install_prog"; then
5344      $echo "$modename: you must specify an install program" 1>&2
5345      $echo "$help" 1>&2
5346      exit 1
5347    fi
5348
5349    if test -n "$prev"; then
5350      $echo "$modename: the \`$prev' option requires an argument" 1>&2
5351      $echo "$help" 1>&2
5352      exit 1
5353    fi
5354
5355    if test -z "$files"; then
5356      if test -z "$dest"; then
5357	$echo "$modename: no file or destination specified" 1>&2
5358      else
5359	$echo "$modename: you must specify a destination" 1>&2
5360      fi
5361      $echo "$help" 1>&2
5362      exit 1
5363    fi
5364
5365    # Strip any trailing slash from the destination.
5366    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
5367
5368    # Check to see that the destination is a directory.
5369    test -d "$dest" && isdir=yes
5370    if test "$isdir" = yes; then
5371      destdir="$dest"
5372      destname=
5373    else
5374      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
5375      test "X$destdir" = "X$dest" && destdir=.
5376      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
5377
5378      # Not a directory, so check to see that there is only one file specified.
5379      set dummy $files
5380      if test "$#" -gt 2; then
5381	$echo "$modename: \`$dest' is not a directory" 1>&2
5382	$echo "$help" 1>&2
5383	exit 1
5384      fi
5385    fi
5386    case $destdir in
5387    [\\/]* | [A-Za-z]:[\\/]*) ;;
5388    *)
5389      for file in $files; do
5390	case $file in
5391	*.lo) ;;
5392	*)
5393	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
5394	  $echo "$help" 1>&2
5395	  exit 1
5396	  ;;
5397	esac
5398      done
5399      ;;
5400    esac
5401
5402    # This variable tells wrapper scripts just to set variables rather
5403    # than running their programs.
5404    libtool_install_magic="$magic"
5405
5406    staticlibs=
5407    future_libdirs=
5408    current_libdirs=
5409    for file in $files; do
5410
5411      # Do each installation.
5412      case $file in
5413      *.$libext)
5414	# Do the static libraries later.
5415	staticlibs="$staticlibs $file"
5416	;;
5417
5418      *.la)
5419	# Check to see that this really is a libtool archive.
5420	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5421	else
5422	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
5423	  $echo "$help" 1>&2
5424	  exit 1
5425	fi
5426
5427	library_names=
5428	old_library=
5429	relink_command=
5430	# If there is no directory component, then add one.
5431	case $file in
5432	*/* | *\\*) . $file ;;
5433	*) . ./$file ;;
5434	esac
5435
5436	# Add the libdir to current_libdirs if it is the destination.
5437	if test "X$destdir" = "X$libdir"; then
5438	  case "$current_libdirs " in
5439	  *" $libdir "*) ;;
5440	  *) current_libdirs="$current_libdirs $libdir" ;;
5441	  esac
5442	else
5443	  # Note the libdir as a future libdir.
5444	  case "$future_libdirs " in
5445	  *" $libdir "*) ;;
5446	  *) future_libdirs="$future_libdirs $libdir" ;;
5447	  esac
5448	fi
5449
5450	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
5451	test "X$dir" = "X$file/" && dir=
5452	dir="$dir$objdir"
5453
5454	if test -n "$relink_command"; then
5455	  # Determine the prefix the user has applied to our future dir.
5456	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
5457
5458	  # Don't allow the user to place us outside of our expected
5459	  # location b/c this prevents finding dependent libraries that
5460	  # are installed to the same prefix.
5461	  # At present, this check doesn't affect windows .dll's that
5462	  # are installed into $libdir/../bin (currently, that works fine)
5463	  # but it's something to keep an eye on.
5464	  if test "$inst_prefix_dir" = "$destdir"; then
5465	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
5466	    exit 1
5467	  fi
5468
5469	  if test -n "$inst_prefix_dir"; then
5470	    # Stick the inst_prefix_dir data into the link command.
5471	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
5472	  else
5473	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
5474	  fi
5475
5476	  $echo "$modename: warning: relinking \`$file'" 1>&2
5477	  $show "$relink_command"
5478	  if $run eval "$relink_command"; then :
5479	  else
5480	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5481	    exit 1
5482	  fi
5483	fi
5484
5485	# See the names of the shared library.
5486	set dummy $library_names
5487	if test -n "$2"; then
5488	  realname="$2"
5489	  shift
5490	  shift
5491
5492	  srcname="$realname"
5493	  test -n "$relink_command" && srcname="$realname"T
5494
5495	  # Install the shared library and build the symlinks.
5496	  $show "$install_prog $dir/$srcname $destdir/$realname"
5497	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
5498	  if test -n "$stripme" && test -n "$striplib"; then
5499	    $show "$striplib $destdir/$realname"
5500	    $run eval "$striplib $destdir/$realname" || exit $?
5501	  fi
5502
5503	  if test "$#" -gt 0; then
5504	    # Delete the old symlinks, and create new ones.
5505	    for linkname
5506	    do
5507	      if test "$linkname" != "$realname"; then
5508		$show "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5509		$run eval "(cd $destdir && $rm $linkname && $LN_S $realname $linkname)"
5510	      fi
5511	    done
5512	  fi
5513
5514	  # Do each command in the postinstall commands.
5515	  lib="$destdir/$realname"
5516	  eval cmds=\"$postinstall_cmds\"
5517	  save_ifs="$IFS"; IFS='~'
5518	  for cmd in $cmds; do
5519	    IFS="$save_ifs"
5520	    $show "$cmd"
5521	    $run eval "$cmd" || exit $?
5522	  done
5523	  IFS="$save_ifs"
5524	fi
5525
5526	# Install the pseudo-library for information purposes.
5527	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5528	instname="$dir/$name"i
5529	$show "$install_prog $instname $destdir/$name"
5530	$run eval "$install_prog $instname $destdir/$name" || exit $?
5531
5532	# Maybe install the static library, too.
5533	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
5534	;;
5535
5536      *.lo)
5537	# Install (i.e. copy) a libtool object.
5538
5539	# Figure out destination file name, if it wasn't already specified.
5540	if test -n "$destname"; then
5541	  destfile="$destdir/$destname"
5542	else
5543	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5544	  destfile="$destdir/$destfile"
5545	fi
5546
5547	# Deduce the name of the destination old-style object file.
5548	case $destfile in
5549	*.lo)
5550	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
5551	  ;;
5552	*.$objext)
5553	  staticdest="$destfile"
5554	  destfile=
5555	  ;;
5556	*)
5557	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
5558	  $echo "$help" 1>&2
5559	  exit 1
5560	  ;;
5561	esac
5562
5563	# Install the libtool object if requested.
5564	if test -n "$destfile"; then
5565	  $show "$install_prog $file $destfile"
5566	  $run eval "$install_prog $file $destfile" || exit $?
5567	fi
5568
5569	# Install the old object if enabled.
5570	if test "$build_old_libs" = yes; then
5571	  # Deduce the name of the old-style object file.
5572	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
5573
5574	  $show "$install_prog $staticobj $staticdest"
5575	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
5576	fi
5577	exit 0
5578	;;
5579
5580      *)
5581	# Figure out destination file name, if it wasn't already specified.
5582	if test -n "$destname"; then
5583	  destfile="$destdir/$destname"
5584	else
5585	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5586	  destfile="$destdir/$destfile"
5587	fi
5588
5589	# If the file is missing, and there is a .exe on the end, strip it
5590	# because it is most likely a libtool script we actually want to
5591	# install
5592	stripped_ext=""
5593	case $file in
5594	  *.exe)
5595	    if test ! -f "$file"; then
5596	      file=`$echo $file|${SED} 's,.exe$,,'`
5597	      stripped_ext=".exe"
5598	    fi
5599	    ;;
5600	esac
5601
5602	# Do a test to see if this is really a libtool program.
5603	case $host in
5604	*cygwin*|*mingw*)
5605	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
5606	    ;;
5607	*)
5608	    wrapper=$file
5609	    ;;
5610	esac
5611	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
5612	  notinst_deplibs=
5613	  relink_command=
5614
5615	  # To insure that "foo" is sourced, and not "foo.exe",
5616	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
5617	  # which disallows the automatic-append-.exe behavior.
5618	  case $build in
5619	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5620	  *) wrapperdot=${wrapper} ;;
5621	  esac
5622	  # If there is no directory component, then add one.
5623	  case $file in
5624	  */* | *\\*) . ${wrapperdot} ;;
5625	  *) . ./${wrapperdot} ;;
5626	  esac
5627
5628	  # Check the variables that should have been set.
5629	  if test -z "$notinst_deplibs"; then
5630	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
5631	    exit 1
5632	  fi
5633
5634	  finalize=yes
5635	  for lib in $notinst_deplibs; do
5636	    # Check to see that each library is installed.
5637	    libdir=
5638	    if test -f "$lib"; then
5639	      # If there is no directory component, then add one.
5640	      case $lib in
5641	      */* | *\\*) . $lib ;;
5642	      *) . ./$lib ;;
5643	      esac
5644	    fi
5645	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
5646	    if test -n "$libdir" && test ! -f "$libfile"; then
5647	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
5648	      finalize=no
5649	    fi
5650	  done
5651
5652	  relink_command=
5653	  # To insure that "foo" is sourced, and not "foo.exe",
5654	  # finese the cygwin/MSYS system by explicitly sourcing "foo."
5655	  # which disallows the automatic-append-.exe behavior.
5656	  case $build in
5657	  *cygwin* | *mingw*) wrapperdot=${wrapper}. ;;
5658	  *) wrapperdot=${wrapper} ;;
5659	  esac
5660	  # If there is no directory component, then add one.
5661	  case $file in
5662	  */* | *\\*) . ${wrapperdot} ;;
5663	  *) . ./${wrapperdot} ;;
5664	  esac
5665
5666	  outputname=
5667	  if test "$fast_install" = no && test -n "$relink_command"; then
5668	    if test "$finalize" = yes && test -z "$run"; then
5669	      tmpdir="/tmp"
5670	      test -n "$TMPDIR" && tmpdir="$TMPDIR"
5671	      tmpdir="$tmpdir/libtool-$$"
5672	      if $mkdir "$tmpdir" && chmod 700 "$tmpdir"; then :
5673	      else
5674		$echo "$modename: error: cannot create temporary directory \`$tmpdir'" 1>&2
5675		continue
5676	      fi
5677	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
5678	      outputname="$tmpdir/$file"
5679	      # Replace the output file specification.
5680	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
5681
5682	      $show "$relink_command"
5683	      if $run eval "$relink_command"; then :
5684	      else
5685		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
5686		${rm}r "$tmpdir"
5687		continue
5688	      fi
5689	      file="$outputname"
5690	    else
5691	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
5692	    fi
5693	  else
5694	    # Install the binary that we compiled earlier.
5695	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
5696	  fi
5697	fi
5698
5699	# remove .exe since cygwin /usr/bin/install will append another
5700	# one anyways
5701	case $install_prog,$host in
5702	*/usr/bin/install*,*cygwin*)
5703	  case $file:$destfile in
5704	  *.exe:*.exe)
5705	    # this is ok
5706	    ;;
5707	  *.exe:*)
5708	    destfile=$destfile.exe
5709	    ;;
5710	  *:*.exe)
5711	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
5712	    ;;
5713	  esac
5714	  ;;
5715	esac
5716	$show "$install_prog$stripme $file $destfile"
5717	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
5718	test -n "$outputname" && ${rm}r "$tmpdir"
5719	;;
5720      esac
5721    done
5722
5723    for file in $staticlibs; do
5724      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
5725
5726      # Set up the ranlib parameters.
5727      oldlib="$destdir/$name"
5728
5729      $show "$install_prog $file $oldlib"
5730      $run eval "$install_prog \$file \$oldlib" || exit $?
5731
5732      if test -n "$stripme" && test -n "$striplib"; then
5733	$show "$old_striplib $oldlib"
5734	$run eval "$old_striplib $oldlib" || exit $?
5735      fi
5736
5737      # Do each command in the postinstall commands.
5738      eval cmds=\"$old_postinstall_cmds\"
5739      save_ifs="$IFS"; IFS='~'
5740      for cmd in $cmds; do
5741	IFS="$save_ifs"
5742	$show "$cmd"
5743	$run eval "$cmd" || exit $?
5744      done
5745      IFS="$save_ifs"
5746    done
5747
5748    if test -n "$future_libdirs"; then
5749      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
5750    fi
5751
5752    if test -n "$current_libdirs"; then
5753      # Maybe just do a dry run.
5754      test -n "$run" && current_libdirs=" -n$current_libdirs"
5755      exec_cmd='$SHELL $0 --finish$current_libdirs'
5756    else
5757      exit 0
5758    fi
5759    ;;
5760
5761  # libtool finish mode
5762  finish)
5763    modename="$modename: finish"
5764    libdirs="$nonopt"
5765    admincmds=
5766
5767    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
5768      for dir
5769      do
5770	libdirs="$libdirs $dir"
5771      done
5772
5773      for libdir in $libdirs; do
5774	if test -n "$finish_cmds"; then
5775	  # Do each command in the finish commands.
5776	  eval cmds=\"$finish_cmds\"
5777	  save_ifs="$IFS"; IFS='~'
5778	  for cmd in $cmds; do
5779	    IFS="$save_ifs"
5780	    $show "$cmd"
5781	    $run eval "$cmd" || admincmds="$admincmds
5782       $cmd"
5783	  done
5784	  IFS="$save_ifs"
5785	fi
5786	if test -n "$finish_eval"; then
5787	  # Do the single finish_eval.
5788	  eval cmds=\"$finish_eval\"
5789	  $run eval "$cmds" || admincmds="$admincmds
5790       $cmds"
5791	fi
5792      done
5793    fi
5794
5795    # Exit here if they wanted silent mode.
5796    exit 0
5797
5798    $echo "----------------------------------------------------------------------"
5799    $echo "Libraries have been installed in:"
5800    for libdir in $libdirs; do
5801      $echo "   $libdir"
5802    done
5803    $echo
5804    $echo "If you ever happen to want to link against installed libraries"
5805    $echo "in a given directory, LIBDIR, you must either use libtool, and"
5806    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
5807    $echo "flag during linking and do at least one of the following:"
5808    if test -n "$shlibpath_var"; then
5809      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
5810      $echo "     during execution"
5811    fi
5812    if test -n "$runpath_var"; then
5813      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
5814      $echo "     during linking"
5815    fi
5816    if test -n "$hardcode_libdir_flag_spec"; then
5817      libdir=LIBDIR
5818      eval flag=\"$hardcode_libdir_flag_spec\"
5819
5820      $echo "   - use the \`$flag' linker flag"
5821    fi
5822    if test -n "$admincmds"; then
5823      $echo "   - have your system administrator run these commands:$admincmds"
5824    fi
5825    if test -f /etc/ld.so.conf; then
5826      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
5827    fi
5828    $echo
5829    $echo "See any operating system documentation about shared libraries for"
5830    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
5831    $echo "----------------------------------------------------------------------"
5832    exit 0
5833    ;;
5834
5835  # libtool execute mode
5836  execute)
5837    modename="$modename: execute"
5838
5839    # The first argument is the command name.
5840    cmd="$nonopt"
5841    if test -z "$cmd"; then
5842      $echo "$modename: you must specify a COMMAND" 1>&2
5843      $echo "$help"
5844      exit 1
5845    fi
5846
5847    # Handle -dlopen flags immediately.
5848    for file in $execute_dlfiles; do
5849      if test ! -f "$file"; then
5850	$echo "$modename: \`$file' is not a file" 1>&2
5851	$echo "$help" 1>&2
5852	exit 1
5853      fi
5854
5855      dir=
5856      case $file in
5857      *.la)
5858	# Check to see that this really is a libtool archive.
5859	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
5860	else
5861	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
5862	  $echo "$help" 1>&2
5863	  exit 1
5864	fi
5865
5866	# Read the libtool library.
5867	dlname=
5868	library_names=
5869
5870	# If there is no directory component, then add one.
5871	case $file in
5872	*/* | *\\*) . $file ;;
5873	*) . ./$file ;;
5874	esac
5875
5876	# Skip this library if it cannot be dlopened.
5877	if test -z "$dlname"; then
5878	  # Warn if it was a shared library.
5879	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
5880	  continue
5881	fi
5882
5883	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5884	test "X$dir" = "X$file" && dir=.
5885
5886	if test -f "$dir/$objdir/$dlname"; then
5887	  dir="$dir/$objdir"
5888	else
5889	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
5890	  exit 1
5891	fi
5892	;;
5893
5894      *.lo)
5895	# Just add the directory containing the .lo file.
5896	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
5897	test "X$dir" = "X$file" && dir=.
5898	;;
5899
5900      *)
5901	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
5902	continue
5903	;;
5904      esac
5905
5906      # Get the absolute pathname.
5907      absdir=`cd "$dir" && pwd`
5908      test -n "$absdir" && dir="$absdir"
5909
5910      # Now add the directory to shlibpath_var.
5911      if eval "test -z \"\$$shlibpath_var\""; then
5912	eval "$shlibpath_var=\"\$dir\""
5913      else
5914	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
5915      fi
5916    done
5917
5918    # This variable tells wrapper scripts just to set shlibpath_var
5919    # rather than running their programs.
5920    libtool_execute_magic="$magic"
5921
5922    # Check if any of the arguments is a wrapper script.
5923    args=
5924    for file
5925    do
5926      case $file in
5927      -*) ;;
5928      *)
5929	# Do a test to see if this is really a libtool program.
5930	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
5931	  # If there is no directory component, then add one.
5932	  case $file in
5933	  */* | *\\*) . $file ;;
5934	  *) . ./$file ;;
5935	  esac
5936
5937	  # Transform arg to wrapped name.
5938	  file="$progdir/$program"
5939	fi
5940	;;
5941      esac
5942      # Quote arguments (to preserve shell metacharacters).
5943      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
5944      args="$args \"$file\""
5945    done
5946
5947    if test -z "$run"; then
5948      if test -n "$shlibpath_var"; then
5949	# Export the shlibpath_var.
5950	eval "export $shlibpath_var"
5951      fi
5952
5953      # Restore saved environment variables
5954      if test "${save_LC_ALL+set}" = set; then
5955	LC_ALL="$save_LC_ALL"; export LC_ALL
5956      fi
5957      if test "${save_LANG+set}" = set; then
5958	LANG="$save_LANG"; export LANG
5959      fi
5960
5961      # Now prepare to actually exec the command.
5962      exec_cmd="\$cmd$args"
5963    else
5964      # Display what would be done.
5965      if test -n "$shlibpath_var"; then
5966	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
5967	$echo "export $shlibpath_var"
5968      fi
5969      $echo "$cmd$args"
5970      exit 0
5971    fi
5972    ;;
5973
5974  # libtool clean and uninstall mode
5975  clean | uninstall)
5976    modename="$modename: $mode"
5977    rm="$nonopt"
5978    files=
5979    rmforce=
5980    exit_status=0
5981
5982    # This variable tells wrapper scripts just to set variables rather
5983    # than running their programs.
5984    libtool_install_magic="$magic"
5985
5986    for arg
5987    do
5988      case $arg in
5989      -f) rm="$rm $arg"; rmforce=yes ;;
5990      -*) rm="$rm $arg" ;;
5991      *) files="$files $arg" ;;
5992      esac
5993    done
5994
5995    if test -z "$rm"; then
5996      $echo "$modename: you must specify an RM program" 1>&2
5997      $echo "$help" 1>&2
5998      exit 1
5999    fi
6000
6001    rmdirs=
6002
6003    origobjdir="$objdir"
6004    for file in $files; do
6005      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
6006      if test "X$dir" = "X$file"; then
6007	dir=.
6008	objdir="$origobjdir"
6009      else
6010	objdir="$dir/$origobjdir"
6011      fi
6012      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
6013      test "$mode" = uninstall && objdir="$dir"
6014
6015      # Remember objdir for removal later, being careful to avoid duplicates
6016      if test "$mode" = clean; then
6017	case " $rmdirs " in
6018	  *" $objdir "*) ;;
6019	  *) rmdirs="$rmdirs $objdir" ;;
6020	esac
6021      fi
6022
6023      # Don't error if the file doesn't exist and rm -f was used.
6024      if (test -L "$file") >/dev/null 2>&1 \
6025	|| (test -h "$file") >/dev/null 2>&1 \
6026	|| test -f "$file"; then
6027	:
6028      elif test -d "$file"; then
6029	exit_status=1
6030	continue
6031      elif test "$rmforce" = yes; then
6032	continue
6033      fi
6034
6035      rmfiles="$file"
6036
6037      case $name in
6038      *.la)
6039	# Possibly a libtool archive, so verify it.
6040	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6041	  . $dir/$name
6042
6043	  # Delete the libtool libraries and symlinks.
6044	  for n in $library_names; do
6045	    rmfiles="$rmfiles $objdir/$n"
6046	  done
6047	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
6048	  test "$mode" = clean && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6049
6050	  if test "$mode" = uninstall; then
6051	    if test -n "$library_names"; then
6052	      # Do each command in the postuninstall commands.
6053	      eval cmds=\"$postuninstall_cmds\"
6054	      save_ifs="$IFS"; IFS='~'
6055	      for cmd in $cmds; do
6056		IFS="$save_ifs"
6057		$show "$cmd"
6058		$run eval "$cmd"
6059		if test "$?" -ne 0 && test "$rmforce" != yes; then
6060		  exit_status=1
6061		fi
6062	      done
6063	      IFS="$save_ifs"
6064	    fi
6065
6066	    if test -n "$old_library"; then
6067	      # Do each command in the old_postuninstall commands.
6068	      eval cmds=\"$old_postuninstall_cmds\"
6069	      save_ifs="$IFS"; IFS='~'
6070	      for cmd in $cmds; do
6071		IFS="$save_ifs"
6072		$show "$cmd"
6073		$run eval "$cmd"
6074		if test "$?" -ne 0 && test "$rmforce" != yes; then
6075		  exit_status=1
6076		fi
6077	      done
6078	      IFS="$save_ifs"
6079	    fi
6080	    # FIXME: should reinstall the best remaining shared library.
6081	  fi
6082	fi
6083	;;
6084
6085      *.lo)
6086	# Possibly a libtool object, so verify it.
6087	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6088
6089	  # Read the .lo file
6090	  . $dir/$name
6091
6092	  # Add PIC object to the list of files to remove.
6093	  if test -n "$pic_object" \
6094	     && test "$pic_object" != none; then
6095	    rmfiles="$rmfiles $dir/$pic_object"
6096	  fi
6097
6098	  # Add non-PIC object to the list of files to remove.
6099	  if test -n "$non_pic_object" \
6100	     && test "$non_pic_object" != none; then
6101	    rmfiles="$rmfiles $dir/$non_pic_object"
6102	  fi
6103	fi
6104	;;
6105
6106      *)
6107	if test "$mode" = clean ; then
6108	  noexename=$name
6109	  case $file in
6110	  *.exe)
6111	    file=`$echo $file|${SED} 's,.exe$,,'`
6112	    noexename=`$echo $name|${SED} 's,.exe$,,'`
6113	    # $file with .exe has already been added to rmfiles,
6114	    # add $file without .exe
6115	    rmfiles="$rmfiles $file"
6116	    ;;
6117	  esac
6118	  # Do a test to see if this is a libtool program.
6119	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
6120	    relink_command=
6121	    . $dir/$noexename
6122
6123	    # note $name still contains .exe if it was in $file originally
6124	    # as does the version of $file that was added into $rmfiles
6125	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
6126	    if test "$fast_install" = yes && test -n "$relink_command"; then
6127	      rmfiles="$rmfiles $objdir/lt-$name"
6128	    fi
6129	    if test "X$noexename" != "X$name" ; then
6130	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
6131	    fi
6132	  fi
6133	fi
6134	;;
6135      esac
6136      $show "$rm $rmfiles"
6137      $run $rm $rmfiles || exit_status=1
6138    done
6139    objdir="$origobjdir"
6140
6141    # Try to remove the ${objdir}s in the directories where we deleted files
6142    for dir in $rmdirs; do
6143      if test -d "$dir"; then
6144	$show "rmdir $dir"
6145	$run rmdir $dir >/dev/null 2>&1
6146      fi
6147    done
6148
6149    exit $exit_status
6150    ;;
6151
6152  "")
6153    $echo "$modename: you must specify a MODE" 1>&2
6154    $echo "$generic_help" 1>&2
6155    exit 1
6156    ;;
6157  esac
6158
6159  if test -z "$exec_cmd"; then
6160    $echo "$modename: invalid operation mode \`$mode'" 1>&2
6161    $echo "$generic_help" 1>&2
6162    exit 1
6163  fi
6164fi # test -z "$show_help"
6165
6166if test -n "$exec_cmd"; then
6167  eval exec $exec_cmd
6168  exit 1
6169fi
6170
6171# We need to display help for each of the modes.
6172case $mode in
6173"") $echo \
6174"Usage: $modename [OPTION]... [MODE-ARG]...
6175
6176Provide generalized library-building support services.
6177
6178    --config          show all configuration variables
6179    --debug           enable verbose shell tracing
6180-n, --dry-run         display commands without modifying any files
6181    --features        display basic configuration information and exit
6182    --finish          same as \`--mode=finish'
6183    --help            display this help message and exit
6184    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
6185    --quiet           same as \`--silent'
6186    --silent          don't print informational messages
6187    --tag=TAG         use configuration variables from tag TAG
6188    --version         print version information
6189
6190MODE must be one of the following:
6191
6192      clean           remove files from the build directory
6193      compile         compile a source file into a libtool object
6194      execute         automatically set library path, then run a program
6195      finish          complete the installation of libtool libraries
6196      install         install libraries or executables
6197      link            create a library or an executable
6198      uninstall       remove libraries from an installed directory
6199
6200MODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
6201a more detailed description of MODE.
6202
6203Report bugs to <bug-libtool@gnu.org>."
6204  exit 0
6205  ;;
6206
6207clean)
6208  $echo \
6209"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
6210
6211Remove files from the build directory.
6212
6213RM is the name of the program to use to delete files associated with each FILE
6214(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6215to RM.
6216
6217If FILE is a libtool library, object or program, all the files associated
6218with it are deleted. Otherwise, only FILE itself is deleted using RM."
6219  ;;
6220
6221compile)
6222  $echo \
6223"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
6224
6225Compile a source file into a libtool library object.
6226
6227This mode accepts the following additional options:
6228
6229  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
6230  -prefer-pic       try to building PIC objects only
6231  -prefer-non-pic   try to building non-PIC objects only
6232  -static           always build a \`.o' file suitable for static linking
6233
6234COMPILE-COMMAND is a command to be used in creating a \`standard' object file
6235from the given SOURCEFILE.
6236
6237The output file name is determined by removing the directory component from
6238SOURCEFILE, then substituting the C source code suffix \`.c' with the
6239library object suffix, \`.lo'."
6240  ;;
6241
6242execute)
6243  $echo \
6244"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
6245
6246Automatically set library path, then run a program.
6247
6248This mode accepts the following additional options:
6249
6250  -dlopen FILE      add the directory containing FILE to the library path
6251
6252This mode sets the library path environment variable according to \`-dlopen'
6253flags.
6254
6255If any of the ARGS are libtool executable wrappers, then they are translated
6256into their corresponding uninstalled binary, and any of their required library
6257directories are added to the library path.
6258
6259Then, COMMAND is executed, with ARGS as arguments."
6260  ;;
6261
6262finish)
6263  $echo \
6264"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
6265
6266Complete the installation of libtool libraries.
6267
6268Each LIBDIR is a directory that contains libtool libraries.
6269
6270The commands that this mode executes may require superuser privileges.  Use
6271the \`--dry-run' option if you just want to see what would be executed."
6272  ;;
6273
6274install)
6275  $echo \
6276"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
6277
6278Install executables or libraries.
6279
6280INSTALL-COMMAND is the installation command.  The first component should be
6281either the \`install' or \`cp' program.
6282
6283The rest of the components are interpreted as arguments to that command (only
6284BSD-compatible install options are recognized)."
6285  ;;
6286
6287link)
6288  $echo \
6289"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
6290
6291Link object files or libraries together to form another library, or to
6292create an executable program.
6293
6294LINK-COMMAND is a command using the C compiler that you would use to create
6295a program from several object files.
6296
6297The following components of LINK-COMMAND are treated specially:
6298
6299  -all-static       do not do any dynamic linking at all
6300  -avoid-version    do not add a version suffix if possible
6301  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
6302  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
6303  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
6304  -export-symbols SYMFILE
6305		    try to export only the symbols listed in SYMFILE
6306  -export-symbols-regex REGEX
6307		    try to export only the symbols matching REGEX
6308  -LLIBDIR          search LIBDIR for required installed libraries
6309  -lNAME            OUTPUT-FILE requires the installed library libNAME
6310  -module           build a library that can dlopened
6311  -no-fast-install  disable the fast-install mode
6312  -no-install       link a not-installable executable
6313  -no-undefined     declare that a library does not refer to external symbols
6314  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
6315  -objectlist FILE  Use a list of object files found in FILE to specify objects
6316  -release RELEASE  specify package release information
6317  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
6318  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
6319  -static           do not do any dynamic linking of libtool libraries
6320  -version-info CURRENT[:REVISION[:AGE]]
6321		    specify library version info [each variable defaults to 0]
6322
6323All other options (arguments beginning with \`-') are ignored.
6324
6325Every other argument is treated as a filename.  Files ending in \`.la' are
6326treated as uninstalled libtool libraries, other files are standard or library
6327object files.
6328
6329If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
6330only library objects (\`.lo' files) may be specified, and \`-rpath' is
6331required, except when creating a convenience library.
6332
6333If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
6334using \`ar' and \`ranlib', or on Windows using \`lib'.
6335
6336If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
6337is created, otherwise an executable program is created."
6338  ;;
6339
6340uninstall)
6341  $echo \
6342"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
6343
6344Remove libraries from an installation directory.
6345
6346RM is the name of the program to use to delete files associated with each FILE
6347(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
6348to RM.
6349
6350If FILE is a libtool library, all the files associated with it are deleted.
6351Otherwise, only FILE itself is deleted using RM."
6352  ;;
6353
6354*)
6355  $echo "$modename: invalid operation mode \`$mode'" 1>&2
6356  $echo "$help" 1>&2
6357  exit 1
6358  ;;
6359esac
6360
6361$echo
6362$echo "Try \`$modename --help' for more information about other modes."
6363
6364exit 0
6365
6366# The TAGs below are defined such that we never get into a situation
6367# in which we disable both kinds of libraries.  Given conflicting
6368# choices, we go for a static library, that is the most portable,
6369# since we can't tell whether shared libraries were disabled because
6370# the user asked for that or because the platform doesn't support
6371# them.  This is particularly important on AIX, because we don't
6372# support having both static and shared libraries enabled at the same
6373# time on that platform, so we default to a shared-only configuration.
6374# If a disable-shared tag is given, we'll fallback to a static-only
6375# configuration.  But we'll never go from static-only to shared-only.
6376
6377# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6378build_libtool_libs=no
6379build_old_libs=yes
6380# ### END LIBTOOL TAG CONFIG: disable-shared
6381
6382# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6383build_old_libs=`case $build_libtool_libs in yes) $echo no;; *) $echo yes;; esac`
6384# ### END LIBTOOL TAG CONFIG: disable-static
6385
6386# Local Variables:
6387# mode:shell-script
6388# sh-indentation:2
6389# End:
6390