/[svn]/ircd-hybrid-7.2/libltdl/ltmain.sh
ViewVC logotype

Annotation of /ircd-hybrid-7.2/libltdl/ltmain.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 912 - (hide annotations)
Wed Nov 7 22:47:44 2007 UTC (12 years, 9 months ago) by michael
File MIME type: application/x-shellscript
File size: 198965 byte(s)
- Implemented libtool-ltdl. Only shared modules are supported currently
- Several build fixes and cleanups. ircd now builds and runs without any problems
- Added back all files to SVN that are needed to built the daemon
  I really don't want to force other people that want to test the snapshots
  or svn versions to install yyacc, lex, automake, autoconf and libtool...
  No problem having required files in svn
- Removed some automake maintainer stuff which is kinda useless for us

1 michael 912 # 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 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.24
47     TIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)"
48    
49     # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50     if 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
57     else
58     case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
59     fi
60     BIN_SH=xpg4; export BIN_SH # for Tru64
61     DUALCASE=1; export DUALCASE # for MKS sh
62    
63     # Check that we have a working $echo.
64     if test "X$1" = X--no-reexec; then
65     # Discard the --no-reexec flag, and continue.
66     shift
67     elif test "X$1" = X--fallback-echo; then
68     # Avoid inline document here, it may be left over
69     :
70     elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
71     # Yippee, $echo works!
72     :
73     else
74     # Restart under the correct shell, and then maybe $echo will work.
75     exec $SHELL "$progpath" --no-reexec ${1+"$@"}
76     fi
77    
78     if test "X$1" = X--fallback-echo; then
79     # used as fallback echo
80     shift
81     cat <<EOF
82     $*
83     EOF
84     exit $EXIT_SUCCESS
85     fi
86    
87     default_mode=
88     help="Try \`$progname --help' for more information."
89     magic="%%%MAGIC variable%%%"
90     mkdir="mkdir"
91     mv="mv -f"
92     rm="rm -f"
93    
94     # Sed substitution that helps us do robust quoting. It backslashifies
95     # metacharacters that are still active within double-quoted strings.
96     Xsed="${SED}"' -e 1s/^X//'
97     sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
98     # test EBCDIC or ASCII
99     case `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     ;;
109     esac
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.
116     for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
117     do
118     eval "if test \"\${$lt_var+set}\" = set; then
119     save_$lt_var=\$$lt_var
120     $lt_var=C
121     export $lt_var
122     fi"
123     done
124    
125     # Make sure IFS has a sensible default
126     lt_nl='
127     '
128     IFS=" $lt_nl"
129    
130     if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
131     $echo "$modename: not configured to build any kind of library" 1>&2
132     $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
133     exit $EXIT_FAILURE
134     fi
135    
136     # Global variables.
137     mode=$default_mode
138     nonopt=
139     prev=
140     prevopt=
141     run=
142     show="$echo"
143     show_help=
144     execute_dlfiles=
145     duplicate_deps=no
146     preserve_args=
147     lo2o="s/\\.lo\$/.${objext}/"
148     o2lo="s/\\.${objext}\$/.lo/"
149     extracted_archives=
150     extracted_serial=0
151    
152     #####################################
153     # Shell function definitions:
154     # This seems to be the best place for them
155    
156     # func_mktempdir [string]
157     # Make a temporary directory that won't clash with other running
158     # libtool processes, and avoids race conditions if possible. If
159     # given, STRING is the basename for that directory.
160     func_mktempdir ()
161     {
162     my_template="${TMPDIR-/tmp}/${1-$progname}"
163    
164     if test "$run" = ":"; then
165     # Return a directory name, but don't create it in dry-run mode
166     my_tmpdir="${my_template}-$$"
167     else
168    
169     # If mktemp works, use that first and foremost
170     my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
171    
172     if test ! -d "$my_tmpdir"; then
173     # Failing that, at least try and use $RANDOM to avoid a race
174     my_tmpdir="${my_template}-${RANDOM-0}$$"
175    
176     save_mktempdir_umask=`umask`
177     umask 0077
178     $mkdir "$my_tmpdir"
179     umask $save_mktempdir_umask
180     fi
181    
182     # If we're not in dry-run mode, bomb out on failure
183     test -d "$my_tmpdir" || {
184     $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
185     exit $EXIT_FAILURE
186     }
187     fi
188    
189     $echo "X$my_tmpdir" | $Xsed
190     }
191    
192    
193     # func_win32_libid arg
194     # return the library type of file 'arg'
195     #
196     # Need a lot of goo to handle *both* DLLs and import libs
197     # Has to be a shell function in order to 'eat' the argument
198     # that is supplied when $file_magic_command is called.
199     func_win32_libid ()
200     {
201     win32_libid_type="unknown"
202     win32_fileres=`file -L $1 2>/dev/null`
203     case $win32_fileres in
204     *ar\ archive\ import\ library*) # definitely import
205     win32_libid_type="x86 archive import"
206     ;;
207     *ar\ archive*) # could be an import, or static
208     if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
209     $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
210     win32_nmres=`eval $NM -f posix -A $1 | \
211     $SED -n -e '1,100{
212     / I /{
213     s,.*,import,
214     p
215     q
216     }
217     }'`
218     case $win32_nmres in
219     import*) win32_libid_type="x86 archive import";;
220     *) win32_libid_type="x86 archive static";;
221     esac
222     fi
223     ;;
224     *DLL*)
225     win32_libid_type="x86 DLL"
226     ;;
227     *executable*) # but shell scripts are "executable" too...
228     case $win32_fileres in
229     *MS\ Windows\ PE\ Intel*)
230     win32_libid_type="x86 DLL"
231     ;;
232     esac
233     ;;
234     esac
235     $echo $win32_libid_type
236     }
237    
238    
239     # func_infer_tag arg
240     # Infer tagged configuration to use if any are available and
241     # if one wasn't chosen via the "--tag" command line option.
242     # Only attempt this if the compiler in the base compile
243     # command doesn't match the default compiler.
244     # arg is usually of the form 'gcc ...'
245     func_infer_tag ()
246     {
247     if test -n "$available_tags" && test -z "$tagname"; then
248     CC_quoted=
249     for arg in $CC; do
250     case $arg in
251     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
252     arg="\"$arg\""
253     ;;
254     esac
255     CC_quoted="$CC_quoted $arg"
256     done
257     case $@ in
258     # Blanks in the command may have been stripped by the calling shell,
259     # but not from the CC environment variable when configure was run.
260     " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
261     # Blanks at the start of $base_compile will cause this to fail
262     # if we don't check for them as well.
263     *)
264     for z in $available_tags; do
265     if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
266     # Evaluate the configuration.
267     eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
268     CC_quoted=
269     for arg in $CC; do
270     # Double-quote args containing other shell metacharacters.
271     case $arg in
272     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
273     arg="\"$arg\""
274     ;;
275     esac
276     CC_quoted="$CC_quoted $arg"
277     done
278     case "$@ " in
279     " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
280     # The compiler in the base compile command matches
281     # the one in the tagged configuration.
282     # Assume this is the tagged configuration we want.
283     tagname=$z
284     break
285     ;;
286     esac
287     fi
288     done
289     # If $tagname still isn't set, then no tagged configuration
290     # was found and let the user know that the "--tag" command
291     # line option must be used.
292     if test -z "$tagname"; then
293     $echo "$modename: unable to infer tagged configuration"
294     $echo "$modename: specify a tag with \`--tag'" 1>&2
295     exit $EXIT_FAILURE
296     # else
297     # $echo "$modename: using $tagname tagged configuration"
298     fi
299     ;;
300     esac
301     fi
302     }
303    
304    
305     # func_extract_an_archive dir oldlib
306     func_extract_an_archive ()
307     {
308     f_ex_an_ar_dir="$1"; shift
309     f_ex_an_ar_oldlib="$1"
310    
311     $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
312     $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
313     if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
314     :
315     else
316     $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
317     exit $EXIT_FAILURE
318     fi
319     }
320    
321     # func_extract_archives gentop oldlib ...
322     func_extract_archives ()
323     {
324     my_gentop="$1"; shift
325     my_oldlibs=${1+"$@"}
326     my_oldobjs=""
327     my_xlib=""
328     my_xabs=""
329     my_xdir=""
330     my_status=""
331    
332     $show "${rm}r $my_gentop"
333     $run ${rm}r "$my_gentop"
334     $show "$mkdir $my_gentop"
335     $run $mkdir "$my_gentop"
336     my_status=$?
337     if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
338     exit $my_status
339     fi
340    
341     for my_xlib in $my_oldlibs; do
342     # Extract the objects.
343     case $my_xlib in
344     [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
345     *) my_xabs=`pwd`"/$my_xlib" ;;
346     esac
347     my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
348     my_xlib_u=$my_xlib
349     while :; do
350     case " $extracted_archives " in
351     *" $my_xlib_u "*)
352     extracted_serial=`expr $extracted_serial + 1`
353     my_xlib_u=lt$extracted_serial-$my_xlib ;;
354     *) break ;;
355     esac
356     done
357     extracted_archives="$extracted_archives $my_xlib_u"
358     my_xdir="$my_gentop/$my_xlib_u"
359    
360     $show "${rm}r $my_xdir"
361     $run ${rm}r "$my_xdir"
362     $show "$mkdir $my_xdir"
363     $run $mkdir "$my_xdir"
364     exit_status=$?
365     if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
366     exit $exit_status
367     fi
368     case $host in
369     *-darwin*)
370     $show "Extracting $my_xabs"
371     # Do not bother doing anything if just a dry run
372     if test -z "$run"; then
373     darwin_orig_dir=`pwd`
374     cd $my_xdir || exit $?
375     darwin_archive=$my_xabs
376     darwin_curdir=`pwd`
377     darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
378     darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
379     if test -n "$darwin_arches"; then
380     darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
381     darwin_arch=
382     $show "$darwin_base_archive has multiple architectures $darwin_arches"
383     for darwin_arch in $darwin_arches ; do
384     mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
385     lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
386     cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
387     func_extract_an_archive "`pwd`" "${darwin_base_archive}"
388     cd "$darwin_curdir"
389     $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
390     done # $darwin_arches
391     ## Okay now we have a bunch of thin objects, gotta fatten them up :)
392     darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
393     darwin_file=
394     darwin_files=
395     for darwin_file in $darwin_filelist; do
396     darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
397     lipo -create -output "$darwin_file" $darwin_files
398     done # $darwin_filelist
399     ${rm}r unfat-$$
400     cd "$darwin_orig_dir"
401     else
402     cd "$darwin_orig_dir"
403     func_extract_an_archive "$my_xdir" "$my_xabs"
404     fi # $darwin_arches
405     fi # $run
406     ;;
407     *)
408     func_extract_an_archive "$my_xdir" "$my_xabs"
409     ;;
410     esac
411     my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
412     done
413     func_extract_archives_result="$my_oldobjs"
414     }
415     # End of Shell function definitions
416     #####################################
417    
418     # Darwin sucks
419     eval std_shrext=\"$shrext_cmds\"
420    
421     disable_libs=no
422    
423     # Parse our command line options once, thoroughly.
424     while test "$#" -gt 0
425     do
426     arg="$1"
427     shift
428    
429     case $arg in
430     -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
431     *) optarg= ;;
432     esac
433    
434     # If the previous option needs an argument, assign it.
435     if test -n "$prev"; then
436     case $prev in
437     execute_dlfiles)
438     execute_dlfiles="$execute_dlfiles $arg"
439     ;;
440     tag)
441     tagname="$arg"
442     preserve_args="${preserve_args}=$arg"
443    
444     # Check whether tagname contains only valid characters
445     case $tagname in
446     *[!-_A-Za-z0-9,/]*)
447     $echo "$progname: invalid tag name: $tagname" 1>&2
448     exit $EXIT_FAILURE
449     ;;
450     esac
451    
452     case $tagname in
453     CC)
454     # Don't test for the "default" C tag, as we know, it's there, but
455     # not specially marked.
456     ;;
457     *)
458     if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
459     taglist="$taglist $tagname"
460     # Evaluate the configuration.
461     eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
462     else
463     $echo "$progname: ignoring unknown tag $tagname" 1>&2
464     fi
465     ;;
466     esac
467     ;;
468     *)
469     eval "$prev=\$arg"
470     ;;
471     esac
472    
473     prev=
474     prevopt=
475     continue
476     fi
477    
478     # Have we seen a non-optional argument yet?
479     case $arg in
480     --help)
481     show_help=yes
482     ;;
483    
484     --version)
485     echo "\
486     $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
487    
488     Copyright (C) 2007 Free Software Foundation, Inc.
489     This is free software; see the source for copying conditions. There is NO
490     warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
491     exit $?
492     ;;
493    
494     --config)
495     ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
496     # Now print the configurations for the tags.
497     for tagname in $taglist; do
498     ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
499     done
500     exit $?
501     ;;
502    
503     --debug)
504     $echo "$progname: enabling shell trace mode"
505     set -x
506     preserve_args="$preserve_args $arg"
507     ;;
508    
509     --dry-run | -n)
510     run=:
511     ;;
512    
513     --features)
514     $echo "host: $host"
515     if test "$build_libtool_libs" = yes; then
516     $echo "enable shared libraries"
517     else
518     $echo "disable shared libraries"
519     fi
520     if test "$build_old_libs" = yes; then
521     $echo "enable static libraries"
522     else
523     $echo "disable static libraries"
524     fi
525     exit $?
526     ;;
527    
528     --finish) mode="finish" ;;
529    
530     --mode) prevopt="--mode" prev=mode ;;
531     --mode=*) mode="$optarg" ;;
532    
533     --preserve-dup-deps) duplicate_deps="yes" ;;
534    
535     --quiet | --silent)
536     show=:
537     preserve_args="$preserve_args $arg"
538     ;;
539    
540     --tag)
541     prevopt="--tag"
542     prev=tag
543     preserve_args="$preserve_args --tag"
544     ;;
545     --tag=*)
546     set tag "$optarg" ${1+"$@"}
547     shift
548     prev=tag
549     preserve_args="$preserve_args --tag"
550     ;;
551    
552     -dlopen)
553     prevopt="-dlopen"
554     prev=execute_dlfiles
555     ;;
556    
557     -*)
558     $echo "$modename: unrecognized option \`$arg'" 1>&2
559     $echo "$help" 1>&2
560     exit $EXIT_FAILURE
561     ;;
562    
563     *)
564     nonopt="$arg"
565     break
566     ;;
567     esac
568     done
569    
570     if test -n "$prevopt"; then
571     $echo "$modename: option \`$prevopt' requires an argument" 1>&2
572     $echo "$help" 1>&2
573     exit $EXIT_FAILURE
574     fi
575    
576     case $disable_libs in
577     no)
578     ;;
579     shared)
580     build_libtool_libs=no
581     build_old_libs=yes
582     ;;
583     static)
584     build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
585     ;;
586     esac
587    
588     # If this variable is set in any of the actions, the command in it
589     # will be execed at the end. This prevents here-documents from being
590     # left over by shells.
591     exec_cmd=
592    
593     if test -z "$show_help"; then
594    
595     # Infer the operation mode.
596     if test -z "$mode"; then
597     $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
598     $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
599     case $nonopt in
600     *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
601     mode=link
602     for arg
603     do
604     case $arg in
605     -c)
606     mode=compile
607     break
608     ;;
609     esac
610     done
611     ;;
612     *db | *dbx | *strace | *truss)
613     mode=execute
614     ;;
615     *install*|cp|mv)
616     mode=install
617     ;;
618     *rm)
619     mode=uninstall
620     ;;
621     *)
622     # If we have no mode, but dlfiles were specified, then do execute mode.
623     test -n "$execute_dlfiles" && mode=execute
624    
625     # Just use the default operation mode.
626     if test -z "$mode"; then
627     if test -n "$nonopt"; then
628     $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
629     else
630     $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
631     fi
632     fi
633     ;;
634     esac
635     fi
636    
637     # Only execute mode is allowed to have -dlopen flags.
638     if test -n "$execute_dlfiles" && test "$mode" != execute; then
639     $echo "$modename: unrecognized option \`-dlopen'" 1>&2
640     $echo "$help" 1>&2
641     exit $EXIT_FAILURE
642     fi
643    
644     # Change the help message to a mode-specific one.
645     generic_help="$help"
646     help="Try \`$modename --help --mode=$mode' for more information."
647    
648     # These modes are in order of execution frequency so that they run quickly.
649     case $mode in
650     # libtool compile mode
651     compile)
652     modename="$modename: compile"
653     # Get the compilation command and the source file.
654     base_compile=
655     srcfile="$nonopt" # always keep a non-empty value in "srcfile"
656     suppress_opt=yes
657     suppress_output=
658     arg_mode=normal
659     libobj=
660     later=
661    
662     for arg
663     do
664     case $arg_mode in
665     arg )
666     # do not "continue". Instead, add this to base_compile
667     lastarg="$arg"
668     arg_mode=normal
669     ;;
670    
671     target )
672     libobj="$arg"
673     arg_mode=normal
674     continue
675     ;;
676    
677     normal )
678     # Accept any command-line options.
679     case $arg in
680     -o)
681     if test -n "$libobj" ; then
682     $echo "$modename: you cannot specify \`-o' more than once" 1>&2
683     exit $EXIT_FAILURE
684     fi
685     arg_mode=target
686     continue
687     ;;
688    
689     -static | -prefer-pic | -prefer-non-pic)
690     later="$later $arg"
691     continue
692     ;;
693    
694     -no-suppress)
695     suppress_opt=no
696     continue
697     ;;
698    
699     -Xcompiler)
700     arg_mode=arg # the next one goes into the "base_compile" arg list
701     continue # The current "srcfile" will either be retained or
702     ;; # replaced later. I would guess that would be a bug.
703    
704     -Wc,*)
705     args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
706     lastarg=
707     save_ifs="$IFS"; IFS=','
708     for arg in $args; do
709     IFS="$save_ifs"
710    
711     # Double-quote args containing other shell metacharacters.
712     # Many Bourne shells cannot handle close brackets correctly
713     # in scan sets, so we specify it separately.
714     case $arg in
715     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
716     arg="\"$arg\""
717     ;;
718     esac
719     lastarg="$lastarg $arg"
720     done
721     IFS="$save_ifs"
722     lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
723    
724     # Add the arguments to base_compile.
725     base_compile="$base_compile $lastarg"
726     continue
727     ;;
728    
729     * )
730     # Accept the current argument as the source file.
731     # The previous "srcfile" becomes the current argument.
732     #
733     lastarg="$srcfile"
734     srcfile="$arg"
735     ;;
736     esac # case $arg
737     ;;
738     esac # case $arg_mode
739    
740     # Aesthetically quote the previous argument.
741     lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
742    
743     case $lastarg in
744     # Double-quote args containing other shell metacharacters.
745     # Many Bourne shells cannot handle close brackets correctly
746     # in scan sets, and some SunOS ksh mistreat backslash-escaping
747     # in scan sets (worked around with variable expansion),
748     # and furthermore cannot handle '|' '&' '(' ')' in scan sets
749     # at all, so we specify them separately.
750     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
751     lastarg="\"$lastarg\""
752     ;;
753     esac
754    
755     base_compile="$base_compile $lastarg"
756     done # for arg
757    
758     case $arg_mode in
759     arg)
760     $echo "$modename: you must specify an argument for -Xcompile"
761     exit $EXIT_FAILURE
762     ;;
763     target)
764     $echo "$modename: you must specify a target with \`-o'" 1>&2
765     exit $EXIT_FAILURE
766     ;;
767     *)
768     # Get the name of the library object.
769     [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
770     ;;
771     esac
772    
773     # Recognize several different file suffixes.
774     # If the user specifies -o file.o, it is replaced with file.lo
775     xform='[cCFSifmso]'
776     case $libobj in
777     *.ada) xform=ada ;;
778     *.adb) xform=adb ;;
779     *.ads) xform=ads ;;
780     *.asm) xform=asm ;;
781     *.c++) xform=c++ ;;
782     *.cc) xform=cc ;;
783     *.ii) xform=ii ;;
784     *.class) xform=class ;;
785     *.cpp) xform=cpp ;;
786     *.cxx) xform=cxx ;;
787     *.[fF][09]?) xform=[fF][09]. ;;
788     *.for) xform=for ;;
789     *.java) xform=java ;;
790     *.obj) xform=obj ;;
791     esac
792    
793     libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
794    
795     case $libobj in
796     *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
797     *)
798     $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
799     exit $EXIT_FAILURE
800     ;;
801     esac
802    
803     func_infer_tag $base_compile
804    
805     for arg in $later; do
806     case $arg in
807     -static)
808     build_old_libs=yes
809     continue
810     ;;
811    
812     -prefer-pic)
813     pic_mode=yes
814     continue
815     ;;
816    
817     -prefer-non-pic)
818     pic_mode=no
819     continue
820     ;;
821     esac
822     done
823    
824     qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
825     case $qlibobj in
826     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
827     qlibobj="\"$qlibobj\"" ;;
828     esac
829     test "X$libobj" != "X$qlibobj" \
830     && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
831     && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
832     objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
833     xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
834     if test "X$xdir" = "X$obj"; then
835     xdir=
836     else
837     xdir=$xdir/
838     fi
839     lobj=${xdir}$objdir/$objname
840    
841     if test -z "$base_compile"; then
842     $echo "$modename: you must specify a compilation command" 1>&2
843     $echo "$help" 1>&2
844     exit $EXIT_FAILURE
845     fi
846    
847     # Delete any leftover library objects.
848     if test "$build_old_libs" = yes; then
849     removelist="$obj $lobj $libobj ${libobj}T"
850     else
851     removelist="$lobj $libobj ${libobj}T"
852     fi
853    
854     $run $rm $removelist
855     trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
856    
857     # On Cygwin there's no "real" PIC flag so we must build both object types
858     case $host_os in
859     cygwin* | mingw* | pw32* | os2*)
860     pic_mode=default
861     ;;
862     esac
863     if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
864     # non-PIC code in shared libraries is not supported
865     pic_mode=default
866     fi
867    
868     # Calculate the filename of the output object if compiler does
869     # not support -o with -c
870     if test "$compiler_c_o" = no; then
871     output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
872     lockfile="$output_obj.lock"
873     removelist="$removelist $output_obj $lockfile"
874     trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
875     else
876     output_obj=
877     need_locks=no
878     lockfile=
879     fi
880    
881     # Lock this critical section if it is needed
882     # We use this script file to make the link, it avoids creating a new file
883     if test "$need_locks" = yes; then
884     until $run ln "$progpath" "$lockfile" 2>/dev/null; do
885     $show "Waiting for $lockfile to be removed"
886     sleep 2
887     done
888     elif test "$need_locks" = warn; then
889     if test -f "$lockfile"; then
890     $echo "\
891     *** ERROR, $lockfile exists and contains:
892     `cat $lockfile 2>/dev/null`
893    
894     This indicates that another process is trying to use the same
895     temporary object file, and libtool could not work around it because
896     your compiler does not support \`-c' and \`-o' together. If you
897     repeat this compilation, it may succeed, by chance, but you had better
898     avoid parallel builds (make -j) in this platform, or get a better
899     compiler."
900    
901     $run $rm $removelist
902     exit $EXIT_FAILURE
903     fi
904     $echo "$srcfile" > "$lockfile"
905     fi
906    
907     if test -n "$fix_srcfile_path"; then
908     eval srcfile=\"$fix_srcfile_path\"
909     fi
910     qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
911     case $qsrcfile in
912     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
913     qsrcfile="\"$qsrcfile\"" ;;
914     esac
915    
916     $run $rm "$libobj" "${libobj}T"
917    
918     # Create a libtool object file (analogous to a ".la" file),
919     # but don't create it if we're doing a dry run.
920     test -z "$run" && cat > ${libobj}T <<EOF
921     # $libobj - a libtool object file
922     # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
923     #
924     # Please DO NOT delete this file!
925     # It is necessary for linking the library.
926    
927     # Name of the PIC object.
928     EOF
929    
930     # Only build a PIC object if we are building libtool libraries.
931     if test "$build_libtool_libs" = yes; then
932     # Without this assignment, base_compile gets emptied.
933     fbsd_hideous_sh_bug=$base_compile
934    
935     if test "$pic_mode" != no; then
936     command="$base_compile $qsrcfile $pic_flag"
937     else
938     # Don't build PIC code
939     command="$base_compile $qsrcfile"
940     fi
941    
942     if test ! -d "${xdir}$objdir"; then
943     $show "$mkdir ${xdir}$objdir"
944     $run $mkdir ${xdir}$objdir
945     exit_status=$?
946     if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
947     exit $exit_status
948     fi
949     fi
950    
951     if test -z "$output_obj"; then
952     # Place PIC objects in $objdir
953     command="$command -o $lobj"
954     fi
955    
956     $run $rm "$lobj" "$output_obj"
957    
958     $show "$command"
959     if $run eval "$command"; then :
960     else
961     test -n "$output_obj" && $run $rm $removelist
962     exit $EXIT_FAILURE
963     fi
964    
965     if test "$need_locks" = warn &&
966     test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
967     $echo "\
968     *** ERROR, $lockfile contains:
969     `cat $lockfile 2>/dev/null`
970    
971     but it should contain:
972     $srcfile
973    
974     This indicates that another process is trying to use the same
975     temporary object file, and libtool could not work around it because
976     your compiler does not support \`-c' and \`-o' together. If you
977     repeat this compilation, it may succeed, by chance, but you had better
978     avoid parallel builds (make -j) in this platform, or get a better
979     compiler."
980    
981     $run $rm $removelist
982     exit $EXIT_FAILURE
983     fi
984    
985     # Just move the object if needed, then go on to compile the next one
986     if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
987     $show "$mv $output_obj $lobj"
988     if $run $mv $output_obj $lobj; then :
989     else
990     error=$?
991     $run $rm $removelist
992     exit $error
993     fi
994     fi
995    
996     # Append the name of the PIC object to the libtool object file.
997     test -z "$run" && cat >> ${libobj}T <<EOF
998     pic_object='$objdir/$objname'
999    
1000     EOF
1001    
1002     # Allow error messages only from the first compilation.
1003     if test "$suppress_opt" = yes; then
1004     suppress_output=' >/dev/null 2>&1'
1005     fi
1006     else
1007     # No PIC object so indicate it doesn't exist in the libtool
1008     # object file.
1009     test -z "$run" && cat >> ${libobj}T <<EOF
1010     pic_object=none
1011    
1012     EOF
1013     fi
1014    
1015     # Only build a position-dependent object if we build old libraries.
1016     if test "$build_old_libs" = yes; then
1017     if test "$pic_mode" != yes; then
1018     # Don't build PIC code
1019     command="$base_compile $qsrcfile"
1020     else
1021     command="$base_compile $qsrcfile $pic_flag"
1022     fi
1023     if test "$compiler_c_o" = yes; then
1024     command="$command -o $obj"
1025     fi
1026    
1027     # Suppress compiler output if we already did a PIC compilation.
1028     command="$command$suppress_output"
1029     $run $rm "$obj" "$output_obj"
1030     $show "$command"
1031     if $run eval "$command"; then :
1032     else
1033     $run $rm $removelist
1034     exit $EXIT_FAILURE
1035     fi
1036    
1037     if test "$need_locks" = warn &&
1038     test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1039     $echo "\
1040     *** ERROR, $lockfile contains:
1041     `cat $lockfile 2>/dev/null`
1042    
1043     but it should contain:
1044     $srcfile
1045    
1046     This indicates that another process is trying to use the same
1047     temporary object file, and libtool could not work around it because
1048     your compiler does not support \`-c' and \`-o' together. If you
1049     repeat this compilation, it may succeed, by chance, but you had better
1050     avoid parallel builds (make -j) in this platform, or get a better
1051     compiler."
1052    
1053     $run $rm $removelist
1054     exit $EXIT_FAILURE
1055     fi
1056    
1057     # Just move the object if needed
1058     if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1059     $show "$mv $output_obj $obj"
1060     if $run $mv $output_obj $obj; then :
1061     else
1062     error=$?
1063     $run $rm $removelist
1064     exit $error
1065     fi
1066     fi
1067    
1068     # Append the name of the non-PIC object the libtool object file.
1069     # Only append if the libtool object file exists.
1070     test -z "$run" && cat >> ${libobj}T <<EOF
1071     # Name of the non-PIC object.
1072     non_pic_object='$objname'
1073    
1074     EOF
1075     else
1076     # Append the name of the non-PIC object the libtool object file.
1077     # Only append if the libtool object file exists.
1078     test -z "$run" && cat >> ${libobj}T <<EOF
1079     # Name of the non-PIC object.
1080     non_pic_object=none
1081    
1082     EOF
1083     fi
1084    
1085     $run $mv "${libobj}T" "${libobj}"
1086    
1087     # Unlock the critical section if it was locked
1088     if test "$need_locks" != no; then
1089     $run $rm "$lockfile"
1090     fi
1091    
1092     exit $EXIT_SUCCESS
1093     ;;
1094    
1095     # libtool link mode
1096     link | relink)
1097     modename="$modename: link"
1098     case $host in
1099     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1100     # It is impossible to link a dll without this setting, and
1101     # we shouldn't force the makefile maintainer to figure out
1102     # which system we are compiling for in order to pass an extra
1103     # flag for every libtool invocation.
1104     # allow_undefined=no
1105    
1106     # FIXME: Unfortunately, there are problems with the above when trying
1107     # to make a dll which has undefined symbols, in which case not
1108     # even a static library is built. For now, we need to specify
1109     # -no-undefined on the libtool link line when we can be certain
1110     # that all symbols are satisfied, otherwise we get a static library.
1111     allow_undefined=yes
1112     ;;
1113     *)
1114     allow_undefined=yes
1115     ;;
1116     esac
1117     libtool_args="$nonopt"
1118     base_compile="$nonopt $@"
1119     compile_command="$nonopt"
1120     finalize_command="$nonopt"
1121    
1122     compile_rpath=
1123     finalize_rpath=
1124     compile_shlibpath=
1125     finalize_shlibpath=
1126     convenience=
1127     old_convenience=
1128     deplibs=
1129     old_deplibs=
1130     compiler_flags=
1131     linker_flags=
1132     dllsearchpath=
1133     lib_search_path=`pwd`
1134     inst_prefix_dir=
1135    
1136     avoid_version=no
1137     dlfiles=
1138     dlprefiles=
1139     dlself=no
1140     export_dynamic=no
1141     export_symbols=
1142     export_symbols_regex=
1143     generated=
1144     libobjs=
1145     ltlibs=
1146     module=no
1147     no_install=no
1148     objs=
1149     non_pic_objects=
1150     notinst_path= # paths that contain not-installed libtool libraries
1151     precious_files_regex=
1152     prefer_static_libs=no
1153     preload=no
1154     prev=
1155     prevarg=
1156     release=
1157     rpath=
1158     xrpath=
1159     perm_rpath=
1160     temp_rpath=
1161     thread_safe=no
1162     vinfo=
1163     vinfo_number=no
1164    
1165     func_infer_tag $base_compile
1166    
1167     # We need to know -static, to get the right output filenames.
1168     for arg
1169     do
1170     case $arg in
1171     -all-static | -static | -static-libtool-libs)
1172     case $arg in
1173     -all-static)
1174     if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1175     $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1176     fi
1177     if test -n "$link_static_flag"; then
1178     dlopen_self=$dlopen_self_static
1179     fi
1180     prefer_static_libs=yes
1181     ;;
1182     -static)
1183     if test -z "$pic_flag" && test -n "$link_static_flag"; then
1184     dlopen_self=$dlopen_self_static
1185     fi
1186     prefer_static_libs=built
1187     ;;
1188     -static-libtool-libs)
1189     if test -z "$pic_flag" && test -n "$link_static_flag"; then
1190     dlopen_self=$dlopen_self_static
1191     fi
1192     prefer_static_libs=yes
1193     ;;
1194     esac
1195     build_libtool_libs=no
1196     build_old_libs=yes
1197     break
1198     ;;
1199     esac
1200     done
1201    
1202     # See if our shared archives depend on static archives.
1203     test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1204    
1205     # Go through the arguments, transforming them on the way.
1206     while test "$#" -gt 0; do
1207     arg="$1"
1208     shift
1209     case $arg in
1210     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1211     qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1212     ;;
1213     *) qarg=$arg ;;
1214     esac
1215     libtool_args="$libtool_args $qarg"
1216    
1217     # If the previous option needs an argument, assign it.
1218     if test -n "$prev"; then
1219     case $prev in
1220     output)
1221     compile_command="$compile_command @OUTPUT@"
1222     finalize_command="$finalize_command @OUTPUT@"
1223     ;;
1224     esac
1225    
1226     case $prev in
1227     dlfiles|dlprefiles)
1228     if test "$preload" = no; then
1229     # Add the symbol object into the linking commands.
1230     compile_command="$compile_command @SYMFILE@"
1231     finalize_command="$finalize_command @SYMFILE@"
1232     preload=yes
1233     fi
1234     case $arg in
1235     *.la | *.lo) ;; # We handle these cases below.
1236     force)
1237     if test "$dlself" = no; then
1238     dlself=needless
1239     export_dynamic=yes
1240     fi
1241     prev=
1242     continue
1243     ;;
1244     self)
1245     if test "$prev" = dlprefiles; then
1246     dlself=yes
1247     elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1248     dlself=yes
1249     else
1250     dlself=needless
1251     export_dynamic=yes
1252     fi
1253     prev=
1254     continue
1255     ;;
1256     *)
1257     if test "$prev" = dlfiles; then
1258     dlfiles="$dlfiles $arg"
1259     else
1260     dlprefiles="$dlprefiles $arg"
1261     fi
1262     prev=
1263     continue
1264     ;;
1265     esac
1266     ;;
1267     expsyms)
1268     export_symbols="$arg"
1269     if test ! -f "$arg"; then
1270     $echo "$modename: symbol file \`$arg' does not exist"
1271     exit $EXIT_FAILURE
1272     fi
1273     prev=
1274     continue
1275     ;;
1276     expsyms_regex)
1277     export_symbols_regex="$arg"
1278     prev=
1279     continue
1280     ;;
1281     inst_prefix)
1282     inst_prefix_dir="$arg"
1283     prev=
1284     continue
1285     ;;
1286     precious_regex)
1287     precious_files_regex="$arg"
1288     prev=
1289     continue
1290     ;;
1291     release)
1292     release="-$arg"
1293     prev=
1294     continue
1295     ;;
1296     objectlist)
1297     if test -f "$arg"; then
1298     save_arg=$arg
1299     moreargs=
1300     for fil in `cat $save_arg`
1301     do
1302     # moreargs="$moreargs $fil"
1303     arg=$fil
1304     # A libtool-controlled object.
1305    
1306     # Check to see that this really is a libtool object.
1307     if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1308     pic_object=
1309     non_pic_object=
1310    
1311     # Read the .lo file
1312     # If there is no directory component, then add one.
1313     case $arg in
1314     */* | *\\*) . $arg ;;
1315     *) . ./$arg ;;
1316     esac
1317    
1318     if test -z "$pic_object" || \
1319     test -z "$non_pic_object" ||
1320     test "$pic_object" = none && \
1321     test "$non_pic_object" = none; then
1322     $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1323     exit $EXIT_FAILURE
1324     fi
1325    
1326     # Extract subdirectory from the argument.
1327     xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1328     if test "X$xdir" = "X$arg"; then
1329     xdir=
1330     else
1331     xdir="$xdir/"
1332     fi
1333    
1334     if test "$pic_object" != none; then
1335     # Prepend the subdirectory the object is found in.
1336     pic_object="$xdir$pic_object"
1337    
1338     if test "$prev" = dlfiles; then
1339     if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1340     dlfiles="$dlfiles $pic_object"
1341     prev=
1342     continue
1343     else
1344     # If libtool objects are unsupported, then we need to preload.
1345     prev=dlprefiles
1346     fi
1347     fi
1348    
1349     # CHECK ME: I think I busted this. -Ossama
1350     if test "$prev" = dlprefiles; then
1351     # Preload the old-style object.
1352     dlprefiles="$dlprefiles $pic_object"
1353     prev=
1354     fi
1355    
1356     # A PIC object.
1357     libobjs="$libobjs $pic_object"
1358     arg="$pic_object"
1359     fi
1360    
1361     # Non-PIC object.
1362     if test "$non_pic_object" != none; then
1363     # Prepend the subdirectory the object is found in.
1364     non_pic_object="$xdir$non_pic_object"
1365    
1366     # A standard non-PIC object
1367     non_pic_objects="$non_pic_objects $non_pic_object"
1368     if test -z "$pic_object" || test "$pic_object" = none ; then
1369     arg="$non_pic_object"
1370     fi
1371     else
1372     # If the PIC object exists, use it instead.
1373     # $xdir was prepended to $pic_object above.
1374     non_pic_object="$pic_object"
1375     non_pic_objects="$non_pic_objects $non_pic_object"
1376     fi
1377     else
1378     # Only an error if not doing a dry-run.
1379     if test -z "$run"; then
1380     $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1381     exit $EXIT_FAILURE
1382     else
1383     # Dry-run case.
1384    
1385     # Extract subdirectory from the argument.
1386     xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1387     if test "X$xdir" = "X$arg"; then
1388     xdir=
1389     else
1390     xdir="$xdir/"
1391     fi
1392    
1393     pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1394     non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1395     libobjs="$libobjs $pic_object"
1396     non_pic_objects="$non_pic_objects $non_pic_object"
1397     fi
1398     fi
1399     done
1400     else
1401     $echo "$modename: link input file \`$save_arg' does not exist"
1402     exit $EXIT_FAILURE
1403     fi
1404     arg=$save_arg
1405     prev=
1406     continue
1407     ;;
1408     rpath | xrpath)
1409     # We need an absolute path.
1410     case $arg in
1411     [\\/]* | [A-Za-z]:[\\/]*) ;;
1412     *)
1413     $echo "$modename: only absolute run-paths are allowed" 1>&2
1414     exit $EXIT_FAILURE
1415     ;;
1416     esac
1417     if test "$prev" = rpath; then
1418     case "$rpath " in
1419     *" $arg "*) ;;
1420     *) rpath="$rpath $arg" ;;
1421     esac
1422     else
1423     case "$xrpath " in
1424     *" $arg "*) ;;
1425     *) xrpath="$xrpath $arg" ;;
1426     esac
1427     fi
1428     prev=
1429     continue
1430     ;;
1431     xcompiler)
1432     compiler_flags="$compiler_flags $qarg"
1433     prev=
1434     compile_command="$compile_command $qarg"
1435     finalize_command="$finalize_command $qarg"
1436     continue
1437     ;;
1438     xlinker)
1439     linker_flags="$linker_flags $qarg"
1440     compiler_flags="$compiler_flags $wl$qarg"
1441     prev=
1442     compile_command="$compile_command $wl$qarg"
1443     finalize_command="$finalize_command $wl$qarg"
1444     continue
1445     ;;
1446     xcclinker)
1447     linker_flags="$linker_flags $qarg"
1448     compiler_flags="$compiler_flags $qarg"
1449     prev=
1450     compile_command="$compile_command $qarg"
1451     finalize_command="$finalize_command $qarg"
1452     continue
1453     ;;
1454     shrext)
1455     shrext_cmds="$arg"
1456     prev=
1457     continue
1458     ;;
1459     darwin_framework|darwin_framework_skip)
1460     test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1461     compile_command="$compile_command $arg"
1462     finalize_command="$finalize_command $arg"
1463     prev=
1464     continue
1465     ;;
1466     *)
1467     eval "$prev=\"\$arg\""
1468     prev=
1469     continue
1470     ;;
1471     esac
1472     fi # test -n "$prev"
1473    
1474     prevarg="$arg"
1475    
1476     case $arg in
1477     -all-static)
1478     if test -n "$link_static_flag"; then
1479     compile_command="$compile_command $link_static_flag"
1480     finalize_command="$finalize_command $link_static_flag"
1481     fi
1482     continue
1483     ;;
1484    
1485     -allow-undefined)
1486     # FIXME: remove this flag sometime in the future.
1487     $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1488     continue
1489     ;;
1490    
1491     -avoid-version)
1492     avoid_version=yes
1493     continue
1494     ;;
1495    
1496     -dlopen)
1497     prev=dlfiles
1498     continue
1499     ;;
1500    
1501     -dlpreopen)
1502     prev=dlprefiles
1503     continue
1504     ;;
1505    
1506     -export-dynamic)
1507     export_dynamic=yes
1508     continue
1509     ;;
1510    
1511     -export-symbols | -export-symbols-regex)
1512     if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1513     $echo "$modename: more than one -exported-symbols argument is not allowed"
1514     exit $EXIT_FAILURE
1515     fi
1516     if test "X$arg" = "X-export-symbols"; then
1517     prev=expsyms
1518     else
1519     prev=expsyms_regex
1520     fi
1521     continue
1522     ;;
1523    
1524     -framework|-arch|-isysroot)
1525     case " $CC " in
1526     *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1527     prev=darwin_framework_skip ;;
1528     *) compiler_flags="$compiler_flags $arg"
1529     prev=darwin_framework ;;
1530     esac
1531     compile_command="$compile_command $arg"
1532     finalize_command="$finalize_command $arg"
1533     continue
1534     ;;
1535    
1536     -inst-prefix-dir)
1537     prev=inst_prefix
1538     continue
1539     ;;
1540    
1541     # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1542     # so, if we see these flags be careful not to treat them like -L
1543     -L[A-Z][A-Z]*:*)
1544     case $with_gcc/$host in
1545     no/*-*-irix* | /*-*-irix*)
1546     compile_command="$compile_command $arg"
1547     finalize_command="$finalize_command $arg"
1548     ;;
1549     esac
1550     continue
1551     ;;
1552    
1553     -L*)
1554     dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1555     # We need an absolute path.
1556     case $dir in
1557     [\\/]* | [A-Za-z]:[\\/]*) ;;
1558     *)
1559     absdir=`cd "$dir" && pwd`
1560     if test -z "$absdir"; then
1561     $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1562     absdir="$dir"
1563     notinst_path="$notinst_path $dir"
1564     fi
1565     dir="$absdir"
1566     ;;
1567     esac
1568     case "$deplibs " in
1569     *" -L$dir "*) ;;
1570     *)
1571     deplibs="$deplibs -L$dir"
1572     lib_search_path="$lib_search_path $dir"
1573     ;;
1574     esac
1575     case $host in
1576     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1577     testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1578     case :$dllsearchpath: in
1579     *":$dir:"*) ;;
1580     *) dllsearchpath="$dllsearchpath:$dir";;
1581     esac
1582     case :$dllsearchpath: in
1583     *":$testbindir:"*) ;;
1584     *) dllsearchpath="$dllsearchpath:$testbindir";;
1585     esac
1586     ;;
1587     esac
1588     continue
1589     ;;
1590    
1591     -l*)
1592     if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1593     case $host in
1594     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1595     # These systems don't actually have a C or math library (as such)
1596     continue
1597     ;;
1598     *-*-os2*)
1599     # These systems don't actually have a C library (as such)
1600     test "X$arg" = "X-lc" && continue
1601     ;;
1602     *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1603     # Do not include libc due to us having libc/libc_r.
1604     test "X$arg" = "X-lc" && continue
1605     ;;
1606     *-*-rhapsody* | *-*-darwin1.[012])
1607     # Rhapsody C and math libraries are in the System framework
1608     deplibs="$deplibs -framework System"
1609     continue
1610     ;;
1611     *-*-sco3.2v5* | *-*-sco5v6*)
1612     # Causes problems with __ctype
1613     test "X$arg" = "X-lc" && continue
1614     ;;
1615     *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1616     # Compiler inserts libc in the correct place for threads to work
1617     test "X$arg" = "X-lc" && continue
1618     ;;
1619     esac
1620     elif test "X$arg" = "X-lc_r"; then
1621     case $host in
1622     *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1623     # Do not include libc_r directly, use -pthread flag.
1624     continue
1625     ;;
1626     esac
1627     fi
1628     deplibs="$deplibs $arg"
1629     continue
1630     ;;
1631    
1632     # Tru64 UNIX uses -model [arg] to determine the layout of C++
1633     # classes, name mangling, and exception handling.
1634     -model)
1635     compile_command="$compile_command $arg"
1636     compiler_flags="$compiler_flags $arg"
1637     finalize_command="$finalize_command $arg"
1638     prev=xcompiler
1639     continue
1640     ;;
1641    
1642     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
1643     compiler_flags="$compiler_flags $arg"
1644     compile_command="$compile_command $arg"
1645     finalize_command="$finalize_command $arg"
1646     continue
1647     ;;
1648    
1649     -module)
1650     module=yes
1651     continue
1652     ;;
1653    
1654     # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1655     # -r[0-9][0-9]* specifies the processor on the SGI compiler
1656     # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1657     # +DA*, +DD* enable 64-bit mode on the HP compiler
1658     # -q* pass through compiler args for the IBM compiler
1659     # -m* pass through architecture-specific compiler args for GCC
1660     # -m*, -t[45]*, -txscale* pass through architecture-specific
1661     # compiler args for GCC
1662     # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
1663     # -F/path gives path to uninstalled frameworks, gcc on darwin
1664     # @file GCC response files
1665     -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
1666     -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
1667    
1668     # Unknown arguments in both finalize_command and compile_command need
1669     # to be aesthetically quoted because they are evaled later.
1670     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1671     case $arg in
1672     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1673     arg="\"$arg\""
1674     ;;
1675     esac
1676     compile_command="$compile_command $arg"
1677     finalize_command="$finalize_command $arg"
1678     compiler_flags="$compiler_flags $arg"
1679     continue
1680     ;;
1681    
1682     -shrext)
1683     prev=shrext
1684     continue
1685     ;;
1686    
1687     -no-fast-install)
1688     fast_install=no
1689     continue
1690     ;;
1691    
1692     -no-install)
1693     case $host in
1694     *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
1695     # The PATH hackery in wrapper scripts is required on Windows
1696     # and Darwin in order for the loader to find any dlls it needs.
1697     $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1698     $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1699     fast_install=no
1700     ;;
1701     *) no_install=yes ;;
1702     esac
1703     continue
1704     ;;
1705    
1706     -no-undefined)
1707     allow_undefined=no
1708     continue
1709     ;;
1710    
1711     -objectlist)
1712     prev=objectlist
1713     continue
1714     ;;
1715    
1716     -o) prev=output ;;
1717    
1718     -precious-files-regex)
1719     prev=precious_regex
1720     continue
1721     ;;
1722    
1723     -release)
1724     prev=release
1725     continue
1726     ;;
1727    
1728     -rpath)
1729     prev=rpath
1730     continue
1731     ;;
1732    
1733     -R)
1734     prev=xrpath
1735     continue
1736     ;;
1737    
1738     -R*)
1739     dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1740     # We need an absolute path.
1741     case $dir in
1742     [\\/]* | [A-Za-z]:[\\/]*) ;;
1743     *)
1744     $echo "$modename: only absolute run-paths are allowed" 1>&2
1745     exit $EXIT_FAILURE
1746     ;;
1747     esac
1748     case "$xrpath " in
1749     *" $dir "*) ;;
1750     *) xrpath="$xrpath $dir" ;;
1751     esac
1752     continue
1753     ;;
1754    
1755     -static | -static-libtool-libs)
1756     # The effects of -static are defined in a previous loop.
1757     # We used to do the same as -all-static on platforms that
1758     # didn't have a PIC flag, but the assumption that the effects
1759     # would be equivalent was wrong. It would break on at least
1760     # Digital Unix and AIX.
1761     continue
1762     ;;
1763    
1764     -thread-safe)
1765     thread_safe=yes
1766     continue
1767     ;;
1768    
1769     -version-info)
1770     prev=vinfo
1771     continue
1772     ;;
1773     -version-number)
1774     prev=vinfo
1775     vinfo_number=yes
1776     continue
1777     ;;
1778    
1779     -Wc,*)
1780     args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1781     arg=
1782     save_ifs="$IFS"; IFS=','
1783     for flag in $args; do
1784     IFS="$save_ifs"
1785     case $flag in
1786     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1787     flag="\"$flag\""
1788     ;;
1789     esac
1790     arg="$arg $wl$flag"
1791     compiler_flags="$compiler_flags $flag"
1792     done
1793     IFS="$save_ifs"
1794     arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1795     ;;
1796    
1797     -Wl,*)
1798     args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1799     arg=
1800     save_ifs="$IFS"; IFS=','
1801     for flag in $args; do
1802     IFS="$save_ifs"
1803     case $flag in
1804     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1805     flag="\"$flag\""
1806     ;;
1807     esac
1808     arg="$arg $wl$flag"
1809     compiler_flags="$compiler_flags $wl$flag"
1810     linker_flags="$linker_flags $flag"
1811     done
1812     IFS="$save_ifs"
1813     arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1814     ;;
1815    
1816     -Xcompiler)
1817     prev=xcompiler
1818     continue
1819     ;;
1820    
1821     -Xlinker)
1822     prev=xlinker
1823     continue
1824     ;;
1825    
1826     -XCClinker)
1827     prev=xcclinker
1828     continue
1829     ;;
1830    
1831     # Some other compiler flag.
1832     -* | +*)
1833     # Unknown arguments in both finalize_command and compile_command need
1834     # to be aesthetically quoted because they are evaled later.
1835     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1836     case $arg in
1837     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1838     arg="\"$arg\""
1839     ;;
1840     esac
1841     ;;
1842    
1843     *.$objext)
1844     # A standard object.
1845     objs="$objs $arg"
1846     ;;
1847    
1848     *.lo)
1849     # A libtool-controlled object.
1850    
1851     # Check to see that this really is a libtool object.
1852     if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1853     pic_object=
1854     non_pic_object=
1855    
1856     # Read the .lo file
1857     # If there is no directory component, then add one.
1858     case $arg in
1859     */* | *\\*) . $arg ;;
1860     *) . ./$arg ;;
1861     esac
1862    
1863     if test -z "$pic_object" || \
1864     test -z "$non_pic_object" ||
1865     test "$pic_object" = none && \
1866     test "$non_pic_object" = none; then
1867     $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1868     exit $EXIT_FAILURE
1869     fi
1870    
1871     # Extract subdirectory from the argument.
1872     xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1873     if test "X$xdir" = "X$arg"; then
1874     xdir=
1875     else
1876     xdir="$xdir/"
1877     fi
1878    
1879     if test "$pic_object" != none; then
1880     # Prepend the subdirectory the object is found in.
1881     pic_object="$xdir$pic_object"
1882    
1883     if test "$prev" = dlfiles; then
1884     if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1885     dlfiles="$dlfiles $pic_object"
1886     prev=
1887     continue
1888     else
1889     # If libtool objects are unsupported, then we need to preload.
1890     prev=dlprefiles
1891     fi
1892     fi
1893    
1894     # CHECK ME: I think I busted this. -Ossama
1895     if test "$prev" = dlprefiles; then
1896     # Preload the old-style object.
1897     dlprefiles="$dlprefiles $pic_object"
1898     prev=
1899     fi
1900    
1901     # A PIC object.
1902     libobjs="$libobjs $pic_object"
1903     arg="$pic_object"
1904     fi
1905    
1906     # Non-PIC object.
1907     if test "$non_pic_object" != none; then
1908     # Prepend the subdirectory the object is found in.
1909     non_pic_object="$xdir$non_pic_object"
1910    
1911     # A standard non-PIC object
1912     non_pic_objects="$non_pic_objects $non_pic_object"
1913     if test -z "$pic_object" || test "$pic_object" = none ; then
1914     arg="$non_pic_object"
1915     fi
1916     else
1917     # If the PIC object exists, use it instead.
1918     # $xdir was prepended to $pic_object above.
1919     non_pic_object="$pic_object"
1920     non_pic_objects="$non_pic_objects $non_pic_object"
1921     fi
1922     else
1923     # Only an error if not doing a dry-run.
1924     if test -z "$run"; then
1925     $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1926     exit $EXIT_FAILURE
1927     else
1928     # Dry-run case.
1929    
1930     # Extract subdirectory from the argument.
1931     xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1932     if test "X$xdir" = "X$arg"; then
1933     xdir=
1934     else
1935     xdir="$xdir/"
1936     fi
1937    
1938     pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1939     non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1940     libobjs="$libobjs $pic_object"
1941     non_pic_objects="$non_pic_objects $non_pic_object"
1942     fi
1943     fi
1944     ;;
1945    
1946     *.$libext)
1947     # An archive.
1948     deplibs="$deplibs $arg"
1949     old_deplibs="$old_deplibs $arg"
1950     continue
1951     ;;
1952    
1953     *.la)
1954     # A libtool-controlled library.
1955    
1956     if test "$prev" = dlfiles; then
1957     # This library was specified with -dlopen.
1958     dlfiles="$dlfiles $arg"
1959     prev=
1960     elif test "$prev" = dlprefiles; then
1961     # The library was specified with -dlpreopen.
1962     dlprefiles="$dlprefiles $arg"
1963     prev=
1964     else
1965     deplibs="$deplibs $arg"
1966     fi
1967     continue
1968     ;;
1969    
1970     # Some other compiler argument.
1971     *)
1972     # Unknown arguments in both finalize_command and compile_command need
1973     # to be aesthetically quoted because they are evaled later.
1974     arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1975     case $arg in
1976     *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1977     arg="\"$arg\""
1978     ;;
1979     esac
1980     ;;
1981     esac # arg
1982    
1983     # Now actually substitute the argument into the commands.
1984     if test -n "$arg"; then
1985     compile_command="$compile_command $arg"
1986     finalize_command="$finalize_command $arg"
1987     fi
1988     done # argument parsing loop
1989    
1990     if test -n "$prev"; then
1991     $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1992     $echo "$help" 1>&2
1993     exit $EXIT_FAILURE
1994     fi
1995    
1996     if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1997     eval arg=\"$export_dynamic_flag_spec\"
1998     compile_command="$compile_command $arg"
1999     finalize_command="$finalize_command $arg"
2000     fi
2001    
2002     oldlibs=
2003     # calculate the name of the file, without its directory
2004     outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
2005     libobjs_save="$libobjs"
2006    
2007     if test -n "$shlibpath_var"; then
2008     # get the directories listed in $shlibpath_var
2009     eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2010     else
2011     shlib_search_path=
2012     fi
2013     eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2014     eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2015    
2016     output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2017     if test "X$output_objdir" = "X$output"; then
2018     output_objdir="$objdir"
2019     else
2020     output_objdir="$output_objdir/$objdir"
2021     fi
2022     # Create the object directory.
2023     if test ! -d "$output_objdir"; then
2024     $show "$mkdir $output_objdir"
2025     $run $mkdir $output_objdir
2026     exit_status=$?
2027     if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2028     exit $exit_status
2029     fi
2030     fi
2031    
2032     # Determine the type of output
2033     case $output in
2034     "")
2035     $echo "$modename: you must specify an output file" 1>&2
2036     $echo "$help" 1>&2
2037     exit $EXIT_FAILURE
2038     ;;
2039     *.$libext) linkmode=oldlib ;;
2040     *.lo | *.$objext) linkmode=obj ;;
2041     *.la) linkmode=lib ;;
2042     *) linkmode=prog ;; # Anything else should be a program.
2043     esac
2044    
2045     case $host in
2046     *cygwin* | *mingw* | *pw32*)
2047     # don't eliminate duplications in $postdeps and $predeps
2048     duplicate_compiler_generated_deps=yes
2049     ;;
2050     *)
2051     duplicate_compiler_generated_deps=$duplicate_deps
2052     ;;
2053     esac
2054     specialdeplibs=
2055    
2056     libs=
2057     # Find all interdependent deplibs by searching for libraries
2058     # that are linked more than once (e.g. -la -lb -la)
2059     for deplib in $deplibs; do
2060     if test "X$duplicate_deps" = "Xyes" ; then
2061     case "$libs " in
2062     *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2063     esac
2064     fi
2065     libs="$libs $deplib"
2066     done
2067    
2068     if test "$linkmode" = lib; then
2069     libs="$predeps $libs $compiler_lib_search_path $postdeps"
2070    
2071     # Compute libraries that are listed more than once in $predeps
2072     # $postdeps and mark them as special (i.e., whose duplicates are
2073     # not to be eliminated).
2074     pre_post_deps=
2075     if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2076     for pre_post_dep in $predeps $postdeps; do
2077     case "$pre_post_deps " in
2078     *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2079     esac
2080     pre_post_deps="$pre_post_deps $pre_post_dep"
2081     done
2082     fi
2083     pre_post_deps=
2084     fi
2085    
2086     deplibs=
2087     newdependency_libs=
2088     newlib_search_path=
2089     need_relink=no # whether we're linking any uninstalled libtool libraries
2090     notinst_deplibs= # not-installed libtool libraries
2091     case $linkmode in
2092     lib)
2093     passes="conv link"
2094     for file in $dlfiles $dlprefiles; do
2095     case $file in
2096     *.la) ;;
2097     *)
2098     $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2099     exit $EXIT_FAILURE
2100     ;;
2101     esac
2102     done
2103     ;;
2104     prog)
2105     compile_deplibs=
2106     finalize_deplibs=
2107     alldeplibs=no
2108     newdlfiles=
2109     newdlprefiles=
2110     passes="conv scan dlopen dlpreopen link"
2111     ;;
2112     *) passes="conv"
2113     ;;
2114     esac
2115     for pass in $passes; do
2116     if test "$linkmode,$pass" = "lib,link" ||
2117     test "$linkmode,$pass" = "prog,scan"; then
2118     libs="$deplibs"
2119     deplibs=
2120     fi
2121     if test "$linkmode" = prog; then
2122     case $pass in
2123     dlopen) libs="$dlfiles" ;;
2124     dlpreopen) libs="$dlprefiles" ;;
2125     link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2126     esac
2127     fi
2128     if test "$pass" = dlopen; then
2129     # Collect dlpreopened libraries
2130     save_deplibs="$deplibs"
2131     deplibs=
2132     fi
2133     for deplib in $libs; do
2134     lib=
2135     found=no
2136     case $deplib in
2137     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
2138     if test "$linkmode,$pass" = "prog,link"; then
2139     compile_deplibs="$deplib $compile_deplibs"
2140     finalize_deplibs="$deplib $finalize_deplibs"
2141     else
2142     compiler_flags="$compiler_flags $deplib"
2143     fi
2144     continue
2145     ;;
2146     -l*)
2147     if test "$linkmode" != lib && test "$linkmode" != prog; then
2148     $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2149     continue
2150     fi
2151     name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2152     for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2153     for search_ext in .la $std_shrext .so .a; do
2154     # Search the libtool library
2155     lib="$searchdir/lib${name}${search_ext}"
2156     if test -f "$lib"; then
2157     if test "$search_ext" = ".la"; then
2158     found=yes
2159     else
2160     found=no
2161     fi
2162     break 2
2163     fi
2164     done
2165     done
2166     if test "$found" != yes; then
2167     # deplib doesn't seem to be a libtool library
2168     if test "$linkmode,$pass" = "prog,link"; then
2169     compile_deplibs="$deplib $compile_deplibs"
2170     finalize_deplibs="$deplib $finalize_deplibs"
2171     else
2172     deplibs="$deplib $deplibs"
2173     test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2174     fi
2175     continue
2176     else # deplib is a libtool library
2177     # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2178     # We need to do some special things here, and not later.
2179     if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2180     case " $predeps $postdeps " in
2181     *" $deplib "*)
2182     if (${SED} -e '2q' $lib |
2183     grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2184     library_names=
2185     old_library=
2186     case $lib in
2187     */* | *\\*) . $lib ;;
2188     *) . ./$lib ;;
2189     esac
2190     for l in $old_library $library_names; do
2191     ll="$l"
2192     done
2193     if test "X$ll" = "X$old_library" ; then # only static version available
2194     found=no
2195     ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2196     test "X$ladir" = "X$lib" && ladir="."
2197     lib=$ladir/$old_library
2198     if test "$linkmode,$pass" = "prog,link"; then
2199     compile_deplibs="$deplib $compile_deplibs"
2200     finalize_deplibs="$deplib $finalize_deplibs"
2201     else
2202     deplibs="$deplib $deplibs"
2203     test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2204     fi
2205     continue
2206     fi
2207     fi
2208     ;;
2209     *) ;;
2210     esac
2211     fi
2212     fi
2213     ;; # -l
2214     -L*)
2215     case $linkmode in
2216     lib)
2217     deplibs="$deplib $deplibs"
2218     test "$pass" = conv && continue
2219     newdependency_libs="$deplib $newdependency_libs"
2220     newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2221     ;;
2222     prog)
2223     if test "$pass" = conv; then
2224     deplibs="$deplib $deplibs"
2225     continue
2226     fi
2227     if test "$pass" = scan; then
2228     deplibs="$deplib $deplibs"
2229     else
2230     compile_deplibs="$deplib $compile_deplibs"
2231     finalize_deplibs="$deplib $finalize_deplibs"
2232     fi
2233     newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2234     ;;
2235     *)
2236     $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2237     ;;
2238     esac # linkmode
2239     continue
2240     ;; # -L
2241     -R*)
2242     if test "$pass" = link; then
2243     dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2244     # Make sure the xrpath contains only unique directories.
2245     case "$xrpath " in
2246     *" $dir "*) ;;
2247     *) xrpath="$xrpath $dir" ;;
2248     esac
2249     fi
2250     deplibs="$deplib $deplibs"
2251     continue
2252     ;;
2253     *.la) lib="$deplib" ;;
2254     *.$libext)
2255     if test "$pass" = conv; then
2256     deplibs="$deplib $deplibs"
2257     continue
2258     fi
2259     case $linkmode in
2260     lib)
2261     valid_a_lib=no
2262     case $deplibs_check_method in
2263     match_pattern*)
2264     set dummy $deplibs_check_method
2265     match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2266     if eval $echo \"$deplib\" 2>/dev/null \
2267     | $SED 10q \
2268     | $EGREP "$match_pattern_regex" > /dev/null; then
2269     valid_a_lib=yes
2270     fi
2271     ;;
2272     pass_all)
2273     valid_a_lib=yes
2274     ;;
2275     esac
2276     if test "$valid_a_lib" != yes; then
2277     $echo
2278     $echo "*** Warning: Trying to link with static lib archive $deplib."
2279     $echo "*** I have the capability to make that library automatically link in when"
2280     $echo "*** you link to this library. But I can only do this if you have a"
2281     $echo "*** shared version of the library, which you do not appear to have"
2282     $echo "*** because the file extensions .$libext of this argument makes me believe"
2283     $echo "*** that it is just a static archive that I should not used here."
2284     else
2285     $echo
2286     $echo "*** Warning: Linking the shared library $output against the"
2287     $echo "*** static library $deplib is not portable!"
2288     deplibs="$deplib $deplibs"
2289     fi
2290     continue
2291     ;;
2292     prog)
2293     if test "$pass" != link; then
2294     deplibs="$deplib $deplibs"
2295     else
2296     compile_deplibs="$deplib $compile_deplibs"
2297     finalize_deplibs="$deplib $finalize_deplibs"
2298     fi
2299     continue
2300     ;;
2301     esac # linkmode
2302     ;; # *.$libext
2303     *.lo | *.$objext)
2304     if test "$pass" = conv; then
2305     deplibs="$deplib $deplibs"
2306     elif test "$linkmode" = prog; then
2307     if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2308     # If there is no dlopen support or we're linking statically,
2309     # we need to preload.
2310     newdlprefiles="$newdlprefiles $deplib"
2311     compile_deplibs="$deplib $compile_deplibs"
2312     finalize_deplibs="$deplib $finalize_deplibs"
2313     else
2314     newdlfiles="$newdlfiles $deplib"
2315     fi
2316     fi
2317     continue
2318     ;;
2319     %DEPLIBS%)
2320     alldeplibs=yes
2321     continue
2322     ;;
2323     esac # case $deplib
2324     if test "$found" = yes || test -f "$lib"; then :
2325     else
2326     $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2327     exit $EXIT_FAILURE
2328     fi
2329    
2330     # Check to see that this really is a libtool archive.
2331     if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2332     else
2333     $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2334     exit $EXIT_FAILURE
2335     fi
2336    
2337     ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2338     test "X$ladir" = "X$lib" && ladir="."
2339    
2340     dlname=
2341     dlopen=
2342     dlpreopen=
2343     libdir=
2344     library_names=
2345     old_library=
2346     # If the library was installed with an old release of libtool,
2347     # it will not redefine variables installed, or shouldnotlink
2348     installed=yes
2349     shouldnotlink=no
2350     avoidtemprpath=
2351    
2352    
2353     # Read the .la file
2354     case $lib in
2355     */* | *\\*) . $lib ;;
2356     *) . ./$lib ;;
2357     esac
2358    
2359     if test "$linkmode,$pass" = "lib,link" ||
2360     test "$linkmode,$pass" = "prog,scan" ||
2361     { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2362     test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2363     test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2364     fi
2365    
2366     if test "$pass" = conv; then
2367     # Only check for convenience libraries
2368     deplibs="$lib $deplibs"
2369     if test -z "$libdir"; then
2370     if test -z "$old_library"; then
2371     $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2372     exit $EXIT_FAILURE
2373     fi
2374     # It is a libtool convenience library, so add in its objects.
2375     convenience="$convenience $ladir/$objdir/$old_library"
2376     old_convenience="$old_convenience $ladir/$objdir/$old_library"
2377     tmp_libs=
2378     for deplib in $dependency_libs; do
2379     deplibs="$deplib $deplibs"
2380     if test "X$duplicate_deps" = "Xyes" ; then
2381     case "$tmp_libs " in
2382     *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2383     esac
2384     fi
2385     tmp_libs="$tmp_libs $deplib"
2386     done
2387     elif test "$linkmode" != prog && test "$linkmode" != lib; then
2388     $echo "$modename: \`$lib' is not a convenience library" 1>&2
2389     exit $EXIT_FAILURE
2390     fi
2391     continue
2392     fi # $pass = conv
2393    
2394    
2395     # Get the name of the library we link against.
2396     linklib=
2397     for l in $old_library $library_names; do
2398     linklib="$l"
2399     done
2400     if test -z "$linklib"; then
2401     $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2402     exit $EXIT_FAILURE
2403     fi
2404    
2405     # This library was specified with -dlopen.
2406     if test "$pass" = dlopen; then
2407     if test -z "$libdir"; then
2408     $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2409     exit $EXIT_FAILURE
2410     fi
2411     if test -z "$dlname" ||
2412     test "$dlopen_support" != yes ||
2413     test "$build_libtool_libs" = no; then
2414     # If there is no dlname, no dlopen support or we're linking
2415     # statically, we need to preload. We also need to preload any
2416     # dependent libraries so libltdl's deplib preloader doesn't
2417     # bomb out in the load deplibs phase.
2418     dlprefiles="$dlprefiles $lib $dependency_libs"
2419     else
2420     newdlfiles="$newdlfiles $lib"
2421     fi
2422     continue
2423     fi # $pass = dlopen
2424    
2425     # We need an absolute path.
2426     case $ladir in
2427     [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2428     *)
2429     abs_ladir=`cd "$ladir" && pwd`
2430     if test -z "$abs_ladir"; then
2431     $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2432     $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2433     abs_ladir="$ladir"
2434     fi
2435     ;;
2436     esac
2437     laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2438    
2439     # Find the relevant object directory and library name.
2440     if test "X$installed" = Xyes; then
2441     if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2442     $echo "$modename: warning: library \`$lib' was moved." 1>&2
2443     dir="$ladir"
2444     absdir="$abs_ladir"
2445     libdir="$abs_ladir"
2446     else
2447     dir="$libdir"
2448     absdir="$libdir"
2449     fi
2450     test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2451     else
2452     if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2453     dir="$ladir"
2454     absdir="$abs_ladir"
2455     # Remove this search path later
2456     notinst_path="$notinst_path $abs_ladir"
2457     else
2458     dir="$ladir/$objdir"
2459     absdir="$abs_ladir/$objdir"
2460     # Remove this search path later
2461     notinst_path="$notinst_path $abs_ladir"
2462     fi
2463     fi # $installed = yes
2464     name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2465    
2466     # This library was specified with -dlpreopen.
2467     if test "$pass" = dlpreopen; then
2468     if test -z "$libdir"; then
2469     $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2470     exit $EXIT_FAILURE
2471     fi
2472     # Prefer using a static library (so that no silly _DYNAMIC symbols
2473     # are required to link).
2474     if test -n "$old_library"; then
2475     newdlprefiles="$newdlprefiles $dir/$old_library"
2476     # Otherwise, use the dlname, so that lt_dlopen finds it.
2477     elif test -n "$dlname"; then
2478     newdlprefiles="$newdlprefiles $dir/$dlname"
2479     else
2480     newdlprefiles="$newdlprefiles $dir/$linklib"
2481     fi
2482     fi # $pass = dlpreopen
2483    
2484     if test -z "$libdir"; then
2485     # Link the convenience library
2486     if test "$linkmode" = lib; then
2487     deplibs="$dir/$old_library $deplibs"
2488     elif test "$linkmode,$pass" = "prog,link"; then
2489     compile_deplibs="$dir/$old_library $compile_deplibs"
2490     finalize_deplibs="$dir/$old_library $finalize_deplibs"
2491     else
2492     deplibs="$lib $deplibs" # used for prog,scan pass
2493     fi
2494     continue
2495     fi
2496    
2497    
2498     if test "$linkmode" = prog && test "$pass" != link; then
2499     newlib_search_path="$newlib_search_path $ladir"
2500     deplibs="$lib $deplibs"
2501    
2502     linkalldeplibs=no
2503     if test "$link_all_deplibs" != no || test -z "$library_names" ||
2504     test "$build_libtool_libs" = no; then
2505     linkalldeplibs=yes
2506     fi
2507    
2508     tmp_libs=
2509     for deplib in $dependency_libs; do
2510     case $deplib in
2511     -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2512     esac
2513     # Need to link against all dependency_libs?
2514     if test "$linkalldeplibs" = yes; then
2515     deplibs="$deplib $deplibs"
2516     else
2517     # Need to hardcode shared library paths
2518     # or/and link against static libraries
2519     newdependency_libs="$deplib $newdependency_libs"
2520     fi
2521     if test "X$duplicate_deps" = "Xyes" ; then
2522     case "$tmp_libs " in
2523     *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2524     esac
2525     fi
2526     tmp_libs="$tmp_libs $deplib"
2527     done # for deplib
2528     continue
2529     fi # $linkmode = prog...
2530    
2531     if test "$linkmode,$pass" = "prog,link"; then
2532     if test -n "$library_names" &&
2533     { { test "$prefer_static_libs" = no ||
2534     test "$prefer_static_libs,$installed" = "built,yes"; } ||
2535     test -z "$old_library"; }; then
2536     # We need to hardcode the library path
2537     if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2538     # Make sure the rpath contains only unique directories.
2539     case "$temp_rpath " in
2540     *" $dir "*) ;;
2541     *" $absdir "*) ;;
2542     *) temp_rpath="$temp_rpath $absdir" ;;
2543     esac
2544     fi
2545    
2546     # Hardcode the library path.
2547     # Skip directories that are in the system default run-time
2548     # search path.
2549     case " $sys_lib_dlsearch_path " in
2550     *" $absdir "*) ;;
2551     *)
2552     case "$compile_rpath " in
2553     *" $absdir "*) ;;
2554     *) compile_rpath="$compile_rpath $absdir"
2555     esac
2556     ;;
2557     esac
2558     case " $sys_lib_dlsearch_path " in
2559     *" $libdir "*) ;;
2560     *)
2561     case "$finalize_rpath " in
2562     *" $libdir "*) ;;
2563     *) finalize_rpath="$finalize_rpath $libdir"
2564     esac
2565     ;;
2566     esac
2567     fi # $linkmode,$pass = prog,link...
2568    
2569     if test "$alldeplibs" = yes &&
2570     { test "$deplibs_check_method" = pass_all ||
2571     { test "$build_libtool_libs" = yes &&
2572     test -n "$library_names"; }; }; then
2573     # We only need to search for static libraries
2574     continue
2575     fi
2576     fi
2577    
2578     link_static=no # Whether the deplib will be linked statically
2579     use_static_libs=$prefer_static_libs
2580     if test "$use_static_libs" = built && test "$installed" = yes ; then
2581     use_static_libs=no
2582     fi
2583     if test -n "$library_names" &&
2584     { test "$use_static_libs" = no || test -z "$old_library"; }; then
2585     if test "$installed" = no; then
2586     notinst_deplibs="$notinst_deplibs $lib"
2587     need_relink=yes
2588     fi
2589     # This is a shared library
2590    
2591     # Warn about portability, can't link against -module's on
2592     # some systems (darwin)
2593     if test "$shouldnotlink" = yes && test "$pass" = link ; then
2594     $echo
2595     if test "$linkmode" = prog; then
2596     $echo "*** Warning: Linking the executable $output against the loadable module"
2597     else
2598     $echo "*** Warning: Linking the shared library $output against the loadable module"
2599     fi
2600     $echo "*** $linklib is not portable!"
2601     fi
2602     if test "$linkmode" = lib &&
2603     test "$hardcode_into_libs" = yes; then
2604     # Hardcode the library path.
2605     # Skip directories that are in the system default run-time
2606     # search path.
2607     case " $sys_lib_dlsearch_path " in
2608     *" $absdir "*) ;;
2609     *)
2610     case "$compile_rpath " in
2611     *" $absdir "*) ;;
2612     *) compile_rpath="$compile_rpath $absdir"
2613     esac
2614     ;;
2615     esac
2616     case " $sys_lib_dlsearch_path " in
2617     *" $libdir "*) ;;
2618     *)
2619     case "$finalize_rpath " in
2620     *" $libdir "*) ;;
2621     *) finalize_rpath="$finalize_rpath $libdir"
2622     esac
2623     ;;
2624     esac
2625     fi
2626    
2627     if test -n "$old_archive_from_expsyms_cmds"; then
2628     # figure out the soname
2629     set dummy $library_names
2630     realname="$2"
2631     shift; shift
2632     libname=`eval \\$echo \"$libname_spec\"`
2633     # use dlname if we got it. it's perfectly good, no?
2634     if test -n "$dlname"; then
2635     soname="$dlname"
2636     elif test -n "$soname_spec"; then
2637     # bleh windows
2638     case $host in
2639     *cygwin* | mingw*)
2640     major=`expr $current - $age`
2641     versuffix="-$major"
2642     ;;
2643     esac
2644     eval soname=\"$soname_spec\"
2645     else
2646     soname="$realname"
2647     fi
2648    
2649     # Make a new name for the extract_expsyms_cmds to use
2650     soroot="$soname"
2651     soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2652     newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2653    
2654     # If the library has no export list, then create one now
2655     if test -f "$output_objdir/$soname-def"; then :
2656     else
2657     $show "extracting exported symbol list from \`$soname'"
2658     save_ifs="$IFS"; IFS='~'
2659     cmds=$extract_expsyms_cmds
2660     for cmd in $cmds; do
2661     IFS="$save_ifs"
2662     eval cmd=\"$cmd\"
2663     $show "$cmd"
2664     $run eval "$cmd" || exit $?
2665     done
2666     IFS="$save_ifs"
2667     fi
2668    
2669     # Create $newlib
2670     if test -f "$output_objdir/$newlib"; then :; else
2671     $show "generating import library for \`$soname'"
2672     save_ifs="$IFS"; IFS='~'
2673     cmds=$old_archive_from_expsyms_cmds
2674     for cmd in $cmds; do
2675     IFS="$save_ifs"
2676     eval cmd=\"$cmd\"
2677     $show "$cmd"
2678     $run eval "$cmd" || exit $?
2679     done
2680     IFS="$save_ifs"
2681     fi
2682     # make sure the library variables are pointing to the new library
2683     dir=$output_objdir
2684     linklib=$newlib
2685     fi # test -n "$old_archive_from_expsyms_cmds"
2686    
2687     if test "$linkmode" = prog || test "$mode" != relink; then
2688     add_shlibpath=
2689     add_dir=
2690     add=
2691     lib_linked=yes
2692     case $hardcode_action in
2693     immediate | unsupported)
2694     if test "$hardcode_direct" = no; then
2695     add="$dir/$linklib"
2696     case $host in
2697     *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2698     *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2699     *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2700     *-*-unixware7*) add_dir="-L$dir" ;;
2701     *-*-darwin* )
2702     # if the lib is a module then we can not link against
2703     # it, someone is ignoring the new warnings I added
2704     if /usr/bin/file -L $add 2> /dev/null |
2705     $EGREP ": [^:]* bundle" >/dev/null ; then
2706     $echo "** Warning, lib $linklib is a module, not a shared library"