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.2 - (hide annotations) (download) (as text)
Tue Aug 14 13:43:20 2001 UTC (22 years, 8 months ago) by hiroo
Branch: MAIN
Changes since 1.1: +1684 -762 lines
File MIME type: text/x-sh
IPv6+CPP patch [freewnn:00673] Katsuomi Hamajima, Tomoki Aono
beos patch for configure.in [freewnn:00677] Hiroaki Abe
libtoolized by libtool-1.4

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