root/trunk/admin/ltmain.sh

Revision 6141, 195.3 kB (checked in by erijo, 8 months ago)

Upgraded admin-files. New files taken from Debian's automake 1.10.1-3,
autotools-dev 20080123.1, gettext 0.17-2 and libtool 1.5.26-3.

  • Property svn:eol-style set to native
Line 
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, 2005, 2006,
5# 2007, 2008  Free Software Foundation, Inc.
6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 2 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful, but
14# WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
16# General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21#
22# As a special exception to the GNU General Public License, if you
23# distribute this file as part of a program that contains a
24# configuration script generated by Autoconf, you may include it under
25# the same distribution terms that you use for the rest of that program.
26
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.26 Debian 1.5.26-3"
47TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
48
49# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
51  emulate sh
52  NULLCMD=:
53  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54  # is contrary to our usage.  Disable this feature.
55  alias -g '${1+"$@"}'='"$@"'
56  setopt NO_GLOB_SUBST
57else
58  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
59fi
60BIN_SH=xpg4; export BIN_SH # for Tru64
61DUALCASE=1; export DUALCASE # for MKS sh
62
63# Check that we have a working $echo.
64if test "X$1" = X--no-reexec; then
65  # Discard the --no-reexec flag, and continue.
66  shift
67elif test "X$1" = X--fallback-echo; then
68  # Avoid inline document here, it may be left over
69  :
70elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71  # Yippee, $echo works!
72  :
73else
74  # Restart under the correct shell, and then maybe $echo will work.
75  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
76fi
77
78if test "X$1" = X--fallback-echo; then
79  # used as fallback echo
80  shift
81  cat <<EOF
82$*
83EOF
84  exit $EXIT_SUCCESS
85fi
86
87default_mode=
88help="Try \`$progname --help' for more information."
89magic="%%%MAGIC variable%%%"
90mkdir="mkdir"
91mv="mv -f"
92rm="rm -f"
93
94# Sed substitution that helps us do robust quoting.  It backslashifies
95# metacharacters that are still active within double-quoted strings.
96Xsed="${SED}"' -e 1s/^X//'
97sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98# test EBCDIC or ASCII
99case `echo X|tr X '\101'` in
100 A) # ASCII based system
101    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
102  SP2NL='tr \040 \012'
103  NL2SP='tr \015\012 \040\040'
104  ;;
105 *) # EBCDIC based system
106  SP2NL='tr \100 \n'
107  NL2SP='tr \r\n \100\100'
108  ;;
109esac
110
111# NLS nuisances.
112# Only set LANG and LC_ALL to C if already set.
113# These must not be set unconditionally because not all systems understand
114# e.g. LANG=C (notably SCO).
115# We save the old values to restore during execute mode.
116lt_env=
117for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
118do
119  eval "if test \"\${$lt_var+set}\" = set; then
120      save_$lt_var=\$$lt_var
121      lt_env=\"$lt_var=\$$lt_var \$lt_env\"
122      $lt_var=C
123      export $lt_var
124    fi"
125done
126
127if test -n "$lt_env"; then
128  lt_env="env $lt_env"
129fi
130
131# Make sure IFS has a sensible default
132lt_nl='
133'
134IFS="   $lt_nl"
135
136if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
137  $echo "$modename: not configured to build any kind of library" 1>&2
138  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
139  exit $EXIT_FAILURE
140fi
141
142# Global variables.
143mode=$default_mode
144nonopt=
145prev=
146prevopt=
147run=
148show="$echo"
149show_help=
150execute_dlfiles=
151duplicate_deps=no
152preserve_args=
153lo2o="s/\\.lo\$/.${objext}/"
154o2lo="s/\\.${objext}\$/.lo/"
155extracted_archives=
156extracted_serial=0
157
158#####################################
159# Shell function definitions:
160# This seems to be the best place for them
161
162# func_mktempdir [string]
163# Make a temporary directory that won't clash with other running
164# libtool processes, and avoids race conditions if possible.  If
165# given, STRING is the basename for that directory.
166func_mktempdir ()
167{
168    my_template="${TMPDIR-/tmp}/${1-$progname}"
169
170    if test "$run" = ":"; then
171      # Return a directory name, but don't create it in dry-run mode
172      my_tmpdir="${my_template}-$$"
173    else
174
175      # If mktemp works, use that first and foremost
176      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
177
178      if test ! -d "$my_tmpdir"; then
179    # Failing that, at least try and use $RANDOM to avoid a race
180    my_tmpdir="${my_template}-${RANDOM-0}$$"
181
182    save_mktempdir_umask=`umask`
183    umask 0077
184    $mkdir "$my_tmpdir"
185    umask $save_mktempdir_umask
186      fi
187
188      # If we're not in dry-run mode, bomb out on failure
189      test -d "$my_tmpdir" || {
190        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
191    exit $EXIT_FAILURE
192      }
193    fi
194
195    $echo "X$my_tmpdir" | $Xsed
196}
197
198
199# func_win32_libid arg
200# return the library type of file 'arg'
201#
202# Need a lot of goo to handle *both* DLLs and import libs
203# Has to be a shell function in order to 'eat' the argument
204# that is supplied when $file_magic_command is called.
205func_win32_libid ()
206{
207  win32_libid_type="unknown"
208  win32_fileres=`file -L $1 2>/dev/null`
209  case $win32_fileres in
210  *ar\ archive\ import\ library*) # definitely import
211    win32_libid_type="x86 archive import"
212    ;;
213  *ar\ archive*) # could be an import, or static
214    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
215      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
216      win32_nmres=`eval $NM -f posix -A $1 | \
217    $SED -n -e '1,100{
218        / I /{
219            s,.*,import,
220            p
221            q
222            }
223        }'`
224      case $win32_nmres in
225      import*)  win32_libid_type="x86 archive import";;
226      *)        win32_libid_type="x86 archive static";;
227      esac
228    fi
229    ;;
230  *DLL*)
231    win32_libid_type="x86 DLL"
232    ;;
233  *executable*) # but shell scripts are "executable" too...
234    case $win32_fileres in
235    *MS\ Windows\ PE\ Intel*)
236      win32_libid_type="x86 DLL"
237      ;;
238    esac
239    ;;
240  esac
241  $echo $win32_libid_type
242}
243
244
245# func_infer_tag arg
246# Infer tagged configuration to use if any are available and
247# if one wasn't chosen via the "--tag" command line option.
248# Only attempt this if the compiler in the base compile
249# command doesn't match the default compiler.
250# arg is usually of the form 'gcc ...'
251func_infer_tag ()
252{
253    if test -n "$available_tags" && test -z "$tagname"; then
254      CC_quoted=
255      for arg in $CC; do
256    case $arg in
257      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
258      arg="\"$arg\""
259      ;;
260    esac
261    CC_quoted="$CC_quoted $arg"
262      done
263      case $@ in
264      # Blanks in the command may have been stripped by the calling shell,
265      # but not from the CC environment variable when configure was run.
266      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
267      # Blanks at the start of $base_compile will cause this to fail
268      # if we don't check for them as well.
269      *)
270    for z in $available_tags; do
271      if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
272        # Evaluate the configuration.
273        eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
274        CC_quoted=
275        for arg in $CC; do
276        # Double-quote args containing other shell metacharacters.
277        case $arg in
278          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
279          arg="\"$arg\""
280          ;;
281        esac
282        CC_quoted="$CC_quoted $arg"
283      done
284        case "$@ " in
285          " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
286          # The compiler in the base compile command matches
287          # the one in the tagged configuration.
288          # Assume this is the tagged configuration we want.
289          tagname=$z
290          break
291          ;;
292        esac
293      fi
294    done
295    # If $tagname still isn't set, then no tagged configuration
296    # was found and let the user know that the "--tag" command
297    # line option must be used.
298    if test -z "$tagname"; then
299      $echo "$modename: unable to infer tagged configuration"
300      $echo "$modename: specify a tag with \`--tag'" 1>&2
301      exit $EXIT_FAILURE
302#        else
303#          $echo "$modename: using $tagname tagged configuration"
304    fi
305    ;;
306      esac
307    fi
308}
309
310
311# func_extract_an_archive dir oldlib
312func_extract_an_archive ()
313{
314    f_ex_an_ar_dir="$1"; shift
315    f_ex_an_ar_oldlib="$1"
316
317    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
318    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
319    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
320     :
321    else
322      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
323      exit $EXIT_FAILURE
324    fi
325}
326
327# func_extract_archives gentop oldlib ...
328func_extract_archives ()
329{
330    my_gentop="$1"; shift
331    my_oldlibs=${1+"$@"}
332    my_oldobjs=""
333    my_xlib=""
334    my_xabs=""
335    my_xdir=""
336    my_status=""
337
338    $show "${rm}r $my_gentop"
339    $run ${rm}r "$my_gentop"
340    $show "$mkdir $my_gentop"
341    $run $mkdir "$my_gentop"
342    my_status=$?
343    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
344      exit $my_status
345    fi
346
347    for my_xlib in $my_oldlibs; do
348      # Extract the objects.
349      case $my_xlib in
350    [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
351    *) my_xabs=`pwd`"/$my_xlib" ;;
352      esac
353      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
354      my_xlib_u=$my_xlib
355      while :; do
356        case " $extracted_archives " in
357    *" $my_xlib_u "*)
358      extracted_serial=`expr $extracted_serial + 1`
359      my_xlib_u=lt$extracted_serial-$my_xlib ;;
360    *) break ;;
361    esac
362      done
363      extracted_archives="$extracted_archives $my_xlib_u"
364      my_xdir="$my_gentop/$my_xlib_u"
365
366      $show "${rm}r $my_xdir"
367      $run ${rm}r "$my_xdir"
368      $show "$mkdir $my_xdir"
369      $run $mkdir "$my_xdir"
370      exit_status=$?
371      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
372    exit $exit_status
373      fi
374      case $host in
375      *-darwin*)
376    $show "Extracting $my_xabs"
377    # Do not bother doing anything if just a dry run
378    if test -z "$run"; then
379      darwin_orig_dir=`pwd`
380      cd $my_xdir || exit $?
381      darwin_archive=$my_xabs
382      darwin_curdir=`pwd`
383      darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
384      darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
385      if test -n "$darwin_arches"; then
386        darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
387        darwin_arch=
388        $show "$darwin_base_archive has multiple architectures $darwin_arches"
389        for darwin_arch in  $darwin_arches ; do
390          mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
391          lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
392          cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
393          func_extract_an_archive "`pwd`" "${darwin_base_archive}"
394          cd "$darwin_curdir"
395          $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
396        done # $darwin_arches
397      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
398        darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
399        darwin_file=
400        darwin_files=
401        for darwin_file in $darwin_filelist; do
402          darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
403          lipo -create -output "$darwin_file" $darwin_files
404        done # $darwin_filelist
405        ${rm}r unfat-$$
406        cd "$darwin_orig_dir"
407      else
408        cd "$darwin_orig_dir"
409        func_extract_an_archive "$my_xdir" "$my_xabs"
410      fi # $darwin_arches
411    fi # $run
412    ;;
413      *)
414        func_extract_an_archive "$my_xdir" "$my_xabs"
415        ;;
416      esac
417      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
418    done
419    func_extract_archives_result="$my_oldobjs"
420}
421# End of Shell function definitions
422#####################################
423
424# Darwin sucks
425eval std_shrext=\"$shrext_cmds\"
426
427disable_libs=no
428
429# Parse our command line options once, thoroughly.
430while test "$#" -gt 0
431do
432  arg="$1"
433  shift
434
435  case $arg in
436  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
437  *) optarg= ;;
438  esac
439
440  # If the previous option needs an argument, assign it.
441  if test -n "$prev"; then
442    case $prev in
443    execute_dlfiles)
444      execute_dlfiles="$execute_dlfiles $arg"
445      ;;
446    tag)
447      tagname="$arg"
448      preserve_args="${preserve_args}=$arg"
449
450      # Check whether tagname contains only valid characters
451      case $tagname in
452      *[!-_A-Za-z0-9,/]*)
453    $echo "$progname: invalid tag name: $tagname" 1>&2
454    exit $EXIT_FAILURE
455    ;;
456      esac
457
458      case $tagname in
459      CC)
460    # Don't test for the "default" C tag, as we know, it's there, but
461    # not specially marked.
462    ;;
463      *)
464    if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
465      taglist="$taglist $tagname"
466      # Evaluate the configuration.
467      eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
468    else
469      $echo "$progname: ignoring unknown tag $tagname" 1>&2
470    fi
471    ;;
472      esac
473      ;;
474    *)
475      eval "$prev=\$arg"
476      ;;
477    esac
478
479    prev=
480    prevopt=
481    continue
482  fi
483
484  # Have we seen a non-optional argument yet?
485  case $arg in
486  --help)
487    show_help=yes
488    ;;
489
490  --version)
491    echo "\
492$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
493
494Copyright (C) 2008  Free Software Foundation, Inc.
495This is free software; see the source for copying conditions.  There is NO
496warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
497    exit $?
498    ;;
499
500  --config)
501    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
502    # Now print the configurations for the tags.
503    for tagname in $taglist; do
504      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
505    done
506    exit $?
507    ;;
508
509  --debug)
510    $echo "$progname: enabling shell trace mode"
511    set -x
512    preserve_args="$preserve_args $arg"
513    ;;
514
515  --dry-run | -n)
516    run=:
517    ;;
518
519  --features)
520    $echo "host: $host"
521    if test "$build_libtool_libs" = yes; then
522      $echo "enable shared libraries"
523    else
524      $echo "disable shared libraries"
525    fi
526    if test "$build_old_libs" = yes; then
527      $echo "enable static libraries"
528    else
529      $echo "disable static libraries"
530    fi
531    exit $?
532    ;;
533
534  --finish) mode="finish" ;;
535
536  --mode) prevopt="--mode" prev=mode ;;
537  --mode=*) mode="$optarg" ;;
538
539  --preserve-dup-deps) duplicate_deps="yes" ;;
540
541  --quiet | --silent)
542    show=:
543    preserve_args="$preserve_args $arg"
544    ;;
545
546  --tag)
547    prevopt="--tag"
548    prev=tag
549    preserve_args="$preserve_args --tag"
550    ;;
551  --tag=*)
552    set tag "$optarg" ${1+"$@"}
553    shift
554    prev=tag
555    preserve_args="$preserve_args --tag"
556    ;;
557
558  -dlopen)
559    prevopt="-dlopen"
560    prev=execute_dlfiles
561    ;;
562
563  -*)
564    $echo "$modename: unrecognized option \`$arg'" 1>&2
565    $echo "$help" 1>&2
566    exit $EXIT_FAILURE
567    ;;
568
569  *)
570    nonopt="$arg"
571    break
572    ;;
573  esac
574done
575
576if test -n "$prevopt"; then
577  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
578  $echo "$help" 1>&2
579  exit $EXIT_FAILURE
580fi
581
582case $disable_libs in
583no) 
584  ;;
585shared)
586  build_libtool_libs=no
587  build_old_libs=yes
588  ;;
589static)
590  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
591  ;;
592esac
593
594# If this variable is set in any of the actions, the command in it
595# will be execed at the end.  This prevents here-documents from being
596# left over by shells.
597exec_cmd=
598
599if test -z "$show_help"; then
600
601  # Infer the operation mode.
602  if test -z "$mode"; then
603    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
604    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
605    case $nonopt in
606    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
607      mode=link
608      for arg
609      do
610    case $arg in
611    -c)
612       mode=compile
613       break
614       ;;
615    esac
616      done
617      ;;
618    *db | *dbx | *strace | *truss)
619      mode=execute
620      ;;
621    *install*|cp|mv)
622      mode=install
623      ;;
624    *rm)
625      mode=uninstall
626      ;;
627    *)
628      # If we have no mode, but dlfiles were specified, then do execute mode.
629      test -n "$execute_dlfiles" && mode=execute
630
631      # Just use the default operation mode.
632      if test -z "$mode"; then
633    if test -n "$nonopt"; then
634      $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
635    else
636      $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
637    fi
638      fi
639      ;;
640    esac
641  fi
642
643  # Only execute mode is allowed to have -dlopen flags.
644  if test -n "$execute_dlfiles" && test "$mode" != execute; then
645    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
646    $echo "$help" 1>&2
647    exit $EXIT_FAILURE
648  fi
649
650  # Change the help message to a mode-specific one.
651  generic_help="$help"
652  help="Try \`$modename --help --mode=$mode' for more information."
653
654  # These modes are in order of execution frequency so that they run quickly.
655  case $mode in
656  # libtool compile mode
657  compile)
658    modename="$modename: compile"
659    # Get the compilation command and the source file.
660    base_compile=
661    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
662    suppress_opt=yes
663    suppress_output=
664    arg_mode=normal
665    libobj=
666    later=
667
668    for arg
669    do
670      case $arg_mode in
671      arg  )
672    # do not "continue".  Instead, add this to base_compile
673    lastarg="$arg"
674    arg_mode=normal
675    ;;
676
677      target )
678    libobj="$arg"
679    arg_mode=normal
680    continue
681    ;;
682
683      normal )
684    # Accept any command-line options.
685    case $arg in
686    -o)
687      if test -n "$libobj" ; then
688        $echo "$modename: you cannot specify \`-o' more than once" 1>&2
689        exit $EXIT_FAILURE
690      fi
691      arg_mode=target
692      continue
693      ;;
694
695    -static | -prefer-pic | -prefer-non-pic)
696      later="$later $arg"
697      continue
698      ;;
699
700    -no-suppress)
701      suppress_opt=no
702      continue
703      ;;
704
705    -Xcompiler)
706      arg_mode=arg  #  the next one goes into the "base_compile" arg list
707      continue      #  The current "srcfile" will either be retained or
708      ;;            #  replaced later.  I would guess that would be a bug.
709
710    -Wc,*)
711      args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
712      lastarg=
713      save_ifs="$IFS"; IFS=','
714      for arg in $args; do
715        IFS="$save_ifs"
716
717        # Double-quote args containing other shell metacharacters.
718        # Many Bourne shells cannot handle close brackets correctly
719        # in scan sets, so we specify it separately.
720        case $arg in
721          *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
722          arg="\"$arg\""
723          ;;
724        esac
725        lastarg="$lastarg $arg"
726      done
727      IFS="$save_ifs"
728      lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
729
730      # Add the arguments to base_compile.
731      base_compile="$base_compile $lastarg"
732      continue
733      ;;
734
735    * )
736      # Accept the current argument as the source file.
737      # The previous "srcfile" becomes the current argument.
738      #
739      lastarg="$srcfile"
740      srcfile="$arg"
741      ;;
742    esac  #  case $arg
743    ;;
744      esac    #  case $arg_mode
745
746      # Aesthetically quote the previous argument.
747      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
748
749      case $lastarg in
750      # Double-quote args containing other shell metacharacters.
751      # Many Bourne shells cannot handle close brackets correctly
752      # in scan sets, and some SunOS ksh mistreat backslash-escaping
753      # in scan sets (worked around with variable expansion),
754      # and furthermore cannot handle '|' '&' '(' ')' in scan sets
755      # at all, so we specify them separately.
756      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
757    lastarg="\"$lastarg\""
758    ;;
759      esac
760
761      base_compile="$base_compile $lastarg"
762    done # for arg
763
764    case $arg_mode in
765    arg)
766      $echo "$modename: you must specify an argument for -Xcompile"
767      exit $EXIT_FAILURE
768      ;;
769    target)
770      $echo "$modename: you must specify a target with \`-o'" 1>&2
771      exit $EXIT_FAILURE
772      ;;
773    *)
774      # Get the name of the library object.
775      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
776      ;;
777    esac
778
779    # Recognize several different file suffixes.
780    # If the user specifies -o file.o, it is replaced with file.lo
781    xform='[cCFSifmso]'
782    case $libobj in
783    *.ada) xform=ada ;;
784    *.adb) xform=adb ;;
785    *.ads) xform=ads ;;
786    *.asm) xform=asm ;;
787    *.c++) xform=c++ ;;
788    *.cc) xform=cc ;;
789    *.ii) xform=ii ;;
790    *.class) xform=class ;;
791    *.cpp) xform=cpp ;;
792    *.cxx) xform=cxx ;;
793    *.[fF][09]?) xform=[fF][09]. ;;
794    *.for) xform=for ;;
795    *.java) xform=java ;;
796    *.obj) xform=obj ;;
797    *.sx) xform=sx ;;
798    esac
799
800    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
801
802    case $libobj in
803    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
804    *)
805      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
806      exit $EXIT_FAILURE
807      ;;
808    esac
809
810    func_infer_tag $base_compile
811
812    for arg in $later; do
813      case $arg in
814      -static)
815    build_old_libs=yes
816    continue
817    ;;
818
819      -prefer-pic)
820    pic_mode=yes
821    continue
822    ;;
823
824      -prefer-non-pic)
825    pic_mode=no
826    continue
827    ;;
828      esac
829    done
830
831    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
832    case $qlibobj in
833      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
834    qlibobj="\"$qlibobj\"" ;;
835    esac
836    test "X$libobj" != "X$qlibobj" \
837    && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"'  &()|`$[]' \