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