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