Am-Utils Cross Reference
am-utils/ltmain.sh

source navigation ]
diff markup ]
identifier search ]
freetext search ]
file search ]
 
Version: 6.0.1 ] [ 6.0.2 ] [ 6.0.3 ] [ 6.0.4 ] [ 6.0.5 ] [ 6.0.6 ] [ 6.0.7 ] [ 6.0.8 ] [ 6.0.9 ] [ 6.0.10 ] [ 6.1 ] [ 6.1.1 ]

  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
  5 # Free Software Foundation, Inc.
  6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
  7 #
  8 # This program is free software; you can redistribute it and/or modify
  9 # it under the terms of the GNU General Public License as published by
 10 # the Free Software Foundation; either version 2 of the License, or
 11 # (at your option) any later version.
 12 #
 13 # This program is distributed in the hope that it will be useful, but
 14 # WITHOUT ANY WARRANTY; without even the implied warranty of
 15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 16 # General Public License for more details.
 17 #
 18 # You should have received a copy of the GNU General Public License
 19 # along with this program; if not, write to the Free Software
 20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 21 #
 22 # As a special exception to the GNU General Public License, if you
 23 # distribute this file as part of a program that contains a
 24 # configuration script generated by Autoconf, you may include it under
 25 # the same distribution terms that you use for the rest of that program.
 26 
 27 basename="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.
 34 progpath="$0"
 35 
 36 # The name of this program:
 37 progname=`echo "$progpath" | $SED $basename`
 38 modename="$progname"
 39 
 40 # Global variables:
 41 EXIT_SUCCESS=0
 42 EXIT_FAILURE=1
 43 
 44 PROGRAM=ltmain.sh
 45 PACKAGE=libtool
 46 VERSION=1.5.18
 47 TIMESTAMP=" (1.1220.2.245 2005/05/16 08:55:27)"
 48 
 49 # See if we are running on zsh, and set the options which allow our
 50 # commands through without removal of \ escapes.
 51 if test -n "${ZSH_VERSION+set}" ; then
 52   setopt NO_GLOB_SUBST
 53 fi
 54 
 55 # Check that we have a working $echo.
 56 if test "X$1" = X--no-reexec; then
 57   # Discard the --no-reexec flag, and continue.
 58   shift
 59 elif test "X$1" = X--fallback-echo; then
 60   # Avoid inline document here, it may be left over
 61   :
 62 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
 63   # Yippee, $echo works!
 64   :
 65 else
 66   # Restart under the correct shell, and then maybe $echo will work.
 67   exec $SHELL "$progpath" --no-reexec ${1+"$@"}
 68 fi
 69 
 70 if test "X$1" = X--fallback-echo; then
 71   # used as fallback echo
 72   shift
 73   cat <<EOF
 74 $*
 75 EOF
 76   exit $EXIT_SUCCESS
 77 fi
 78 
 79 default_mode=
 80 help="Try \`$progname --help' for more information."
 81 magic="%%%MAGIC variable%%%"
 82 mkdir="mkdir"
 83 mv="mv -f"
 84 rm="rm -f"
 85 
 86 # Sed substitution that helps us do robust quoting.  It backslashifies
 87 # metacharacters that are still active within double-quoted strings.
 88 Xsed="${SED}"' -e 1s/^X//'
 89 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
 90 # test EBCDIC or ASCII
 91 case `echo A|tr A '\301'` in
 92  A) # EBCDIC based system
 93   SP2NL="tr '\100' '\n'"
 94   NL2SP="tr '\r\n' '\100\100'"
 95   ;;
 96  *) # Assume ASCII based system
 97   SP2NL="tr '\040' '\012'"
 98   NL2SP="tr '\015\012' '\040\040'"
 99   ;;
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 lt_nl='
116 '
117 IFS="   $lt_nl"
118 
119 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
120   $echo "$modename: not configured to build any kind of library" 1>&2
121   $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
122   exit $EXIT_FAILURE
123 fi
124 
125 # Global variables.
126 mode=$default_mode
127 nonopt=
128 prev=
129 prevopt=
130 run=
131 show="$echo"
132 show_help=
133 execute_dlfiles=
134 lo2o="s/\\.lo\$/.${objext}/"
135 o2lo="s/\\.${objext}\$/.lo/"
136 quote_scanset='[[~#^*{};<>?'"'"'        ]'
137 
138 #####################################
139 # Shell function definitions:
140 # This seems to be the best place for them
141 
142 # func_win32_libid arg
143 # return the library type of file 'arg'
144 #
145 # Need a lot of goo to handle *both* DLLs and import libs
146 # Has to be a shell function in order to 'eat' the argument
147 # that is supplied when $file_magic_command is called.
148 func_win32_libid ()
149 {
150   win32_libid_type="unknown"
151   win32_fileres=`file -L $1 2>/dev/null`
152   case $win32_fileres in
153   *ar\ archive\ import\ library*) # definitely import
154     win32_libid_type="x86 archive import"
155     ;;
156   *ar\ archive*) # could be an import, or static
157     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
158       $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
159       win32_nmres=`eval $NM -f posix -A $1 | \
160         sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'`
161       if test "X$win32_nmres" = "Ximport" ; then
162         win32_libid_type="x86 archive import"
163       else
164         win32_libid_type="x86 archive static"
165       fi
166     fi
167     ;;
168   *DLL*)
169     win32_libid_type="x86 DLL"
170     ;;
171   *executable*) # but shell scripts are "executable" too...
172     case $win32_fileres in
173     *MS\ Windows\ PE\ Intel*)
174       win32_libid_type="x86 DLL"
175       ;;
176     esac
177     ;;
178   esac
179   $echo $win32_libid_type
180 }
181 
182 
183 # func_infer_tag arg
184 # Infer tagged configuration to use if any are available and
185 # if one wasn't chosen via the "--tag" command line option.
186 # Only attempt this if the compiler in the base compile
187 # command doesn't match the default compiler.
188 # arg is usually of the form 'gcc ...'
189 func_infer_tag ()
190 {
191     if test -n "$available_tags" && test -z "$tagname"; then
192       CC_quoted=
193       for arg in $CC; do
194         case $arg in
195           *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
196           arg="\"$arg\""
197           ;;
198         esac
199         CC_quoted="$CC_quoted $arg"
200       done
201       case $@ in
202       # Blanks in the command may have been stripped by the calling shell,
203       # but not from the CC environment variable when configure was run.
204       " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
205       # Blanks at the start of $base_compile will cause this to fail
206       # if we don't check for them as well.
207       *)
208         for z in $available_tags; do
209           if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
210             # Evaluate the configuration.
211             eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
212             CC_quoted=
213             for arg in $CC; do
214             # Double-quote args containing other shell metacharacters.
215             case $arg in
216               *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
217               arg="\"$arg\""
218               ;;
219             esac
220             CC_quoted="$CC_quoted $arg"
221           done
222             case "$@ " in
223               " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
224               # The compiler in the base compile command matches
225               # the one in the tagged configuration.
226               # Assume this is the tagged configuration we want.
227               tagname=$z
228               break
229               ;;
230             esac
231           fi
232         done
233         # If $tagname still isn't set, then no tagged configuration
234         # was found and let the user know that the "--tag" command
235         # line option must be used.
236         if test -z "$tagname"; then
237           $echo "$modename: unable to infer tagged configuration"
238           $echo "$modename: specify a tag with \`--tag'" 1>&2
239           exit $EXIT_FAILURE
240 #        else
241 #          $echo "$modename: using $tagname tagged configuration"
242         fi
243         ;;
244       esac
245     fi
246 }
247 
248 
249 # func_extract_an_archive dir oldlib
250 func_extract_an_archive ()
251 {
252     f_ex_an_ar_dir="$1"; shift
253     f_ex_an_ar_oldlib="$1"
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: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
261       exit $EXIT_FAILURE
262     fi
263 }
264 
265 # func_extract_archives gentop oldlib ...
266 func_extract_archives ()
267 {
268     my_gentop="$1"; shift
269     my_oldlibs=${1+"$@"}
270     my_oldobjs=""
271     my_xlib=""
272     my_xabs=""
273     my_xdir=""
274     my_status=""
275 
276     $show "${rm}r $my_gentop"
277     $run ${rm}r "$my_gentop"
278     $show "$mkdir $my_gentop"
279     $run $mkdir "$my_gentop"
280     my_status=$?
281     if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
282       exit $my_status
283     fi
284 
285     for my_xlib in $my_oldlibs; do
286       # Extract the objects.
287       case $my_xlib in
288         [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
289         *) my_xabs=`pwd`"/$my_xlib" ;;
290       esac
291       my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
292       my_xdir="$my_gentop/$my_xlib"
293 
294       $show "${rm}r $my_xdir"
295       $run ${rm}r "$my_xdir"
296       $show "$mkdir $my_xdir"
297       $run $mkdir "$my_xdir"
298       status=$?
299       if test "$status" -ne 0 && test ! -d "$my_xdir"; then
300         exit $status
301       fi
302       case $host in
303       *-darwin*)
304         $show "Extracting $my_xabs"
305         # Do not bother doing anything if just a dry run
306         if test -z "$run"; then
307           darwin_orig_dir=`pwd`
308           cd $my_xdir || exit $?
309           darwin_archive=$my_xabs
310           darwin_curdir=`pwd`
311           darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
312           darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
313           if test -n "$darwin_arches"; then 
314             darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
315             darwin_arch=
316             $show "$darwin_base_archive has multiple architectures $darwin_arches"
317             for darwin_arch in  $darwin_arches ; do
318               mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
319               lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
320               cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
321               func_extract_an_archive "`pwd`" "${darwin_base_archive}"
322               cd "$darwin_curdir"
323               $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
324             done # $darwin_arches
325       ## Okay now we have a bunch of thin objects, gotta fatten them up :)
326             darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
327             darwin_file=
328             darwin_files=
329             for darwin_file in $darwin_filelist; do
330               darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
331               lipo -create -output "$darwin_file" $darwin_files
332             done # $darwin_filelist
333             ${rm}r unfat-$$
334             cd "$darwin_orig_dir"
335           else
336             cd "$darwin_orig_dir"
337             func_extract_an_archive "$my_xdir" "$my_xabs"
338           fi # $darwin_arches
339         fi # $run
340       ;;
341       *)
342         func_extract_an_archive "$my_xdir" "$my_xabs"
343         ;;
344       esac
345       my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
346     done
347     func_extract_archives_result="$my_oldobjs"
348 }
349 # End of Shell function definitions
350 #####################################
351 
352 # Darwin sucks
353 eval std_shrext=\"$shrext_cmds\"
354 
355 # Parse our command line options once, thoroughly.
356 while test "$#" -gt 0
357 do
358   arg="$1"
359   shift
360 
361   case $arg in
362   -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
363   *) optarg= ;;
364   esac
365 
366   # If the previous option needs an argument, assign it.
367   if test -n "$prev"; then
368     case $prev in
369     execute_dlfiles)
370       execute_dlfiles="$execute_dlfiles $arg"
371       ;;
372     tag)
373       tagname="$arg"
374       preserve_args="${preserve_args}=$arg"
375 
376       # Check whether tagname contains only valid characters
377       case $tagname in
378       *[!-_A-Za-z0-9,/]*)
379         $echo "$progname: invalid tag name: $tagname" 1>&2
380         exit $EXIT_FAILURE
381         ;;
382       esac
383 
384       case $tagname in
385       CC)
386         # Don't test for the "default" C tag, as we know, it's there, but
387         # not specially marked.
388         ;;
389       *)
390         if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
391           taglist="$taglist $tagname"
392           # Evaluate the configuration.
393           eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
394         else
395           $echo "$progname: ignoring unknown tag $tagname" 1>&2
396         fi
397         ;;
398       esac
399       ;;
400     *)
401       eval "$prev=\$arg"
402       ;;
403     esac
404 
405     prev=
406     prevopt=
407     continue
408   fi
409 
410   # Have we seen a non-optional argument yet?
411   case $arg in
412   --help)
413     show_help=yes
414     ;;
415 
416   --version)
417     $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
418     $echo
419     $echo "Copyright (C) 2005  Free Software Foundation, Inc."
420     $echo "This is free software; see the source for copying conditions.  There is NO"
421     $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
422     exit $?
423     ;;
424 
425   --config)
426     ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
427     # Now print the configurations for the tags.
428     for tagname in $taglist; do
429       ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
430     done
431     exit $?
432     ;;
433 
434   --debug)
435     $echo "$progname: enabling shell trace mode"
436     set -x
437     preserve_args="$preserve_args $arg"
438     ;;
439 
440   --dry-run | -n)
441     run=:
442     ;;
443 
444   --features)
445     $echo "host: $host"
446     if test "$build_libtool_libs" = yes; then
447       $echo "enable shared libraries"
448     else
449       $echo "disable shared libraries"
450     fi
451     if test "$build_old_libs" = yes; then
452       $echo "enable static libraries"
453     else
454       $echo "disable static libraries"
455     fi
456     exit $?
457     ;;
458 
459   --finish) mode="finish" ;;
460 
461   --mode) prevopt="--mode" prev=mode ;;
462   --mode=*) mode="$optarg" ;;
463 
464   --preserve-dup-deps) duplicate_deps="yes" ;;
465 
466   --quiet | --silent)
467     show=:
468     preserve_args="$preserve_args $arg"
469     ;;
470 
471   --tag) prevopt="--tag" prev=tag ;;
472   --tag=*)
473     set tag "$optarg" ${1+"$@"}
474     shift
475     prev=tag
476     preserve_args="$preserve_args --tag"
477     ;;
478 
479   -dlopen)
480     prevopt="-dlopen"
481     prev=execute_dlfiles
482     ;;
483 
484   -*)
485     $echo "$modename: unrecognized option \`$arg'" 1>&2
486     $echo "$help" 1>&2
487     exit $EXIT_FAILURE
488     ;;
489 
490   *)
491     nonopt="$arg"
492     break
493     ;;
494   esac
495 done
496 
497 if test -n "$prevopt"; then
498   $echo "$modename: option \`$prevopt' requires an argument" 1>&2
499   $echo "$help" 1>&2
500   exit $EXIT_FAILURE
501 fi
502 
503 # If this variable is set in any of the actions, the command in it
504 # will be execed at the end.  This prevents here-documents from being
505 # left over by shells.
506 exec_cmd=
507 
508 if test -z "$show_help"; then
509 
510   # Infer the operation mode.
511   if test -z "$mode"; then
512     $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
513     $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
514     case $nonopt in
515     *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
516       mode=link
517       for arg
518       do
519         case $arg in
520         -c)
521            mode=compile
522            break
523            ;;
524         esac
525       done
526       ;;
527     *db | *dbx | *strace | *truss)
528       mode=execute
529       ;;
530     *install*|cp|mv)
531       mode=install
532       ;;
533     *rm)
534       mode=uninstall
535       ;;
536     *)
537       # If we have no mode, but dlfiles were specified, then do execute mode.
538       test -n "$execute_dlfiles" && mode=execute
539 
540       # Just use the default operation mode.
541       if test -z "$mode"; then
542         if test -n "$nonopt"; then
543           $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
544         else
545           $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
546         fi
547       fi
548       ;;
549     esac
550   fi
551 
552   # Only execute mode is allowed to have -dlopen flags.
553   if test -n "$execute_dlfiles" && test "$mode" != execute; then
554     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
555     $echo "$help" 1>&2
556     exit $EXIT_FAILURE
557   fi
558 
559   # Change the help message to a mode-specific one.
560   generic_help="$help"
561   help="Try \`$modename --help --mode=$mode' for more information."
562 
563   # These modes are in order of execution frequency so that they run quickly.
564   case $mode in
565   # libtool compile mode
566   compile)
567     modename="$modename: compile"
568     # Get the compilation command and the source file.
569     base_compile=
570     srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
571     suppress_opt=yes
572     suppress_output=
573     arg_mode=normal
574     libobj=
575     later=
576 
577     for arg
578     do
579       case "$arg_mode" in
580       arg  )
581         # do not "continue".  Instead, add this to base_compile
582         lastarg="$arg"
583         arg_mode=normal
584         ;;
585 
586       target )
587         libobj="$arg"
588         arg_mode=normal
589         continue
590         ;;
591 
592       normal )
593         # Accept any command-line options.
594         case $arg in
595         -o)
596           if test -n "$libobj" ; then
597             $echo "$modename: you cannot specify \`-o' more than once" 1>&2
598             exit $EXIT_FAILURE
599           fi
600           arg_mode=target
601           continue
602           ;;
603 
604         -static | -prefer-pic | -prefer-non-pic)
605           later="$later $arg"
606           continue
607           ;;
608 
609         -no-suppress)
610           suppress_opt=no
611           continue
612           ;;
613 
614         -Xcompiler)
615           arg_mode=arg  #  the next one goes into the "base_compile" arg list
616           continue      #  The current "srcfile" will either be retained or
617           ;;            #  replaced later.  I would guess that would be a bug.
618 
619         -Wc,*)
620           args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
621           lastarg=
622           save_ifs="$IFS"; IFS=','
623           for arg in $args; do
624             IFS="$save_ifs"
625 
626             # Double-quote args containing other shell metacharacters.
627             # Many Bourne shells cannot handle close brackets correctly
628             # in scan sets, so we specify it separately.
629             case $arg in
630               *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
631               arg="\"$arg\""
632               ;;
633             esac
634             lastarg="$lastarg $arg"
635           done
636           IFS="$save_ifs"
637           lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
638 
639           # Add the arguments to base_compile.
640           base_compile="$base_compile $lastarg"
641           continue
642           ;;
643 
644         * )
645           # Accept the current argument as the source file.
646           # The previous "srcfile" becomes the current argument.
647           #
648           lastarg="$srcfile"
649           srcfile="$arg"
650           ;;
651         esac  #  case $arg
652         ;;
653       esac    #  case $arg_mode
654 
655       # Aesthetically quote the previous argument.
656       lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
657 
658       case $lastarg in
659       # Double-quote args containing other shell metacharacters.
660       # Many Bourne shells cannot handle close brackets correctly
661       # in scan sets, and some SunOS ksh mistreat backslash-escaping
662       # in scan sets (worked around with variable expansion),
663       # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
664       # at all, so we specify them separately.
665       *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
666         lastarg="\"$lastarg\""
667         ;;
668       esac
669 
670       base_compile="$base_compile $lastarg"
671     done # for arg
672 
673     case $arg_mode in
674     arg)
675       $echo "$modename: you must specify an argument for -Xcompile"
676       exit $EXIT_FAILURE
677       ;;
678     target)
679       $echo "$modename: you must specify a target with \`-o'" 1>&2
680       exit $EXIT_FAILURE
681       ;;
682     *)
683       # Get the name of the library object.
684       [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
685       ;;
686     esac
687 
688     # Recognize several different file suffixes.
689     # If the user specifies -o file.o, it is replaced with file.lo
690     xform='[cCFSifmso]'
691     case $libobj in
692     *.ada) xform=ada ;;
693     *.adb) xform=adb ;;
694     *.ads) xform=ads ;;
695     *.asm) xform=asm ;;
696     *.c++) xform=c++ ;;
697     *.cc) xform=cc ;;
698     *.ii) xform=ii ;;
699     *.class) xform=class ;;
700     *.cpp) xform=cpp ;;
701     *.cxx) xform=cxx ;;
702     *.f90) xform=f90 ;;
703     *.for) xform=for ;;
704     *.java) xform=java ;;
705     esac
706 
707     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
708 
709     case $libobj in
710     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
711     *)
712       $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
713       exit $EXIT_FAILURE
714       ;;
715     esac
716 
717     func_infer_tag $base_compile
718 
719     for arg in $later; do
720       case $arg in
721       -static)
722         build_old_libs=yes
723         continue
724         ;;
725 
726       -prefer-pic)
727         pic_mode=yes
728         continue
729         ;;
730 
731       -prefer-non-pic)
732         pic_mode=no
733         continue
734         ;;
735       esac
736     done
737 
738     qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
739     case $qlibobj in
740       *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
741         qlibobj="\"$qlibobj\"" ;;
742     esac
743     if test "X$libobj" != "X$qlibobj"; then
744         $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
745         exit $EXIT_FAILURE
746     fi
747     objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
748     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
749     if test "X$xdir" = "X$obj"; then
750       xdir=
751     else
752       xdir=$xdir/
753     fi
754     lobj=${xdir}$objdir/$objname
755 
756     if test -z "$base_compile"; then
757       $echo "$modename: you must specify a compilation command" 1>&2
758       $echo "$help" 1>&2
759       exit $EXIT_FAILURE
760     fi
761 
762     # Delete any leftover library objects.
763     if test "$build_old_libs" = yes; then
764       removelist="$obj $lobj $libobj ${libobj}T"
765     else
766       removelist="$lobj $libobj ${libobj}T"
767     fi
768 
769     $run $rm $removelist
770     trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
771 
772     # On Cygwin there's no "real" PIC flag so we must build both object types
773     case $host_os in
774     cygwin* | mingw* | pw32* | os2*)
775       pic_mode=default
776       ;;
777     esac
778     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
779       # non-PIC code in shared libraries is not supported
780       pic_mode=default
781     fi
782 
783     # Calculate the filename of the output object if compiler does
784     # not support -o with -c
785     if test "$compiler_c_o" = no; then
786       output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
787       lockfile="$output_obj.lock"
788       removelist="$removelist $output_obj $lockfile"
789       trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
790     else
791       output_obj=
792       need_locks=no
793       lockfile=
794     fi
795 
796     # Lock this critical section if it is needed
797     # We use this script file to make the link, it avoids creating a new file
798     if test "$need_locks" = yes; then
799       until $run ln "$progpath" "$lockfile" 2>/dev/null; do
800         $show "Waiting for $lockfile to be removed"
801         sleep 2
802       done
803     elif test "$need_locks" = warn; then
804       if test -f "$lockfile"; then
805         $echo "\
806 *** ERROR, $lockfile exists and contains:
807 `cat $lockfile 2>/dev/null`
808 
809 This indicates that another process is trying to use the same
810 temporary object file, and libtool could not work around it because
811 your compiler does not support \`-c' and \`-o' together.  If you
812 repeat this compilation, it may succeed, by chance, but you had better
813 avoid parallel builds (make -j) in this platform, or get a better
814 compiler."
815 
816         $run $rm $removelist
817         exit $EXIT_FAILURE
818       fi
819       $echo "$srcfile" > "$lockfile"
820     fi
821 
822     if test -n "$fix_srcfile_path"; then
823       eval srcfile=\"$fix_srcfile_path\"
824     fi
825     qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
826     case $qsrcfile in
827       *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
828       qsrcfile="\"$qsrcfile\"" ;;
829     esac
830 
831     $run $rm "$libobj" "${libobj}T"
832 
833     # Create a libtool object file (analogous to a ".la" file),
834     # but don't create it if we're doing a dry run.
835     test -z "$run" && cat > ${libobj}T <<EOF
836 # $libobj - a libtool object file
837 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
838 #
839 # Please DO NOT delete this file!
840 # It is necessary for linking the library.
841 
842 # Name of the PIC object.
843 EOF
844 
845     # Only build a PIC object if we are building libtool libraries.
846     if test "$build_libtool_libs" = yes; then
847       # Without this assignment, base_compile gets emptied.
848       fbsd_hideous_sh_bug=$base_compile
849 
850       if test "$pic_mode" != no; then
851         command="$base_compile $qsrcfile $pic_flag"
852       else
853         # Don't build PIC code
854         command="$base_compile $qsrcfile"
855       fi
856 
857       if test ! -d "${xdir}$objdir"; then
858         $show "$mkdir ${xdir}$objdir"
859         $run $mkdir ${xdir}$objdir
860         status=$?
861         if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then
862           exit $status
863         fi
864       fi
865 
866       if test -z "$output_obj"; then
867         # Place PIC objects in $objdir
868         command="$command -o $lobj"
869       fi
870 
871       $run $rm "$lobj" "$output_obj"
872 
873       $show "$command"
874       if $run eval "$command"; then :
875       else
876         test -n "$output_obj" && $run $rm $removelist
877         exit $EXIT_FAILURE
878       fi
879 
880       if test "$need_locks" = warn &&
881          test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
882         $echo "\
883 *** ERROR, $lockfile contains:
884 `cat $lockfile 2>/dev/null`
885 
886 but it should contain:
887 $srcfile
888 
889 This indicates that another process is trying to use the same
890 temporary object file, and libtool could not work around it because
891 your compiler does not support \`-c' and \`-o' together.  If you
892 repeat this compilation, it may succeed, by chance, but you had better
893 avoid parallel builds (make -j) in this platform, or get a better
894 compiler."
895 
896         $run $rm $removelist
897         exit $EXIT_FAILURE
898       fi
899 
900       # Just move the object if needed, then go on to compile the next one
901       if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
902         $show "$mv $output_obj $lobj"
903         if $run $mv $output_obj $lobj; then :
904         else
905           error=$?
906           $run $rm $removelist
907           exit $error
908         fi
909       fi
910 
911       # Append the name of the PIC object to the libtool object file.
912       test -z "$run" && cat >> ${libobj}T <<EOF
913 pic_object='$objdir/$objname'
914 
915 EOF
916 
917       # Allow error messages only from the first compilation.
918       if test "$suppress_opt" = yes; then
919         suppress_output=' >/dev/null 2>&1'
920       fi
921     else
922       # No PIC object so indicate it doesn't exist in the libtool
923       # object file.
924       test -z "$run" && cat >> ${libobj}T <<EOF
925 pic_object=none
926 
927 EOF
928     fi
929 
930     # Only build a position-dependent object if we build old libraries.
931     if test "$build_old_libs" = yes; then
932       if test "$pic_mode" != yes; then
933         # Don't build PIC code
934         command="$base_compile $qsrcfile"
935       else
936         command="$base_compile $qsrcfile $pic_flag"
937       fi
938       if test "$compiler_c_o" = yes; then
939         command="$command -o $obj"
940       fi
941 
942       # Suppress compiler output if we already did a PIC compilation.
943       command="$command$suppress_output"
944       $run $rm "$obj" "$output_obj"
945       $show "$command"
946       if $run eval "$command"; then :
947       else
948         $run $rm $removelist
949         exit $EXIT_FAILURE
950       fi
951 
952       if test "$need_locks" = warn &&
953          test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
954         $echo "\
955 *** ERROR, $lockfile contains:
956 `cat $lockfile 2>/dev/null`
957 
958 but it should contain:
959 $srcfile
960 
961 This indicates that another process is trying to use the same
962 temporary object file, and libtool could not work around it because
963 your compiler does not support \`-c' and \`-o' together.  If you
964 repeat this compilation, it may succeed, by chance, but you had better
965 avoid parallel builds (make -j) in this platform, or get a better
966 compiler."
967 
968         $run $rm $removelist
969         exit $EXIT_FAILURE
970       fi
971 
972       # Just move the object if needed
973       if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
974         $show "$mv $output_obj $obj"
975         if $run $mv $output_obj $obj; then :
976         else
977           error=$?
978           $run $rm $removelist
979           exit $error
980         fi
981       fi
982 
983       # Append the name of the non-PIC object the libtool object file.
984       # Only append if the libtool object file exists.
985       test -z "$run" && cat >> ${libobj}T <<EOF
986 # Name of the non-PIC object.
987 non_pic_object='$objname'
988 
989 EOF
990     else
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=none
996 
997 EOF
998     fi
999 
1000     $run $mv "${libobj}T" "${libobj}"
1001 
1002     # Unlock the critical section if it was locked
1003     if test "$need_locks" != no; then
1004       $run $rm "$lockfile"
1005     fi
1006 
1007     exit $EXIT_SUCCESS
1008     ;;
1009 
1010   # libtool link mode
1011   link | relink)
1012     modename="$modename: link"
1013     case $host in
1014     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1015       # It is impossible to link a dll without this setting, and
1016       # we shouldn't force the makefile maintainer to figure out
1017       # which system we are compiling for in order to pass an extra
1018       # flag for every libtool invocation.
1019       # allow_undefined=no
1020 
1021       # FIXME: Unfortunately, there are problems with the above when trying
1022       # to make a dll which has undefined symbols, in which case not
1023       # even a static library is built.  For now, we need to specify
1024       # -no-undefined on the libtool link line when we can be certain
1025       # that all symbols are satisfied, otherwise we get a static library.
1026       allow_undefined=yes
1027       ;;
1028     *)
1029       allow_undefined=yes
1030       ;;
1031     esac
1032     libtool_args="$nonopt"
1033     base_compile="$nonopt $@"
1034     compile_command="$nonopt"
1035     finalize_command="$nonopt"
1036 
1037     compile_rpath=
1038     finalize_rpath=
1039     compile_shlibpath=
1040     finalize_shlibpath=
1041     convenience=
1042     old_convenience=
1043     deplibs=
1044     old_deplibs=
1045     compiler_flags=
1046     linker_flags=
1047     dllsearchpath=
1048     lib_search_path=`pwd`
1049     inst_prefix_dir=
1050 
1051     avoid_version=no
1052     dlfiles=
1053     dlprefiles=
1054     dlself=no
1055     export_dynamic=no
1056     export_symbols=
1057     export_symbols_regex=
1058     generated=
1059     libobjs=
1060     ltlibs=
1061     module=no
1062     no_install=no
1063     objs=
1064     non_pic_objects=
1065     precious_files_regex=
1066     prefer_static_libs=no
1067     preload=no
1068     prev=
1069     prevarg=
1070     release=
1071     rpath=
1072     xrpath=
1073     perm_rpath=
1074     temp_rpath=
1075     thread_safe=no
1076     vinfo=
1077     vinfo_number=no
1078 
1079     func_infer_tag $base_compile
1080 
1081     # We need to know -static, to get the right output filenames.
1082     for arg
1083     do
1084       case $arg in
1085       -all-static | -static)
1086         if test "X$arg" = "X-all-static"; then
1087           if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1088             $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1089           fi
1090           if test -n "$link_static_flag"; then
1091             dlopen_self=$dlopen_self_static
1092           fi
1093         else
1094           if test -z "$pic_flag" && test -n "$link_static_flag"; then
1095             dlopen_self=$dlopen_self_static
1096           fi
1097         fi
1098         build_libtool_libs=no
1099         build_old_libs=yes
1100         prefer_static_libs=yes
1101         break
1102         ;;
1103       esac
1104     done
1105 
1106     # See if our shared archives depend on static archives.
1107     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1108 
1109     # Go through the arguments, transforming them on the way.
1110     while test "$#" -gt 0; do
1111       arg="$1"
1112       shift
1113       case $arg in
1114       *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1115         qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1116         ;;
1117       *) qarg=$arg ;;
1118       esac
1119       libtool_args="$libtool_args $qarg"
1120 
1121       # If the previous option needs an argument, assign it.
1122       if test -n "$prev"; then
1123         case $prev in
1124         output)
1125           compile_command="$compile_command @OUTPUT@"
1126           finalize_command="$finalize_command @OUTPUT@"
1127           ;;
1128         esac
1129 
1130         case $prev in
1131         dlfiles|dlprefiles)
1132           if test "$preload" = no; then
1133             # Add the symbol object into the linking commands.
1134             compile_command="$compile_command @SYMFILE@"
1135             finalize_command="$finalize_command @SYMFILE@"
1136             preload=yes
1137           fi
1138           case $arg in
1139           *.la | *.lo) ;;  # We handle these cases below.
1140           force)
1141             if test "$dlself" = no; then
1142               dlself=needless
1143               export_dynamic=yes
1144             fi
1145             prev=
1146             continue
1147             ;;
1148           self)
1149             if test "$prev" = dlprefiles; then
1150               dlself=yes
1151             elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1152               dlself=yes
1153             else
1154               dlself=needless
1155               export_dynamic=yes
1156             fi
1157             prev=
1158             continue
1159             ;;
1160           *)
1161             if test "$prev" = dlfiles; then
1162               dlfiles="$dlfiles $arg"
1163             else
1164               dlprefiles="$dlprefiles $arg"
1165             fi
1166             prev=
1167             continue
1168             ;;
1169           esac
1170           ;;
1171         expsyms)
1172           export_symbols="$arg"
1173           if test ! -f "$arg"; then
1174             $echo "$modename: symbol file \`$arg' does not exist"
1175             exit $EXIT_FAILURE
1176           fi
1177           prev=
1178           continue
1179           ;;
1180         expsyms_regex)
1181           export_symbols_regex="$arg"
1182           prev=
1183           continue
1184           ;;
1185         inst_prefix)
1186           inst_prefix_dir="$arg"
1187           prev=
1188           continue
1189           ;;
1190         precious_regex)
1191           precious_files_regex="$arg"
1192           prev=
1193           continue
1194           ;;
1195         release)
1196           release="-$arg"
1197           prev=
1198           continue
1199           ;;
1200         objectlist)
1201           if test -f "$arg"; then
1202             save_arg=$arg
1203             moreargs=
1204             for fil in `cat $save_arg`
1205             do
1206 #             moreargs="$moreargs $fil"
1207               arg=$fil
1208               # A libtool-controlled object.
1209 
1210               # Check to see that this really is a libtool object.
1211               if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1212                 pic_object=
1213                 non_pic_object=
1214 
1215                 # Read the .lo file
1216                 # If there is no directory component, then add one.
1217                 case $arg in
1218                 */* | *\\*) . $arg ;;
1219                 *) . ./$arg ;;
1220                 esac
1221 
1222                 if test -z "$pic_object" || \
1223                    test -z "$non_pic_object" ||
1224                    test "$pic_object" = none && \
1225                    test "$non_pic_object" = none; then
1226                   $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1227                   exit $EXIT_FAILURE
1228                 fi
1229 
1230                 # Extract subdirectory from the argument.
1231                 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1232                 if test "X$xdir" = "X$arg"; then
1233                   xdir=
1234                 else
1235                   xdir="$xdir/"
1236                 fi
1237 
1238                 if test "$pic_object" != none; then
1239                   # Prepend the subdirectory the object is found in.
1240                   pic_object="$xdir$pic_object"
1241 
1242                   if test "$prev" = dlfiles; then
1243                     if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1244                       dlfiles="$dlfiles $pic_object"
1245                       prev=
1246                       continue
1247                     else
1248                       # If libtool objects are unsupported, then we need to preload.
1249                       prev=dlprefiles
1250                     fi
1251                   fi
1252 
1253                   # CHECK ME:  I think I busted this.  -Ossama
1254                   if test "$prev" = dlprefiles; then
1255                     # Preload the old-style object.
1256                     dlprefiles="$dlprefiles $pic_object"
1257                     prev=
1258                   fi
1259 
1260                   # A PIC object.
1261                   libobjs="$libobjs $pic_object"
1262                   arg="$pic_object"
1263                 fi
1264 
1265                 # Non-PIC object.
1266                 if test "$non_pic_object" != none; then
1267                   # Prepend the subdirectory the object is found in.
1268                   non_pic_object="$xdir$non_pic_object"
1269 
1270                   # A standard non-PIC object
1271                   non_pic_objects="$non_pic_objects $non_pic_object"
1272                   if test -z "$pic_object" || test "$pic_object" = none ; then
1273                     arg="$non_pic_object"
1274                   fi
1275                 fi
1276               else
1277                 # Only an error if not doing a dry-run.
1278                 if test -z "$run"; then
1279                   $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1280                   exit $EXIT_FAILURE
1281                 else
1282                   # Dry-run case.
1283 
1284                   # Extract subdirectory from the argument.
1285                   xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1286                   if test "X$xdir" = "X$arg"; then
1287                     xdir=
1288                   else
1289                     xdir="$xdir/"
1290                   fi
1291 
1292                   pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1293                   non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1294                   libobjs="$libobjs $pic_object"
1295                   non_pic_objects="$non_pic_objects $non_pic_object"
1296                 fi
1297               fi
1298             done
1299           else
1300             $echo "$modename: link input file \`$save_arg' does not exist"
1301             exit $EXIT_FAILURE
1302           fi
1303           arg=$save_arg
1304           prev=
1305           continue
1306           ;;
1307         rpath | xrpath)
1308           # We need an absolute path.
1309           case $arg in
1310           [\\/]* | [A-Za-z]:[\\/]*) ;;
1311           *)
1312             $echo "$modename: only absolute run-paths are allowed" 1>&2
1313             exit $EXIT_FAILURE
1314             ;;
1315           esac
1316           if test "$prev" = rpath; then
1317             case "$rpath " in
1318             *" $arg "*) ;;
1319             *) rpath="$rpath $arg" ;;
1320             esac
1321           else
1322             case "$xrpath " in
1323             *" $arg "*) ;;
1324             *) xrpath="$xrpath $arg" ;;
1325             esac
1326           fi
1327           prev=
1328           continue
1329           ;;
1330         xcompiler)
1331           compiler_flags="$compiler_flags $qarg"
1332           prev=
1333           compile_command="$compile_command $qarg"
1334           finalize_command="$finalize_command $qarg"
1335           continue
1336           ;;
1337         xlinker)
1338           linker_flags="$linker_flags $qarg"
1339           compiler_flags="$compiler_flags $wl$qarg"
1340           prev=
1341           compile_command="$compile_command $wl$qarg"
1342           finalize_command="$finalize_command $wl$qarg"
1343           continue
1344           ;;
1345         xcclinker)
1346           linker_flags="$linker_flags $qarg"
1347           compiler_flags="$compiler_flags $qarg"
1348           prev=
1349           compile_command="$compile_command $qarg"
1350           finalize_command="$finalize_command $qarg"
1351           continue
1352           ;;
1353         shrext)
1354           shrext_cmds="$arg"
1355           prev=
1356           continue
1357           ;;
1358         darwin_framework)
1359           compiler_flags="$compiler_flags $arg"
1360           compile_command="$compile_command $arg"
1361           finalize_command="$finalize_command $arg"
1362           prev=
1363           continue
1364           ;;
1365         *)
1366           eval "$prev=\"\$arg\""
1367           prev=
1368           continue
1369           ;;
1370         esac
1371       fi # test -n "$prev"
1372 
1373       prevarg="$arg"
1374 
1375       case $arg in
1376       -all-static)
1377         if test -n "$link_static_flag"; then
1378           compile_command="$compile_command $link_static_flag"
1379           finalize_command="$finalize_command $link_static_flag"
1380         fi
1381         continue
1382         ;;
1383 
1384       -allow-undefined)
1385         # FIXME: remove this flag sometime in the future.
1386         $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1387         continue
1388         ;;
1389 
1390       -avoid-version)
1391         avoid_version=yes
1392         continue
1393         ;;
1394 
1395       -dlopen)
1396         prev=dlfiles
1397         continue
1398         ;;
1399 
1400       -dlpreopen)
1401         prev=dlprefiles
1402         continue
1403         ;;
1404 
1405       -export-dynamic)
1406         export_dynamic=yes
1407         continue
1408         ;;
1409 
1410       -export-symbols | -export-symbols-regex)
1411         if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1412           $echo "$modename: more than one -exported-symbols argument is not allowed"
1413           exit $EXIT_FAILURE
1414         fi
1415         if test "X$arg" = "X-export-symbols"; then
1416           prev=expsyms
1417         else
1418           prev=expsyms_regex
1419         fi
1420         continue
1421         ;;
1422 
1423       -framework)
1424         prev=darwin_framework
1425         compiler_flags="$compiler_flags $arg"
1426         compile_command="$compile_command $arg"
1427         finalize_command="$finalize_command $arg"
1428         continue
1429         ;;
1430 
1431       -inst-prefix-dir)
1432         prev=inst_prefix
1433         continue
1434         ;;
1435 
1436       # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1437       # so, if we see these flags be careful not to treat them like -L
1438       -L[A-Z][A-Z]*:*)
1439         case $with_gcc/$host in
1440         no/*-*-irix* | /*-*-irix*)
1441           compile_command="$compile_command $arg"
1442           finalize_command="$finalize_command $arg"
1443           ;;
1444         esac
1445         continue
1446         ;;
1447 
1448       -L*)
1449         dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1450         # We need an absolute path.
1451         case $dir in
1452         [\\/]* | [A-Za-z]:[\\/]*) ;;
1453         *)
1454           absdir=`cd "$dir" && pwd`
1455           if test -z "$absdir"; then
1456             $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1457             exit $EXIT_FAILURE
1458           fi
1459           dir="$absdir"
1460           ;;
1461         esac
1462         case "$deplibs " in
1463         *" -L$dir "*) ;;
1464         *)
1465           deplibs="$deplibs -L$dir"
1466           lib_search_path="$lib_search_path $dir"
1467           ;;
1468         esac
1469         case $host in
1470         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1471           case :$dllsearchpath: in
1472           *":$dir:"*) ;;
1473           *) dllsearchpath="$dllsearchpath:$dir";;
1474           esac
1475           ;;
1476         esac
1477         continue
1478         ;;
1479 
1480       -l*)
1481         if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1482           case $host in
1483           *-*-cygwin* | *-*-pw32* | *-*-beos*)
1484             # These systems don't actually have a C or math library (as such)
1485             continue
1486             ;;
1487           *-*-mingw* | *-*-os2*)
1488             # These systems don't actually have a C library (as such)
1489             test "X$arg" = "X-lc" && continue
1490             ;;
1491           *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1492             # Do not include libc due to us having libc/libc_r.
1493             test "X$arg" = "X-lc" && continue
1494             ;;
1495           *-*-rhapsody* | *-*-darwin1.[012])
1496             # Rhapsody C and math libraries are in the System framework
1497             deplibs="$deplibs -framework System"
1498             continue
1499           esac
1500         elif test "X$arg" = "X-lc_r"; then
1501          case $host in
1502          *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1503            # Do not include libc_r directly, use -pthread flag.
1504            continue
1505            ;;
1506          esac
1507         fi
1508         deplibs="$deplibs $arg"
1509         continue
1510         ;;
1511 
1512       # Tru64 UNIX uses -model [arg] to determine the layout of C++
1513       # classes, name mangling, and exception handling.
1514       -model)
1515         compile_command="$compile_command $arg"
1516         compiler_flags="$compiler_flags $arg"
1517         finalize_command="$finalize_command $arg"
1518         prev=xcompiler
1519         continue
1520         ;;
1521 
1522      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1523         compiler_flags="$compiler_flags $arg"
1524         compile_command="$compile_command $arg"
1525         finalize_command="$finalize_command $arg"
1526         continue
1527         ;;
1528 
1529       -module)
1530         module=yes
1531         continue
1532         ;;
1533 
1534       # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1535       # -r[0-9][0-9]* specifies the processor on the SGI compiler
1536       # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1537       # +DA*, +DD* enable 64-bit mode on the HP compiler
1538       # -q* pass through compiler args for the IBM compiler
1539       # -m* pass through architecture-specific compiler args for GCC
1540       -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*)
1541 
1542         # Unknown arguments in both finalize_command and compile_command need
1543         # to be aesthetically quoted because they are evaled later.
1544         arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1545         case $arg in
1546         *$quote_scanset* | *]* | *\|* | *\&* | *\(* | *\)* | "")
1547           arg="\"$arg\""
1548           ;;
1549         esac
1550         compile_command="$compile_command $arg"
1551         finalize_command="$finalize_command $arg"
1552         if test "$with_gcc" = "yes" ; then
1553           compiler_flags="$compiler_flags $arg"
1554         fi
1555         continue
1556         ;;
1557 
1558       -shrext)
1559         prev=shrext
1560         continue
1561         ;;
1562 
1563       -no-fast-install)
1564         fast_install=no
1565         continue
1566         ;;
1567 
1568       -no-install)
1569         case $host in
1570         *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1571           # The PATH hackery in wrapper scripts is required on Windows
1572           # in order for the loader to find any dlls it needs.
1573           $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1574           $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1575           fast_install=no
1576           ;;
1577         *) no_install=yes ;;
1578         esac
1579         continue
1580         ;;
1581 
1582       -no-undefined)
1583         allow_undefined=no
1584         continue
1585         ;;
1586 
1587       -objectlist)
1588         prev=objectlist
1589         continue
1590         ;;
1591 
1592       -o) prev=output ;;
1593 
1594       -precious-files-regex)
1595         prev=precious_regex
1596         continue
1597         ;;
1598