/[debian]/cdck/trunk/ltmain.sh
ViewVC logotype

Annotation of /cdck/trunk/ltmain.sh

Parent Directory Parent Directory | Revision Log Revision Log


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