Error Buddy

Do you have an error message from your application? Then find the answer with Error Buddy. You can search over 40000 source code files and troubleshooting documents using our beta lucene/nutch search interface or if you prefer, search as normal using google. With LXR technology you can drill right down into the line of source code where it came from with full cross-referencing.

If after searching you didn't get your ideal answer, or you are still unclear what the error means, you can choose to post that question to the community forums following the link included in the search results.

corestack/ libtool-1.5.14/ ltmain.in [1.6]
001 # ltmain.sh - Provide generalized library-building support services.
002 # NOTE: Changing this file will not affect anything until you rerun configure.
003 #
004 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
005 # Free Software Foundation, Inc.
006 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
007 #
008 # This program is free software; you can redistribute it and/or modify
009 # it under the terms of the GNU General Public License as published by
010 # the Free Software Foundation; either version 2 of the License, or
011 # (at your option) any later version.
012 #
013 # This program is distributed in the hope that it will be useful, but
014 # WITHOUT ANY WARRANTY; without even the implied warranty of
015 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
016 # General Public License for more details.
017 #
018 # You should have received a copy of the GNU General Public License
019 # along with this program; if not, write to the Free Software
020 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
021 #
022 # As a special exception to the GNU General Public License, if you
023 # distribute this file as part of a program that contains a
024 # configuration script generated by Autoconf, you may include it under
025 # the same distribution terms that you use for the rest of that program.
026 
027 basename="s,^.*/,,g"
028 
029 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
030 # is ksh but when the shell is invoked as "sh" and the current value of
031 # the _XPG environment variable is not equal to 1 (one), the special
032 # positional parameter $0, within a function call, is the name of the
033 # function.
034 progpath="$0"
035 
036 # The name of this program:
037 progname=`echo "$progpath" | $SED $basename`
038 modename="$progname"
039 
040 # Global variables:
041 EXIT_SUCCESS=0
042 EXIT_FAILURE=1
043 
044 PROGRAM=ltmain.sh
045 PACKAGE=@PACKAGE@
046 VERSION=@VERSION@
047 TIMESTAMP="@TIMESTAMP@"
048 
049 # See if we are running on zsh, and set the options which allow our
050 # commands through without removal of \ escapes.
051 if test -n "${ZSH_VERSION+set}" ; then
052   setopt NO_GLOB_SUBST
053 fi
054 
055 # Check that we have a working $echo.
056 if test "X$1" = X--no-reexec; then
057   # Discard the --no-reexec flag, and continue.
058   shift
059 elif test "X$1" = X--fallback-echo; then
060   # Avoid inline document here, it may be left over
061   :
062 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
063   # Yippee, $echo works!
064   :
065 else
066   # Restart under the correct shell, and then maybe $echo will work.
067   exec $SHELL "$progpath" --no-reexec ${1+"$@"}
068 fi
069 
070 if test "X$1" = X--fallback-echo; then
071   # used as fallback echo
072   shift
073   cat <<EOF
074 $*
075 EOF
076   exit $EXIT_SUCCESS
077 fi
078 
079 default_mode=
080 help="Try \`$progname --help' for more information."
081 magic="%%%MAGIC variable%%%"
082 mkdir="mkdir"
083 mv="mv -f"
084 rm="rm -f"
085 
086 # Sed substitution that helps us do robust quoting.  It backslashifies
087 # metacharacters that are still active within double-quoted strings.
088 Xsed="${SED}"' -e 1s/^X//'
089 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
090 # test EBCDIC or ASCII
091 case `echo A|tr A '\301'` in
092  A) # EBCDIC based system
093   SP2NL="tr '\100' '\n'"
094   NL2SP="tr '\r\n' '\100\100'"
095   ;;
096  *) # Assume ASCII based system
097   SP2NL="tr '\040' '\012'"
098   NL2SP="tr '\015\012' '\040\040'"
099   ;;
100 esac
101 
102 # NLS nuisances.
103 # Only set LANG and LC_ALL to C if already set.
104 # These must not be set unconditionally because not all systems understand
105 # e.g. LANG=C (notably SCO).
106 # We save the old values to restore during execute mode.
107 if test "${LC_ALL+set}" = set; then
108   save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
109 fi
110 if test "${LANG+set}" = set; then
111   save_LANG="$LANG"; LANG=C; export LANG
112 fi
113 
114 # Make sure IFS has a sensible default
115 : ${IFS="       
116 "}
117 
118 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
119   $echo "$modename: not configured to build any kind of library" 1>&2
120   $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
121   exit $EXIT_FAILURE
122 fi
123 
124 # Global variables.
125 mode=$default_mode
126 nonopt=
127 prev=
128 prevopt=
129 run=
130 show="$echo"
131 show_help=
132 execute_dlfiles=
133 lo2o="s/\\.lo\$/.${objext}/"
134 o2lo="s/\\.${objext}\$/.lo/"
135 quote_scanset='[[~#^*{};<>?'"'"'        ]'
136 
137 #####################################
138 # Shell function definitions:
139 # This seems to be the best place for them
140 
141 # func_win32_libid arg
142 # return the library type of file 'arg'
143 #
144 # Need a lot of goo to handle *both* DLLs and import libs
145 # Has to be a shell function in order to 'eat' the argument
146 # that is supplied when $file_magic_command is called.
147 func_win32_libid ()
148 {
149   win32_libid_type="unknown"
150   win32_fileres=`file -L $1 2>/dev/null`
151   case $win32_fileres in
152   *ar\ archive\ import\ library*) # definitely import
153     win32_libid_type="x86 archive import"
154     ;;
155   *ar\ archive*) # could be an import, or static
156     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
157       $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
158       win32_nmres=`eval $NM -f posix -A $1 | \
159         sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
160       if test "X$win32_nmres" = "Ximport" ; then
161         win32_libid_type="x86 archive import"
162       else
163         win32_libid_type="x86 archive static"
164       fi
165     fi
166     ;;
167   *DLL*)
168     win32_libid_type="x86 DLL"
169     ;;
170   *executable*) # but shell scripts are "executable" too...
171     case $win32_fileres in
172     *MS\ Windows\ PE\ Intel*)
173       win32_libid_type="x86 DLL"
174       ;;
175     esac
176     ;;
177   esac
178   $echo $win32_libid_type
179 }
180 
181 
182 # func_infer_tag arg
183 # Infer tagged configuration to use if any are available and
184 # if one wasn't chosen via the "--tag" command line option.
185 # Only attempt this if the compiler in the base compile
186 # command doesn't match the default compiler.
187 # arg is usually of the form 'gcc ...'
188 func_infer_tag ()
189 {
190     if test -n "$available_tags" && test -z "$tagname"; then
191       CC_quoted=
192       for arg in $CC; do
193         case $arg in
194           *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
195           arg="\"$arg\""
196           ;;
197         esac
198         CC_quoted="$CC_quoted $arg"
199       done
200       case $@ in
201       # Blanks in the command may have been stripped by the calling shell,
202       # but not from the CC environment variable when configure was run.
203       " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
204       # Blanks at the start of $base_compile will cause this to fail
205       # if we don't check for them as well.
206       *)
207         for z in $available_tags; do
208           if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
209             # Evaluate the configuration.
210             eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
211             CC_quoted=
212             for arg in $CC; do
213             # Double-quote args containing other shell metacharacters.
214             case $arg in
215               *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
216               arg="\"$arg\""
217               ;;
218             esac
219             CC_quoted="$CC_quoted $arg"
220           done
221             case "$@ " in
222               " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
223               # The compiler in the base compile command matches
224               # the one in the tagged configuration.
225               # Assume this is the tagged configuration we want.
226               tagname=$z
227               break
228               ;;
229             esac
230           fi
231         done
232         # If $tagname still isn't set, then no tagged configuration
233         # was found and let the user know that the "--tag" command
234         # line option must be used.
235         if test -z "$tagname"; then
236           $echo "$modename: unable to infer tagged configuration"
237           $echo "$modename: specify a tag with \`--tag'" 1>&2
238           exit $EXIT_FAILURE
239 #        else
240 #          $echo "$modename: using $tagname tagged configuration"
241         fi
242         ;;
243       esac
244     fi
245 }
246 
247 
248 # func_extract_an_archive dir oldlib
249 func_extract_an_archive ()
250 {
251     f_ex_an_ar_dir="$1"; shift
252     f_ex_an_ar_oldlib="$1"
253     f_ex_an_ar_lib=`$echo "X$f_ex_an_ar_oldlib" | $Xsed -e 's%^.*/%%'`
254 
255     $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
256     $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
257     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
258      :
259     else
260       $echo "$modename: warning: object name conflicts; renaming object files" 1>&2
261       $echo "$modename: warning: to ensure that they will not overwrite" 1>&2
262       $show "cp $f_ex_an_ar_oldlib $f_ex_an_ar_dir/$f_ex_an_ar_lib"
263       $run eval "cp \$f_ex_an_ar_oldlib \$f_ex_an_ar_dir/\$f_ex_an_ar_lib"
264       $AR t "$f_ex_an_ar_oldlib" | sort | uniq -c \
265         | $EGREP -v '^[         ]*1[    ]' | while read count name
266       do
267         i=1
268         while test "$i" -le "$count"
269           do
270           # Put our $i before any first dot (extension)
271           # Never overwrite any file
272           name_to="$name"
273           while test "X$name_to" = "X$name" || test -f "$f_ex_an_ar_dir/$name_to"
274             do
275             name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"`
276           done
277           $show "(cd $f_ex_an_ar_dir && $AR x  $f_ex_an_ar_lib '$name' && $mv '$name' '$name_to')"
278           $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_lib '$name' && $mv '$name' '$name_to' && $AR -d \$f_ex_an_ar_lib '$name')" || exit $?
279           i=`expr $i + 1`
280         done
281       done
282       $show "$rm $f_ex_an_ar_dir/$f_ex_an_ar_lib"
283       $run eval "$rm \$f_ex_an_ar_dir/\$f_ex_an_ar_lib"
284     fi
285 }
286 
287 # func_extract_archives gentop oldlib ...
288 func_extract_archives ()
289 {
290     my_gentop="$1"; shift
291     my_oldlibs=${1+"$@"}
292     my_oldobjs=""
293     my_xlib=""
294     my_xabs=""
295     my_xdir=""
296     my_status=""
297 
298     $show "${rm}r $my_gentop"
299     $run ${rm}r "$my_gentop"
300     $show "$mkdir $my_gentop"
301     $run $mkdir "$my_gentop"
302     my_status=$?
303     if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
304       exit $my_status
305     fi
306 
307     for my_xlib in $my_oldlibs; do
308       # Extract the objects.
309       case $my_xlib in
310         [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
311         *) my_xabs=`pwd`"/$my_xlib" ;;
312       esac
313       my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
314       my_xdir="$my_gentop/$my_xlib"
315 
316       $show "${rm}r $my_xdir"
317       $run ${rm}r "$my_xdir"
318       $show "$mkdir $my_xdir"
319       $run $mkdir "$my_xdir"
320       status=$?
321       if test "$status" -ne 0 && test ! -d "$my_xdir"; then
322         exit $status
323       fi
324       case $host in
325       *-darwin*)
326         $show "Extracting $my_xabs"
327         # Do not bother doing anything if just a dry run
328         if test -z "$run"; then
329           darwin_orig_dir=`pwd`
330           cd $my_xdir || exit $?
331           darwin_archive=$my_xabs
332           darwin_curdir=`pwd`
333           darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
334           darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
335           if test -n "$darwin_arches"; then 
336             darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
337             darwin_arch=
338             $show "$darwin_base_archive has multiple architectures $darwin_arches"
339             for darwin_arch in  $darwin_arches ; do
340               mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
341               lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
342               cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
343               func_extract_an_archive "`pwd`" "${darwin_base_archive}"
344               cd "$darwin_curdir"
345               $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
346             done # $darwin_arches
347       ## Okay now we have a bunch of thin objects, gotta fatten them up :)
348             darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
349             darwin_file=
350             darwin_files=
351             for darwin_file in $darwin_filelist; do
352               darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
353               lipo -create -output "$darwin_file" $darwin_files
354             done # $darwin_filelist
355             ${rm}r unfat-$$
356             cd "$darwin_orig_dir"
357           else
358             cd "$darwin_orig_dir"
359             func_extract_an_archive "$my_xdir" "$my_xabs"
360           fi # $darwin_arches
361         fi # $run
362       ;;
363       *)
364         func_extract_an_archive "$my_xdir" "$my_xabs"
365         ;;
366       esac
367       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
368     done
369     func_extract_archives_result="$my_oldobjs"
370 }
371 # End of Shell function definitions
372 #####################################
373 
374 # Darwin sucks
375 eval std_shrext=\"$shrext_cmds\"
376 
377 # Parse our command line options once, thoroughly.
378 while test "$#" -gt 0
379 do
380   arg="$1"
381   shift
382 
383   case $arg in
384   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
385   *) optarg= ;;
386   esac
387 
388   # If the previous option needs an argument, assign it.
389   if test -n "$prev"; then
390     case $prev in
391     execute_dlfiles)
392       execute_dlfiles="$execute_dlfiles $arg"
393       ;;
394     tag)
395       tagname="$arg"
396       preserve_args="${preserve_args}=$arg"
397 
398       # Check whether tagname contains only valid characters
399       case $tagname in
400       *[!-_A-Za-z0-9,/]*)
401         $echo "$progname: invalid tag name: $tagname" 1>&2
402         exit $EXIT_FAILURE
403         ;;
404       esac
405 
406       case $tagname in
407       CC)
408         # Don't test for the "default" C tag, as we know, it's there, but
409         # not specially marked.
410         ;;
411       *)
412         if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
413           taglist="$taglist $tagname"
414           # Evaluate the configuration.
415           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
416         else
417           $echo "$progname: ignoring unknown tag $tagname" 1>&2
418         fi
419         ;;
420       esac
421       ;;
422     *)
423       eval "$prev=\$arg"
424       ;;
425     esac
426 
427     prev=
428     prevopt=
429     continue
430   fi
431 
432   # Have we seen a non-optional argument yet?
433   case $arg in
434   --help)
435     show_help=yes
436     ;;
437 
438   --version)
439     $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
440     $echo
441     $echo "Copyright (C) 2005  Free Software Foundation, Inc."
442     $echo "This is free software; see the source for copying conditions.  There is NO"
443     $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
444     exit $?
445     ;;
446 
447   --config)
448     ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
449     # Now print the configurations for the tags.
450     for tagname in $taglist; do
451       ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
452     done
453     exit $?
454     ;;
455 
456   --debug)
457     $echo "$progname: enabling shell trace mode"
458     set -x
459     preserve_args="$preserve_args $arg"
460     ;;
461 
462   --dry-run | -n)
463     run=:
464     ;;
465 
466   --features)
467     $echo "host: $host"
468     if test "$build_libtool_libs" = yes; then
469       $echo "enable shared libraries"
470     else
471       $echo "disable shared libraries"
472     fi
473     if test "$build_old_libs" = yes; then
474       $echo "enable static libraries"
475     else
476       $echo "disable static libraries"
477     fi
478     exit $?
479     ;;
480 
481   --finish) mode="finish" ;;
482 
483   --mode) prevopt="--mode" prev=mode ;;
484   --mode=*) mode="$optarg" ;;
485 
486   --preserve-dup-deps) duplicate_deps="yes" ;;
487 
488   --quiet | --silent)
489     show=:
490     preserve_args="$preserve_args $arg"
491     ;;
492 
493   --tag) prevopt="--tag" prev=tag ;;
494   --tag=*)
495     set tag "$optarg" ${1+"$@"}
496     shift
497     prev=tag
498     preserve_args="$preserve_args --tag"
499     ;;
500 
501   -dlopen)
502     prevopt="-dlopen"
503     prev=execute_dlfiles
504     ;;
505 
506   -*)
507     $echo "$modename: unrecognized option \`$arg'" 1>&2
508     $echo "$help" 1>&2
509     exit $EXIT_FAILURE
510     ;;
511 
512   *)
513     nonopt="$arg"
514     break
515     ;;
516   esac
517 done
518 
519 if test -n "$prevopt"; then
520   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
521   $echo "$help" 1>&2
522   exit $EXIT_FAILURE
523 fi
524 
525 # If this variable is set in any of the actions, the command in it
526 # will be execed at the end.  This prevents here-documents from being
527 # left over by shells.
528 exec_cmd=
529 
530 if test -z "$show_help"; then
531 
532   # Infer the operation mode.
533   if test -z "$mode"; then
534     $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
535     $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
536     case $nonopt in
537     *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
538       mode=link
539       for arg
540       do
541         case $arg in
542         -c)
543            mode=compile
544            break
545            ;;
546         esac
547       done
548       ;;
549     *db | *dbx | *strace | *truss)
550       mode=execute
551       ;;
552     *install*|cp|mv)
553       mode=install
554       ;;
555     *rm)
556       mode=uninstall
557       ;;
558     *)
559       # If we have no mode, but dlfiles were specified, then do execute mode.
560       test -n "$execute_dlfiles" && mode=execute
561 
562       # Just use the default operation mode.
563       if test -z "$mode"; then
564         if test -n "$nonopt"; then
565           $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
566         else
567           $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
568         fi
569       fi
570       ;;
571     esac
572   fi
573 
574   # Only execute mode is allowed to have -dlopen flags.
575   if test -n "$execute_dlfiles" && test "$mode" != execute; then
576     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
577     $echo "$help" 1>&2
578     exit $EXIT_FAILURE
579   fi
580 
581   # Change the help message to a mode-specific one.
582   generic_help="$help"
583   help="Try \`$modename --help --mode=$mode' for more information."
584 
585   # These modes are in order of execution frequency so that they run quickly.
586   case $mode in
587   # libtool compile mode
588   compile)
589     modename="$modename: compile"
590     # Get the compilation command and the source file.
591     base_compile=
592     srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
593     suppress_opt=yes
594     suppress_output=
595     arg_mode=normal
596     libobj=
597     later=
598 
599     for arg
600     do
601       case "$arg_mode" in
602       arg  )
603         # do not "continue".  Instead, add this to base_compile
604         lastarg="$arg"
605         arg_mode=normal
606         ;;
607 
608       target )
609         libobj="$arg"
610         arg_mode=normal
611         continue
612         ;;
613 
614       normal )
615         # Accept any command-line options.
616         case $arg in
617         -o)
618           if test -n "$libobj" ; then
619             $echo "$modename: you cannot specify \`-o' more than once" 1>&2
620             exit $EXIT_FAILURE
621           fi
622           arg_mode=target
623           continue
624           ;;
625 
626         -static | -prefer-pic | -prefer-non-pic)
627           later="$later $arg"
628           continue
629           ;;
630 
631         -no-suppress)
632           suppress_opt=no
633           continue
634           ;;
635 
636         -Xcompiler)
637           arg_mode=arg  #  the next one goes into the "base_compile" arg list
638           continue      #  The current "srcfile" will either be retained or
639           ;;            #  replaced later.  I would guess that would be a bug.
640 
641         -Wc,*)
642           args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
643           lastarg=
644           save_ifs="$IFS"; IFS=','
645           for arg in $args; do
646             IFS="$save_ifs"
647 
648             # Double-quote args containing other shell metacharacters.
649             # Many Bourne shells cannot handle close brackets correctly
650             # in scan sets, so we specify it separately.
651             case $arg in
652               *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
653               arg="\"$arg\""
654               ;;
655             esac
656             lastarg="$lastarg $arg"
657           done
658           IFS="$save_ifs"
659           lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
660 
661           # Add the arguments to base_compile.
662           base_compile="$base_compile $lastarg"
663           continue
664           ;;
665 
666         * )
667           # Accept the current argument as the source file.
668           # The previous "srcfile" becomes the current argument.
669           #
670           lastarg="$srcfile"
671           srcfile="$arg"
672           ;;
673         esac  #  case $arg
674         ;;
675       esac    #  case $arg_mode
676 
677       # Aesthetically quote the previous argument.
678       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
679 
680       case $lastarg in
681       # Double-quote args containing other shell metacharacters.
682       # Many Bourne shells cannot handle close brackets correctly
683       # in scan sets, and some SunOS ksh mistreat backslash-escaping
684       # in scan sets (worked around with variable expansion),
685       # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
686       # at all, so we specify them separately.
687       *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
688         lastarg="\"$lastarg\""
689         ;;
690       esac
691 
692       base_compile="$base_compile $lastarg"
693     done # for arg
694 
695     case $arg_mode in
696     arg)
697       $echo "$modename: you must specify an argument for -Xcompile"
698       exit $EXIT_FAILURE
699       ;;
700     target)
701       $echo "$modename: you must specify a target with \`-o'" 1>&2
702       exit $EXIT_FAILURE
703       ;;
704     *)
705       # Get the name of the library object.
706       [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
707       ;;
708     esac
709 
710     # Recognize several different file suffixes.
711     # If the user specifies -o file.o, it is replaced with file.lo
712     xform='[cCFSifmso]'
713     case $libobj in
714     *.ada) xform=ada ;;
715     *.adb) xform=adb ;;
716     *.ads) xform=ads ;;
717     *.asm) xform=asm ;;
718     *.c++) xform=c++ ;;
719     *.cc) xform=cc ;;
720     *.ii) xform=ii ;;
721     *.class) xform=class ;;
722     *.cpp) xform=cpp ;;
723     *.cxx) xform=cxx ;;
724     *.f90) xform=f90 ;;
725     *.for) xform=for ;;
726     *.java) xform=java ;;
727     esac
728 
729     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
730 
731     case $libobj in
732     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
733     *)
734       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
735       exit $EXIT_FAILURE
736       ;;
737     esac
738 
739     func_infer_tag $base_compile
740 
741     for arg in $later; do
742       case $arg in
743       -static)
744         build_old_libs=yes
745         continue
746         ;;
747 
748       -prefer-pic)
749         pic_mode=yes
750         continue
751         ;;
752 
753       -prefer-non-pic)
754         pic_mode=no
755         continue
756         ;;
757       esac
758     done
759 
760     objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
761     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
762     if test "X$xdir" = "X$obj"; then
763       xdir=
764     else
765       xdir=$xdir/
766     fi
767     lobj=${xdir}$objdir/$objname
768 
769     if test -z "$base_compile"; then
770       $echo "$modename: you must specify a compilation command" 1>&2
771       $echo "$help" 1>&2
772       exit $EXIT_FAILURE
773     fi
774 
775     # Delete any leftover library objects.
776     if test "$build_old_libs" = yes; then
777       removelist="$obj $lobj $libobj ${libobj}T"
778     else
779       removelist="$lobj $libobj ${libobj}T"
780     fi
781 
782     $run $rm $removelist
783     trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
784 
785     # On Cygwin there's no "real" PIC flag so we must build both object types
786     case $host_os in
787     cygwin* | mingw* | pw32* | os2*)
788       pic_mode=default
789       ;;
790     esac
791     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
792       # non-PIC code in shared libraries is not supported
793       pic_mode=default
794     fi
795 
796     # Calculate the filename of the output object if compiler does
797     # not support -o with -c
798     if test "$compiler_c_o" = no; then
799       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
800       lockfile="$output_obj.lock"
801       removelist="$removelist $output_obj $lockfile"
802       trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
803     else
804       output_obj=
805       need_locks=no
806       lockfile=
807     fi
808 
809     # Lock this critical section if it is needed
810     # We use this script file to make the link, it avoids creating a new file
811     if test "$need_locks" = yes; then
812       until $run ln "$progpath" "$lockfile" 2>/dev/null; do
813         $show "Waiting for $lockfile to be removed"
814         sleep 2
815       done
816     elif test "$need_locks" = warn; then
817       if test -f "$lockfile"; then
818         $echo "\
819 *** ERROR, $lockfile exists and contains:
820 `cat $lockfile 2>/dev/null`
821 
822 This indicates that another process is trying to use the same
823 temporary object file, and libtool could not work around it because
824 your compiler does not support \`-c' and \`-o' together.  If you
825 repeat this compilation, it may succeed, by chance, but you had better
826 avoid parallel builds (make -j) in this platform, or get a better
827 compiler."
828 
829         $run $rm $removelist
830         exit $EXIT_FAILURE
831       fi
832       $echo $srcfile > "$lockfile"
833     fi
834 
835     if test -n "$fix_srcfile_path"; then
836       eval srcfile=\"$fix_srcfile_path\"
837     fi
838 
839     $run $rm "$libobj" "${libobj}T"
840 
841     # Create a libtool object file (analogous to a ".la" file),
842     # but don't create it if we're doing a dry run.
843     test -z "$run" && cat > ${libobj}T <<EOF
844 # $libobj - a libtool object file
845 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
846 #
847 # Please DO NOT delete this file!
848 # It is necessary for linking the library.
849 
850 # Name of the PIC object.
851 EOF
852 
853     # Only build a PIC object if we are building libtool libraries.
854     if test "$build_libtool_libs" = yes; then
855       # Without this assignment, base_compile gets emptied.
856       fbsd_hideous_sh_bug=$base_compile
857 
858       if test "$pic_mode" != no; then
859         command="$base_compile $srcfile $pic_flag"
860       else
861         # Don't build PIC code
862         command="$base_compile $srcfile"
863       fi
864 
865       if test ! -d "${xdir}$objdir"; then
866         $show "$mkdir ${xdir}$objdir"
867         $run $mkdir ${xdir}$objdir
868         status=$?
869         if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
870           exit $status
871         fi
872       fi
873 
874       if test -z "$output_obj"; then
875         # Place PIC objects in $objdir
876         command="$command -o $lobj"
877       fi
878 
879       $run $rm "$lobj" "$output_obj"
880 
881       $show "$command"
882       if $run eval "$command"; then :
883       else
884         test -n "$output_obj" && $run $rm $removelist
885         exit $EXIT_FAILURE
886       fi
887 
888       if test "$need_locks" = warn &&
889          test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
890         $echo "\
891 *** ERROR, $lockfile contains:
892 `cat $lockfile 2>/dev/null`
893 
894 but it should contain:
895 $srcfile
896 
897 This indicates that another process is trying to use the same
898 temporary object file, and libtool could not work around it because
899 your compiler does not support \`-c' and \`-o' together.  If you
900 repeat this compilation, it may succeed, by chance, but you had better
901 avoid parallel builds (make -j) in this platform, or get a better
902 compiler."
903 
904         $run $rm $removelist
905         exit $EXIT_FAILURE
906       fi
907 
908       # Just move the object if needed, then go on to compile the next one
909       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
910         $show "$mv $output_obj $lobj"
911         if $run $mv $output_obj $lobj; then :
912         else
913           error=$?
914           $run $rm $removelist
915           exit $error
916         fi
917       fi
918 
919       # Append the name of the PIC object to the libtool object file.
920       test -z "$run" && cat >> ${libobj}T <<EOF
921 pic_object='$objdir/$objname'
922 
923 EOF
924 
925       # Allow error messages only from the first compilation.
926       if test "$suppress_opt" = yes; then
927         suppress_output=' >/dev/null 2>&1'
928       fi
929     else
930       # No PIC object so indicate it doesn't exist in the libtool
931       # object file.
932       test -z "$run" && cat >> ${libobj}T <<EOF
933 pic_object=none
934 
935 EOF
936     fi
937 
938     # Only build a position-dependent object if we build old libraries.
939     if test "$build_old_libs" = yes; then
940       if test "$pic_mode" != yes; then
941         # Don't build PIC code
942         command="$base_compile $srcfile"
943       else
944         command="$base_compile $srcfile $pic_flag"
945       fi
946       if test "$compiler_c_o" = yes; then
947         command="$command -o $obj"
948       fi
949 
950       # Suppress compiler output if we already did a PIC compilation.
951       command="$command$suppress_output"
952       $run $rm "$obj" "$output_obj"
953       $show "$command"
954       if $run eval "$command"; then :
955       else
956         $run $rm $removelist
957         exit $EXIT_FAILURE
958       fi
959 
960       if test "$need_locks" = warn &&
961          test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
962         $echo "\
963 *** ERROR, $lockfile contains:
964 `cat $lockfile 2>/dev/null`
965 
966 but it should contain:
967 $srcfile
968 
969 This indicates that another process is trying to use the same
970 temporary object file, and libtool could not work around it because
971 your compiler does not support \`-c' and \`-o' together.  If you
972 repeat this compilation, it may succeed, by chance, but you had better
973 avoid parallel builds (make -j) in this platform, or get a better
974 compiler."
975 
976         $run $rm $removelist
977         exit $EXIT_FAILURE
978       fi
979 
980       # Just move the object if needed
981       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
982         $show "$mv $output_obj $obj"
983         if $run $mv $output_obj $obj; then :
984         else
985           error=$?
986           $run $rm $removelist
987           exit $error
988         fi
989       fi
990 
991       # Append the name of the non-PIC object the libtool object file.
992       # Only append if the libtool object file exists.
993       test -z "$run" && cat >> ${libobj}T <<EOF
994 # Name of the non-PIC object.
995 non_pic_object='$objname'
996 
997 EOF
998     else
999       # Append the name of the non-PIC object the libtool object file.
1000       # Only append if the libtool object file exists.
1001       test -z "$run" && cat >> ${libobj}T <<EOF
1002 # Name of the non-PIC object.
1003 non_pic_object=none
1004 
1005 EOF
1006     fi
1007 
1008     $run $mv "${libobj}T" "${libobj}"
1009 
1010     # Unlock the critical section if it was locked
1011     if test "$need_locks" != no; then
1012       $run $rm "$lockfile"
1013     fi
1014 
1015     exit $EXIT_SUCCESS
1016     ;;
1017 
1018   # libtool link mode
1019   link | relink)
1020     modename="$modename: link"
1021     case $host in
1022     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1023       # It is impossible to link a dll without this setting, and
1024       # we shouldn't force the makefile maintainer to figure out
1025       # which system we are compiling for in order to pass an extra
1026       # flag for every libtool invocation.
1027       # allow_undefined=no
1028 
1029       # FIXME: Unfortunately, there are problems with the above when trying
1030       # to make a dll which has undefined symbols, in which case not
1031       # even a static library is built.  For now, we need to specify
1032       # -no-undefined on the libtool link line when we can be certain
1033       # that all symbols are satisfied, otherwise we get a static library.
1034       allow_undefined=yes
1035       ;;
1036     *)
1037       allow_undefined=yes
1038       ;;
1039     esac
1040     libtool_args="$nonopt"
1041     base_compile="$nonopt $@"
1042     compile_command="$nonopt"
1043     finalize_command="$nonopt"
1044 
1045     compile_rpath=
1046     finalize_rpath=
1047     compile_shlibpath=
1048     finalize_shlibpath=
1049     convenience=
1050     old_convenience=
1051     deplibs=
1052     old_deplibs=
1053     compiler_flags=
1054     linker_flags=
1055     dllsearchpath=
1056     lib_sear