Develop and Download Open Source Software

Browse CVS Repository

Annotation of /freewnn/FreeWnn/ltmain.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (hide annotations) (download) (as text)
Wed Jun 4 08:35:02 2003 UTC (20 years, 10 months ago) by aono
Branch: MAIN
CVS Tags: freewnn-1-1-1-a021
Changes since 1.4: +2075 -731 lines
File MIME type: text/x-sh
Update Libtool to 1.5 .... You will make shared library
for Darwin / MacOSX (and probably for some more platforms).
Main part from [freewnn:00978].

FIXME:  For now, you will see many libtool warning (require --mode=MODE)
       on build time.

Notice for developer: You need autoconf-2.50 or later to create configure.

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