Develop and Download Open Source Software

Browse Subversion Repository

Contents of /tags/tritonn-1.0.9-mysql-5.0.51/ltmain.sh

Parent Directory Parent Directory | Revision Log Revision Log


Revision 71 - (show annotations) (download) (as text)
Fri Jan 18 03:00:49 2008 UTC (16 years, 2 months ago) by mir
File MIME type: text/x-sh
File size: 198422 byte(s)
moved from topdir to tags
1 # ltmain.sh - Provide generalized library-building support services.
2 # NOTE: Changing this file will not affect anything until you rerun configure.
3 #
4 # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
5 # Free Software Foundation, Inc.
6 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
7 #
8 # This program is free software; you can redistribute it and/or modify
9 # it under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 2 of the License, or
11 # (at your option) any later version.
12 #
13 # This program is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 # General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with this program; if not, write to the Free Software
20 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
21 #
22 # As a special exception to the GNU General Public License, if you
23 # distribute this file as part of a program that contains a
24 # configuration script generated by Autoconf, you may include it under
25 # the same distribution terms that you use for the rest of that program.
26
27 basename="s,^.*/,,g"
28
29 # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
30 # is ksh but when the shell is invoked as "sh" and the current value of
31 # the _XPG environment variable is not equal to 1 (one), the special
32 # positional parameter $0, within a function call, is the name of the
33 # function.
34 progpath="$0"
35
36 # The name of this program:
37 progname=`echo "$progpath" | $SED $basename`
38 modename="$progname"
39
40 # Global variables:
41 EXIT_SUCCESS=0
42 EXIT_FAILURE=1
43
44 PROGRAM=ltmain.sh
45 PACKAGE=libtool
46 VERSION=1.5.22
47 TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
48
49 # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
50 if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
51 emulate sh
52 NULLCMD=:
53 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
54 # is contrary to our usage. Disable this feature.
55 alias -g '${1+"$@"}'='"$@"'
56 setopt NO_GLOB_SUBST
57 else
58 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
59 fi
60
61 # Check that we have a working $echo.
62 if test "X$1" = X--no-reexec; then
63 # Discard the --no-reexec flag, and continue.
64 shift
65 elif test "X$1" = X--fallback-echo; then
66 # Avoid inline document here, it may be left over
67 :
68 elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
69 # Yippee, $echo works!
70 :
71 else
72 # Restart under the correct shell, and then maybe $echo will work.
73 exec $SHELL "$progpath" --no-reexec ${1+"$@"}
74 fi
75
76 if test "X$1" = X--fallback-echo; then
77 # used as fallback echo
78 shift
79 cat <<EOF
80 $*
81 EOF
82 exit $EXIT_SUCCESS
83 fi
84
85 default_mode=
86 help="Try \`$progname --help' for more information."
87 magic="%%%MAGIC variable%%%"
88 mkdir="mkdir"
89 mv="mv -f"
90 rm="rm -f"
91
92 # Sed substitution that helps us do robust quoting. It backslashifies
93 # metacharacters that are still active within double-quoted strings.
94 Xsed="${SED}"' -e 1s/^X//'
95 sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
96 # test EBCDIC or ASCII
97 case `echo X|tr X '\101'` in
98 A) # ASCII based system
99 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
100 SP2NL='tr \040 \012'
101 NL2SP='tr \015\012 \040\040'
102 ;;
103 *) # EBCDIC based system
104 SP2NL='tr \100 \n'
105 NL2SP='tr \r\n \100\100'
106 ;;
107 esac
108
109 # NLS nuisances.
110 # Only set LANG and LC_ALL to C if already set.
111 # These must not be set unconditionally because not all systems understand
112 # e.g. LANG=C (notably SCO).
113 # We save the old values to restore during execute mode.
114 for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
115 do
116 eval "if test \"\${$lt_var+set}\" = set; then
117 save_$lt_var=\$$lt_var
118 $lt_var=C
119 export $lt_var
120 fi"
121 done
122
123 # Make sure IFS has a sensible default
124 lt_nl='
125 '
126 IFS=" $lt_nl"
127
128 if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
129 $echo "$modename: not configured to build any kind of library" 1>&2
130 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
131 exit $EXIT_FAILURE
132 fi
133
134 # Global variables.
135 mode=$default_mode
136 nonopt=
137 prev=
138 prevopt=
139 run=
140 show="$echo"
141 show_help=
142 execute_dlfiles=
143 duplicate_deps=no
144 preserve_args=
145 lo2o="s/\\.lo\$/.${objext}/"
146 o2lo="s/\\.${objext}\$/.lo/"
147 extracted_archives=
148 extracted_serial=0
149
150 #####################################
151 # Shell function definitions:
152 # This seems to be the best place for them
153
154 # func_mktempdir [string]
155 # Make a temporary directory that won't clash with other running
156 # libtool processes, and avoids race conditions if possible. If
157 # given, STRING is the basename for that directory.
158 func_mktempdir ()
159 {
160 my_template="${TMPDIR-/tmp}/${1-$progname}"
161
162 if test "$run" = ":"; then
163 # Return a directory name, but don't create it in dry-run mode
164 my_tmpdir="${my_template}-$$"
165 else
166
167 # If mktemp works, use that first and foremost
168 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
169
170 if test ! -d "$my_tmpdir"; then
171 # Failing that, at least try and use $RANDOM to avoid a race
172 my_tmpdir="${my_template}-${RANDOM-0}$$"
173
174 save_mktempdir_umask=`umask`
175 umask 0077
176 $mkdir "$my_tmpdir"
177 umask $save_mktempdir_umask
178 fi
179
180 # If we're not in dry-run mode, bomb out on failure
181 test -d "$my_tmpdir" || {
182 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
183 exit $EXIT_FAILURE
184 }
185 fi
186
187 $echo "X$my_tmpdir" | $Xsed
188 }
189
190
191 # func_win32_libid arg
192 # return the library type of file 'arg'
193 #
194 # Need a lot of goo to handle *both* DLLs and import libs
195 # Has to be a shell function in order to 'eat' the argument
196 # that is supplied when $file_magic_command is called.
197 func_win32_libid ()
198 {
199 win32_libid_type="unknown"
200 win32_fileres=`file -L $1 2>/dev/null`
201 case $win32_fileres in
202 *ar\ archive\ import\ library*) # definitely import
203 win32_libid_type="x86 archive import"
204 ;;
205 *ar\ archive*) # could be an import, or static
206 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
207 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
208 win32_nmres=`eval $NM -f posix -A $1 | \
209 $SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
210 case $win32_nmres in
211 import*) win32_libid_type="x86 archive import";;
212 *) win32_libid_type="x86 archive static";;
213 esac
214 fi
215 ;;
216 *DLL*)
217 win32_libid_type="x86 DLL"
218 ;;
219 *executable*) # but shell scripts are "executable" too...
220 case $win32_fileres in
221 *MS\ Windows\ PE\ Intel*)
222 win32_libid_type="x86 DLL"
223 ;;
224 esac
225 ;;
226 esac
227 $echo $win32_libid_type
228 }
229
230
231 # func_infer_tag arg
232 # Infer tagged configuration to use if any are available and
233 # if one wasn't chosen via the "--tag" command line option.
234 # Only attempt this if the compiler in the base compile
235 # command doesn't match the default compiler.
236 # arg is usually of the form 'gcc ...'
237 func_infer_tag ()
238 {
239 if test -n "$available_tags" && test -z "$tagname"; then
240 CC_quoted=
241 for arg in $CC; do
242 case $arg in
243 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
244 arg="\"$arg\""
245 ;;
246 esac
247 CC_quoted="$CC_quoted $arg"
248 done
249 case $@ in
250 # Blanks in the command may have been stripped by the calling shell,
251 # but not from the CC environment variable when configure was run.
252 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
253 # Blanks at the start of $base_compile will cause this to fail
254 # if we don't check for them as well.
255 *)
256 for z in $available_tags; do
257 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
258 # Evaluate the configuration.
259 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
260 CC_quoted=
261 for arg in $CC; do
262 # Double-quote args containing other shell metacharacters.
263 case $arg in
264 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
265 arg="\"$arg\""
266 ;;
267 esac
268 CC_quoted="$CC_quoted $arg"
269 done
270 case "$@ " in
271 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
272 # The compiler in the base compile command matches
273 # the one in the tagged configuration.
274 # Assume this is the tagged configuration we want.
275 tagname=$z
276 break
277 ;;
278 esac
279 fi
280 done
281 # If $tagname still isn't set, then no tagged configuration
282 # was found and let the user know that the "--tag" command
283 # line option must be used.
284 if test -z "$tagname"; then
285 $echo "$modename: unable to infer tagged configuration"
286 $echo "$modename: specify a tag with \`--tag'" 1>&2
287 exit $EXIT_FAILURE
288 # else
289 # $echo "$modename: using $tagname tagged configuration"
290 fi
291 ;;
292 esac
293 fi
294 }
295
296
297 # func_extract_an_archive dir oldlib
298 func_extract_an_archive ()
299 {
300 f_ex_an_ar_dir="$1"; shift
301 f_ex_an_ar_oldlib="$1"
302
303 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
304 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
305 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
306 :
307 else
308 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
309 exit $EXIT_FAILURE
310 fi
311 }
312
313 # func_extract_archives gentop oldlib ...
314 func_extract_archives ()
315 {
316 my_gentop="$1"; shift
317 my_oldlibs=${1+"$@"}
318 my_oldobjs=""
319 my_xlib=""
320 my_xabs=""
321 my_xdir=""
322 my_status=""
323
324 $show "${rm}r $my_gentop"
325 $run ${rm}r "$my_gentop"
326 $show "$mkdir $my_gentop"
327 $run $mkdir "$my_gentop"
328 my_status=$?
329 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
330 exit $my_status
331 fi
332
333 for my_xlib in $my_oldlibs; do
334 # Extract the objects.
335 case $my_xlib in
336 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
337 *) my_xabs=`pwd`"/$my_xlib" ;;
338 esac
339 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
340 my_xlib_u=$my_xlib
341 while :; do
342 case " $extracted_archives " in
343 *" $my_xlib_u "*)
344 extracted_serial=`expr $extracted_serial + 1`
345 my_xlib_u=lt$extracted_serial-$my_xlib ;;
346 *) break ;;
347 esac
348 done
349 extracted_archives="$extracted_archives $my_xlib_u"
350 my_xdir="$my_gentop/$my_xlib_u"
351
352 $show "${rm}r $my_xdir"
353 $run ${rm}r "$my_xdir"
354 $show "$mkdir $my_xdir"
355 $run $mkdir "$my_xdir"
356 exit_status=$?
357 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
358 exit $exit_status
359 fi
360 case $host in
361 *-darwin*)
362 $show "Extracting $my_xabs"
363 # Do not bother doing anything if just a dry run
364 if test -z "$run"; then
365 darwin_orig_dir=`pwd`
366 cd $my_xdir || exit $?
367 darwin_archive=$my_xabs
368 darwin_curdir=`pwd`
369 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
370 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
371 if test -n "$darwin_arches"; then
372 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
373 darwin_arch=
374 $show "$darwin_base_archive has multiple architectures $darwin_arches"
375 for darwin_arch in $darwin_arches ; do
376 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
377 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
378 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
379 func_extract_an_archive "`pwd`" "${darwin_base_archive}"
380 cd "$darwin_curdir"
381 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
382 done # $darwin_arches
383 ## Okay now we have a bunch of thin objects, gotta fatten them up :)
384 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
385 darwin_file=
386 darwin_files=
387 for darwin_file in $darwin_filelist; do
388 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
389 lipo -create -output "$darwin_file" $darwin_files
390 done # $darwin_filelist
391 ${rm}r unfat-$$
392 cd "$darwin_orig_dir"
393 else
394 cd "$darwin_orig_dir"
395 func_extract_an_archive "$my_xdir" "$my_xabs"
396 fi # $darwin_arches
397 fi # $run
398 ;;
399 *)
400 func_extract_an_archive "$my_xdir" "$my_xabs"
401 ;;
402 esac
403 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
404 done
405 func_extract_archives_result="$my_oldobjs"
406 }
407 # End of Shell function definitions
408 #####################################
409
410 # Darwin sucks
411 eval std_shrext=\"$shrext_cmds\"
412
413 disable_libs=no
414
415 # Parse our command line options once, thoroughly.
416 while test "$#" -gt 0
417 do
418 arg="$1"
419 shift
420
421 case $arg in
422 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
423 *) optarg= ;;
424 esac
425
426 # If the previous option needs an argument, assign it.
427 if test -n "$prev"; then
428 case $prev in
429 execute_dlfiles)
430 execute_dlfiles="$execute_dlfiles $arg"
431 ;;
432 tag)
433 tagname="$arg"
434 preserve_args="${preserve_args}=$arg"
435
436 # Check whether tagname contains only valid characters
437 case $tagname in
438 *[!-_A-Za-z0-9,/]*)
439 $echo "$progname: invalid tag name: $tagname" 1>&2
440 exit $EXIT_FAILURE
441 ;;
442 esac
443
444 case $tagname in
445 CC)
446 # Don't test for the "default" C tag, as we know, it's there, but
447 # not specially marked.
448 ;;
449 *)
450 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
451 taglist="$taglist $tagname"
452 # Evaluate the configuration.
453 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
454 else
455 $echo "$progname: ignoring unknown tag $tagname" 1>&2
456 fi
457 ;;
458 esac
459 ;;
460 *)
461 eval "$prev=\$arg"
462 ;;
463 esac
464
465 prev=
466 prevopt=
467 continue
468 fi
469
470 # Have we seen a non-optional argument yet?
471 case $arg in
472 --help)
473 show_help=yes
474 ;;
475
476 --version)
477 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
478 $echo
479 $echo "Copyright (C) 2005 Free Software Foundation, Inc."
480 $echo "This is free software; see the source for copying conditions. There is NO"
481 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
482 exit $?
483 ;;
484
485 --config)
486 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
487 # Now print the configurations for the tags.
488 for tagname in $taglist; do
489 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
490 done
491 exit $?
492 ;;
493
494 --debug)
495 $echo "$progname: enabling shell trace mode"
496 set -x
497 preserve_args="$preserve_args $arg"
498 ;;
499
500 --dry-run | -n)
501 run=:
502 ;;
503
504 --features)
505 $echo "host: $host"
506 if test "$build_libtool_libs" = yes; then
507 $echo "enable shared libraries"
508 else
509 $echo "disable shared libraries"
510 fi
511 if test "$build_old_libs" = yes; then
512 $echo "enable static libraries"
513 else
514 $echo "disable static libraries"
515 fi
516 exit $?
517 ;;
518
519 --finish) mode="finish" ;;
520
521 --mode) prevopt="--mode" prev=mode ;;
522 --mode=*) mode="$optarg" ;;
523
524 --preserve-dup-deps) duplicate_deps="yes" ;;
525
526 --quiet | --silent)
527 show=:
528 preserve_args="$preserve_args $arg"
529 ;;
530
531 --tag)
532 prevopt="--tag"
533 prev=tag
534 preserve_args="$preserve_args --tag"
535 ;;
536 --tag=*)
537 set tag "$optarg" ${1+"$@"}
538 shift
539 prev=tag
540 preserve_args="$preserve_args --tag"
541 ;;
542
543 -dlopen)
544 prevopt="-dlopen"
545 prev=execute_dlfiles
546 ;;
547
548 -*)
549 $echo "$modename: unrecognized option \`$arg'" 1>&2
550 $echo "$help" 1>&2
551 exit $EXIT_FAILURE
552 ;;
553
554 *)
555 nonopt="$arg"
556 break
557 ;;
558 esac
559 done
560
561 if test -n "$prevopt"; then
562 $echo "$modename: option \`$prevopt' requires an argument" 1>&2
563 $echo "$help" 1>&2
564 exit $EXIT_FAILURE
565 fi
566
567 case $disable_libs in
568 no)
569 ;;
570 shared)
571 build_libtool_libs=no
572 build_old_libs=yes
573 ;;
574 static)
575 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
576 ;;
577 esac
578
579 # If this variable is set in any of the actions, the command in it
580 # will be execed at the end. This prevents here-documents from being
581 # left over by shells.
582 exec_cmd=
583
584 if test -z "$show_help"; then
585
586 # Infer the operation mode.
587 if test -z "$mode"; then
588 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
589 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
590 case $nonopt in
591 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
592 mode=link
593 for arg
594 do
595 case $arg in
596 -c)
597 mode=compile
598 break
599 ;;
600 esac
601 done
602 ;;
603 *db | *dbx | *strace | *truss)
604 mode=execute
605 ;;
606 *install*|cp|mv)
607 mode=install
608 ;;
609 *rm)
610 mode=uninstall
611 ;;
612 *)
613 # If we have no mode, but dlfiles were specified, then do execute mode.
614 test -n "$execute_dlfiles" && mode=execute
615
616 # Just use the default operation mode.
617 if test -z "$mode"; then
618 if test -n "$nonopt"; then
619 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
620 else
621 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
622 fi
623 fi
624 ;;
625 esac
626 fi
627
628 # Only execute mode is allowed to have -dlopen flags.
629 if test -n "$execute_dlfiles" && test "$mode" != execute; then
630 $echo "$modename: unrecognized option \`-dlopen'" 1>&2
631 $echo "$help" 1>&2
632 exit $EXIT_FAILURE
633 fi
634
635 # Change the help message to a mode-specific one.
636 generic_help="$help"
637 help="Try \`$modename --help --mode=$mode' for more information."
638
639 # These modes are in order of execution frequency so that they run quickly.
640 case $mode in
641 # libtool compile mode
642 compile)
643 modename="$modename: compile"
644 # Get the compilation command and the source file.
645 base_compile=
646 srcfile="$nonopt" # always keep a non-empty value in "srcfile"
647 suppress_opt=yes
648 suppress_output=
649 arg_mode=normal
650 libobj=
651 later=
652
653 for arg
654 do
655 case $arg_mode in
656 arg )
657 # do not "continue". Instead, add this to base_compile
658 lastarg="$arg"
659 arg_mode=normal
660 ;;
661
662 target )
663 libobj="$arg"
664 arg_mode=normal
665 continue
666 ;;
667
668 normal )
669 # Accept any command-line options.
670 case $arg in
671 -o)
672 if test -n "$libobj" ; then
673 $echo "$modename: you cannot specify \`-o' more than once" 1>&2
674 exit $EXIT_FAILURE
675 fi
676 arg_mode=target
677 continue
678 ;;
679
680 -static | -prefer-pic | -prefer-non-pic)
681 later="$later $arg"
682 continue
683 ;;
684
685 -no-suppress)
686 suppress_opt=no
687 continue
688 ;;
689
690 -Xcompiler)
691 arg_mode=arg # the next one goes into the "base_compile" arg list
692 continue # The current "srcfile" will either be retained or
693 ;; # replaced later. I would guess that would be a bug.
694
695 -Wc,*)
696 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
697 lastarg=
698 save_ifs="$IFS"; IFS=','
699 for arg in $args; do
700 IFS="$save_ifs"
701
702 # Double-quote args containing other shell metacharacters.
703 # Many Bourne shells cannot handle close brackets correctly
704 # in scan sets, so we specify it separately.
705 case $arg in
706 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
707 arg="\"$arg\""
708 ;;
709 esac
710 lastarg="$lastarg $arg"
711 done
712 IFS="$save_ifs"
713 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
714
715 # Add the arguments to base_compile.
716 base_compile="$base_compile $lastarg"
717 continue
718 ;;
719
720 * )
721 # Accept the current argument as the source file.
722 # The previous "srcfile" becomes the current argument.
723 #
724 lastarg="$srcfile"
725 srcfile="$arg"
726 ;;
727 esac # case $arg
728 ;;
729 esac # case $arg_mode
730
731 # Aesthetically quote the previous argument.
732 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
733
734 case $lastarg in
735 # Double-quote args containing other shell metacharacters.
736 # Many Bourne shells cannot handle close brackets correctly
737 # in scan sets, and some SunOS ksh mistreat backslash-escaping
738 # in scan sets (worked around with variable expansion),
739 # and furthermore cannot handle '|' '&' '(' ')' in scan sets
740 # at all, so we specify them separately.
741 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
742 lastarg="\"$lastarg\""
743 ;;
744 esac
745
746 base_compile="$base_compile $lastarg"
747 done # for arg
748
749 case $arg_mode in
750 arg)
751 $echo "$modename: you must specify an argument for -Xcompile"
752 exit $EXIT_FAILURE
753 ;;
754 target)
755 $echo "$modename: you must specify a target with \`-o'" 1>&2
756 exit $EXIT_FAILURE
757 ;;
758 *)
759 # Get the name of the library object.
760 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
761 ;;
762 esac
763
764 # Recognize several different file suffixes.
765 # If the user specifies -o file.o, it is replaced with file.lo
766 xform='[cCFSifmso]'
767 case $libobj in
768 *.ada) xform=ada ;;
769 *.adb) xform=adb ;;
770 *.ads) xform=ads ;;
771 *.asm) xform=asm ;;
772 *.c++) xform=c++ ;;
773 *.cc) xform=cc ;;
774 *.ii) xform=ii ;;
775 *.class) xform=class ;;
776 *.cpp) xform=cpp ;;
777 *.cxx) xform=cxx ;;
778 *.f90) xform=f90 ;;
779 *.for) xform=for ;;
780 *.java) xform=java ;;
781 *.obj) xform=obj ;;
782 esac
783
784 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
785
786 case $libobj in
787 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
788 *)
789 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
790 exit $EXIT_FAILURE
791 ;;
792 esac
793
794 func_infer_tag $base_compile
795
796 for arg in $later; do
797 case $arg in
798 -static)
799 build_old_libs=yes
800 continue
801 ;;
802
803 -prefer-pic)
804 pic_mode=yes
805 continue
806 ;;
807
808 -prefer-non-pic)
809 pic_mode=no
810 continue
811 ;;
812 esac
813 done
814
815 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
816 case $qlibobj in
817 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
818 qlibobj="\"$qlibobj\"" ;;
819 esac
820 test "X$libobj" != "X$qlibobj" \
821 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
822 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
823 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
824 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
825 if test "X$xdir" = "X$obj"; then
826 xdir=
827 else
828 xdir=$xdir/
829 fi
830 lobj=${xdir}$objdir/$objname
831
832 if test -z "$base_compile"; then
833 $echo "$modename: you must specify a compilation command" 1>&2
834 $echo "$help" 1>&2
835 exit $EXIT_FAILURE
836 fi
837
838 # Delete any leftover library objects.
839 if test "$build_old_libs" = yes; then
840 removelist="$obj $lobj $libobj ${libobj}T"
841 else
842 removelist="$lobj $libobj ${libobj}T"
843 fi
844
845 $run $rm $removelist
846 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
847
848 # On Cygwin there's no "real" PIC flag so we must build both object types
849 case $host_os in
850 cygwin* | mingw* | pw32* | os2*)
851 pic_mode=default
852 ;;
853 esac
854 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
855 # non-PIC code in shared libraries is not supported
856 pic_mode=default
857 fi
858
859 # Calculate the filename of the output object if compiler does
860 # not support -o with -c
861 if test "$compiler_c_o" = no; then
862 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
863 lockfile="$output_obj.lock"
864 removelist="$removelist $output_obj $lockfile"
865 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
866 else
867 output_obj=
868 need_locks=no
869 lockfile=
870 fi
871
872 # Lock this critical section if it is needed
873 # We use this script file to make the link, it avoids creating a new file
874 if test "$need_locks" = yes; then
875 until $run ln "$progpath" "$lockfile" 2>/dev/null; do
876 $show "Waiting for $lockfile to be removed"
877 sleep 2
878 done
879 elif test "$need_locks" = warn; then
880 if test -f "$lockfile"; then
881 $echo "\
882 *** ERROR, $lockfile exists and contains:
883 `cat $lockfile 2>/dev/null`
884
885 This indicates that another process is trying to use the same
886 temporary object file, and libtool could not work around it because
887 your compiler does not support \`-c' and \`-o' together. If you
888 repeat this compilation, it may succeed, by chance, but you had better
889 avoid parallel builds (make -j) in this platform, or get a better
890 compiler."
891
892 $run $rm $removelist
893 exit $EXIT_FAILURE
894 fi
895 $echo "$srcfile" > "$lockfile"
896 fi
897
898 if test -n "$fix_srcfile_path"; then
899 eval srcfile=\"$fix_srcfile_path\"
900 fi
901 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
902 case $qsrcfile in
903 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
904 qsrcfile="\"$qsrcfile\"" ;;
905 esac
906
907 $run $rm "$libobj" "${libobj}T"
908
909 # Create a libtool object file (analogous to a ".la" file),
910 # but don't create it if we're doing a dry run.
911 test -z "$run" && cat > ${libobj}T <<EOF
912 # $libobj - a libtool object file
913 # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
914 #
915 # Please DO NOT delete this file!
916 # It is necessary for linking the library.
917
918 # Name of the PIC object.
919 EOF
920
921 # Only build a PIC object if we are building libtool libraries.
922 if test "$build_libtool_libs" = yes; then
923 # Without this assignment, base_compile gets emptied.
924 fbsd_hideous_sh_bug=$base_compile
925
926 if test "$pic_mode" != no; then
927 command="$base_compile $qsrcfile $pic_flag"
928 else
929 # Don't build PIC code
930 command="$base_compile $qsrcfile"
931 fi
932
933 if test ! -d "${xdir}$objdir"; then
934 $show "$mkdir ${xdir}$objdir"
935 $run $mkdir ${xdir}$objdir
936 exit_status=$?
937 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
938 exit $exit_status
939 fi
940 fi
941
942 if test -z "$output_obj"; then
943 # Place PIC objects in $objdir
944 command="$command -o $lobj"
945 fi
946
947 $run $rm "$lobj" "$output_obj"
948
949 $show "$command"
950 if $run eval "$command"; then :
951 else
952 test -n "$output_obj" && $run $rm $removelist
953 exit $EXIT_FAILURE
954 fi
955
956 if test "$need_locks" = warn &&
957 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
958 $echo "\
959 *** ERROR, $lockfile contains:
960 `cat $lockfile 2>/dev/null`
961
962 but it should contain:
963 $srcfile
964
965 This indicates that another process is trying to use the same
966 temporary object file, and libtool could not work around it because
967 your compiler does not support \`-c' and \`-o' together. If you
968 repeat this compilation, it may succeed, by chance, but you had better
969 avoid parallel builds (make -j) in this platform, or get a better
970 compiler."
971
972 $run $rm $removelist
973 exit $EXIT_FAILURE
974 fi
975
976 # Just move the object if needed, then go on to compile the next one
977 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
978 $show "$mv $output_obj $lobj"
979 if $run $mv $output_obj $lobj; then :
980 else
981 error=$?
982 $run $rm $removelist
983 exit $error
984 fi
985 fi
986
987 # Append the name of the PIC object to the libtool object file.
988 test -z "$run" && cat >> ${libobj}T <<EOF
989 pic_object='$objdir/$objname'
990
991 EOF
992
993 # Allow error messages only from the first compilation.
994 if test "$suppress_opt" = yes; then
995 suppress_output=' >/dev/null 2>&1'
996 fi
997 else
998 # No PIC object so indicate it doesn't exist in the libtool
999 # object file.
1000 test -z "$run" && cat >> ${libobj}T <<EOF
1001 pic_object=none
1002
1003 EOF
1004 fi
1005
1006 # Only build a position-dependent object if we build old libraries.
1007 if test "$build_old_libs" = yes; then
1008 if test "$pic_mode" != yes; then
1009 # Don't build PIC code
1010 command="$base_compile $qsrcfile"
1011 else
1012 command="$base_compile $qsrcfile $pic_flag"
1013 fi
1014 if test "$compiler_c_o" = yes; then
1015 command="$command -o $obj"
1016 fi
1017
1018 # Suppress compiler output if we already did a PIC compilation.
1019 command="$command$suppress_output"
1020 $run $rm "$obj" "$output_obj"
1021 $show "$command"
1022 if $run eval "$command"; then :
1023 else
1024 $run $rm $removelist
1025 exit $EXIT_FAILURE
1026 fi
1027
1028 if test "$need_locks" = warn &&
1029 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
1030 $echo "\
1031 *** ERROR, $lockfile contains:
1032 `cat $lockfile 2>/dev/null`
1033
1034 but it should contain:
1035 $srcfile
1036
1037 This indicates that another process is trying to use the same
1038 temporary object file, and libtool could not work around it because
1039 your compiler does not support \`-c' and \`-o' together. If you
1040 repeat this compilation, it may succeed, by chance, but you had better
1041 avoid parallel builds (make -j) in this platform, or get a better
1042 compiler."
1043
1044 $run $rm $removelist
1045 exit $EXIT_FAILURE
1046 fi
1047
1048 # Just move the object if needed
1049 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
1050 $show "$mv $output_obj $obj"
1051 if $run $mv $output_obj $obj; then :
1052 else
1053 error=$?
1054 $run $rm $removelist
1055 exit $error
1056 fi
1057 fi
1058
1059 # Append the name of the non-PIC object the libtool object file.
1060 # Only append if the libtool object file exists.
1061 test -z "$run" && cat >> ${libobj}T <<EOF
1062 # Name of the non-PIC object.
1063 non_pic_object='$objname'
1064
1065 EOF
1066 else
1067 # Append the name of the non-PIC object the libtool object file.
1068 # Only append if the libtool object file exists.
1069 test -z "$run" && cat >> ${libobj}T <<EOF
1070 # Name of the non-PIC object.
1071 non_pic_object=none
1072
1073 EOF
1074 fi
1075
1076 $run $mv "${libobj}T" "${libobj}"
1077
1078 # Unlock the critical section if it was locked
1079 if test "$need_locks" != no; then
1080 $run $rm "$lockfile"
1081 fi
1082
1083 exit $EXIT_SUCCESS
1084 ;;
1085
1086 # libtool link mode
1087 link | relink)
1088 modename="$modename: link"
1089 case $host in
1090 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1091 # It is impossible to link a dll without this setting, and
1092 # we shouldn't force the makefile maintainer to figure out
1093 # which system we are compiling for in order to pass an extra
1094 # flag for every libtool invocation.
1095 # allow_undefined=no
1096
1097 # FIXME: Unfortunately, there are problems with the above when trying
1098 # to make a dll which has undefined symbols, in which case not
1099 # even a static library is built. For now, we need to specify
1100 # -no-undefined on the libtool link line when we can be certain
1101 # that all symbols are satisfied, otherwise we get a static library.
1102 allow_undefined=yes
1103 ;;
1104 *)
1105 allow_undefined=yes
1106 ;;
1107 esac
1108 libtool_args="$nonopt"
1109 base_compile="$nonopt $@"
1110 compile_command="$nonopt"
1111 finalize_command="$nonopt"
1112
1113 compile_rpath=
1114 finalize_rpath=
1115 compile_shlibpath=
1116 finalize_shlibpath=
1117 convenience=
1118 old_convenience=
1119 deplibs=
1120 old_deplibs=
1121 compiler_flags=
1122 linker_flags=
1123 dllsearchpath=
1124 lib_search_path=`pwd`
1125 inst_prefix_dir=
1126
1127 avoid_version=no
1128 dlfiles=
1129 dlprefiles=
1130 dlself=no
1131 export_dynamic=no
1132 export_symbols=
1133 export_symbols_regex=
1134 generated=
1135 libobjs=
1136 ltlibs=
1137 module=no
1138 no_install=no
1139 objs=
1140 non_pic_objects=
1141 notinst_path= # paths that contain not-installed libtool libraries
1142 precious_files_regex=
1143 prefer_static_libs=no
1144 preload=no
1145 prev=
1146 prevarg=
1147 release=
1148 rpath=
1149 xrpath=
1150 perm_rpath=
1151 temp_rpath=
1152 thread_safe=no
1153 vinfo=
1154 vinfo_number=no
1155
1156 func_infer_tag $base_compile
1157
1158 # We need to know -static, to get the right output filenames.
1159 for arg
1160 do
1161 case $arg in
1162 -all-static | -static | -static-libtool-libs)
1163 case $arg in
1164 -all-static)
1165 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
1166 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
1167 fi
1168 if test -n "$link_static_flag"; then
1169 dlopen_self=$dlopen_self_static
1170 fi
1171 prefer_static_libs=yes
1172 ;;
1173 -static)
1174 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1175 dlopen_self=$dlopen_self_static
1176 fi
1177 prefer_static_libs=built
1178 ;;
1179 -static-libtool-libs)
1180 if test -z "$pic_flag" && test -n "$link_static_flag"; then
1181 dlopen_self=$dlopen_self_static
1182 fi
1183 prefer_static_libs=yes
1184 ;;
1185 esac
1186 build_libtool_libs=no
1187 build_old_libs=yes
1188 break
1189 ;;
1190 esac
1191 done
1192
1193 # See if our shared archives depend on static archives.
1194 test -n "$old_archive_from_new_cmds" && build_old_libs=yes
1195
1196 # Go through the arguments, transforming them on the way.
1197 while test "$#" -gt 0; do
1198 arg="$1"
1199 shift
1200 case $arg in
1201 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1202 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
1203 ;;
1204 *) qarg=$arg ;;
1205 esac
1206 libtool_args="$libtool_args $qarg"
1207
1208 # If the previous option needs an argument, assign it.
1209 if test -n "$prev"; then
1210 case $prev in
1211 output)
1212 compile_command="$compile_command @OUTPUT@"
1213 finalize_command="$finalize_command @OUTPUT@"
1214 ;;
1215 esac
1216
1217 case $prev in
1218 dlfiles|dlprefiles)
1219 if test "$preload" = no; then
1220 # Add the symbol object into the linking commands.
1221 compile_command="$compile_command @SYMFILE@"
1222 finalize_command="$finalize_command @SYMFILE@"
1223 preload=yes
1224 fi
1225 case $arg in
1226 *.la | *.lo) ;; # We handle these cases below.
1227 force)
1228 if test "$dlself" = no; then
1229 dlself=needless
1230 export_dynamic=yes
1231 fi
1232 prev=
1233 continue
1234 ;;
1235 self)
1236 if test "$prev" = dlprefiles; then
1237 dlself=yes
1238 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
1239 dlself=yes
1240 else
1241 dlself=needless
1242 export_dynamic=yes
1243 fi
1244 prev=
1245 continue
1246 ;;
1247 *)
1248 if test "$prev" = dlfiles; then
1249 dlfiles="$dlfiles $arg"
1250 else
1251 dlprefiles="$dlprefiles $arg"
1252 fi
1253 prev=
1254 continue
1255 ;;
1256 esac
1257 ;;
1258 expsyms)
1259 export_symbols="$arg"
1260 if test ! -f "$arg"; then
1261 $echo "$modename: symbol file \`$arg' does not exist"
1262 exit $EXIT_FAILURE
1263 fi
1264 prev=
1265 continue
1266 ;;
1267 expsyms_regex)
1268 export_symbols_regex="$arg"
1269 prev=
1270 continue
1271 ;;
1272 inst_prefix)
1273 inst_prefix_dir="$arg"
1274 prev=
1275 continue
1276 ;;
1277 precious_regex)
1278 precious_files_regex="$arg"
1279 prev=
1280 continue
1281 ;;
1282 release)
1283 release="-$arg"
1284 prev=
1285 continue
1286 ;;
1287 objectlist)
1288 if test -f "$arg"; then
1289 save_arg=$arg
1290 moreargs=
1291 for fil in `cat $save_arg`
1292 do
1293 # moreargs="$moreargs $fil"
1294 arg=$fil
1295 # A libtool-controlled object.
1296
1297 # Check to see that this really is a libtool object.
1298 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1299 pic_object=
1300 non_pic_object=
1301
1302 # Read the .lo file
1303 # If there is no directory component, then add one.
1304 case $arg in
1305 */* | *\\*) . $arg ;;
1306 *) . ./$arg ;;
1307 esac
1308
1309 if test -z "$pic_object" || \
1310 test -z "$non_pic_object" ||
1311 test "$pic_object" = none && \
1312 test "$non_pic_object" = none; then
1313 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1314 exit $EXIT_FAILURE
1315 fi
1316
1317 # Extract subdirectory from the argument.
1318 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1319 if test "X$xdir" = "X$arg"; then
1320 xdir=
1321 else
1322 xdir="$xdir/"
1323 fi
1324
1325 if test "$pic_object" != none; then
1326 # Prepend the subdirectory the object is found in.
1327 pic_object="$xdir$pic_object"
1328
1329 if test "$prev" = dlfiles; then
1330 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1331 dlfiles="$dlfiles $pic_object"
1332 prev=
1333 continue
1334 else
1335 # If libtool objects are unsupported, then we need to preload.
1336 prev=dlprefiles
1337 fi
1338 fi
1339
1340 # CHECK ME: I think I busted this. -Ossama
1341 if test "$prev" = dlprefiles; then
1342 # Preload the old-style object.
1343 dlprefiles="$dlprefiles $pic_object"
1344 prev=
1345 fi
1346
1347 # A PIC object.
1348 libobjs="$libobjs $pic_object"
1349 arg="$pic_object"
1350 fi
1351
1352 # Non-PIC object.
1353 if test "$non_pic_object" != none; then
1354 # Prepend the subdirectory the object is found in.
1355 non_pic_object="$xdir$non_pic_object"
1356
1357 # A standard non-PIC object
1358 non_pic_objects="$non_pic_objects $non_pic_object"
1359 if test -z "$pic_object" || test "$pic_object" = none ; then
1360 arg="$non_pic_object"
1361 fi
1362 else
1363 # If the PIC object exists, use it instead.
1364 # $xdir was prepended to $pic_object above.
1365 non_pic_object="$pic_object"
1366 non_pic_objects="$non_pic_objects $non_pic_object"
1367 fi
1368 else
1369 # Only an error if not doing a dry-run.
1370 if test -z "$run"; then
1371 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1372 exit $EXIT_FAILURE
1373 else
1374 # Dry-run case.
1375
1376 # Extract subdirectory from the argument.
1377 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1378 if test "X$xdir" = "X$arg"; then
1379 xdir=
1380 else
1381 xdir="$xdir/"
1382 fi
1383
1384 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1385 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1386 libobjs="$libobjs $pic_object"
1387 non_pic_objects="$non_pic_objects $non_pic_object"
1388 fi
1389 fi
1390 done
1391 else
1392 $echo "$modename: link input file \`$save_arg' does not exist"
1393 exit $EXIT_FAILURE
1394 fi
1395 arg=$save_arg
1396 prev=
1397 continue
1398 ;;
1399 rpath | xrpath)
1400 # We need an absolute path.
1401 case $arg in
1402 [\\/]* | [A-Za-z]:[\\/]*) ;;
1403 *)
1404 $echo "$modename: only absolute run-paths are allowed" 1>&2
1405 exit $EXIT_FAILURE
1406 ;;
1407 esac
1408 if test "$prev" = rpath; then
1409 case "$rpath " in
1410 *" $arg "*) ;;
1411 *) rpath="$rpath $arg" ;;
1412 esac
1413 else
1414 case "$xrpath " in
1415 *" $arg "*) ;;
1416 *) xrpath="$xrpath $arg" ;;
1417 esac
1418 fi
1419 prev=
1420 continue
1421 ;;
1422 xcompiler)
1423 compiler_flags="$compiler_flags $qarg"
1424 prev=
1425 compile_command="$compile_command $qarg"
1426 finalize_command="$finalize_command $qarg"
1427 continue
1428 ;;
1429 xlinker)
1430 linker_flags="$linker_flags $qarg"
1431 compiler_flags="$compiler_flags $wl$qarg"
1432 prev=
1433 compile_command="$compile_command $wl$qarg"
1434 finalize_command="$finalize_command $wl$qarg"
1435 continue
1436 ;;
1437 xcclinker)
1438 linker_flags="$linker_flags $qarg"
1439 compiler_flags="$compiler_flags $qarg"
1440 prev=
1441 compile_command="$compile_command $qarg"
1442 finalize_command="$finalize_command $qarg"
1443 continue
1444 ;;
1445 shrext)
1446 shrext_cmds="$arg"
1447 prev=
1448 continue
1449 ;;
1450 darwin_framework|darwin_framework_skip)
1451 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1452 compile_command="$compile_command $arg"
1453 finalize_command="$finalize_command $arg"
1454 prev=
1455 continue
1456 ;;
1457 *)
1458 eval "$prev=\"\$arg\""
1459 prev=
1460 continue
1461 ;;
1462 esac
1463 fi # test -n "$prev"
1464
1465 prevarg="$arg"
1466
1467 case $arg in
1468 -all-static)
1469 if test -n "$link_static_flag"; then
1470 compile_command="$compile_command $link_static_flag"
1471 finalize_command="$finalize_command $link_static_flag"
1472 fi
1473 continue
1474 ;;
1475
1476 -allow-undefined)
1477 # FIXME: remove this flag sometime in the future.
1478 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
1479 continue
1480 ;;
1481
1482 -avoid-version)
1483 avoid_version=yes
1484 continue
1485 ;;
1486
1487 -dlopen)
1488 prev=dlfiles
1489 continue
1490 ;;
1491
1492 -dlpreopen)
1493 prev=dlprefiles
1494 continue
1495 ;;
1496
1497 -export-dynamic)
1498 export_dynamic=yes
1499 continue
1500 ;;
1501
1502 -export-symbols | -export-symbols-regex)
1503 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
1504 $echo "$modename: more than one -exported-symbols argument is not allowed"
1505 exit $EXIT_FAILURE
1506 fi
1507 if test "X$arg" = "X-export-symbols"; then
1508 prev=expsyms
1509 else
1510 prev=expsyms_regex
1511 fi
1512 continue
1513 ;;
1514
1515 -framework|-arch|-isysroot)
1516 case " $CC " in
1517 *" ${arg} ${1} "* | *" ${arg} ${1} "*)
1518 prev=darwin_framework_skip ;;
1519 *) compiler_flags="$compiler_flags $arg"
1520 prev=darwin_framework ;;
1521 esac
1522 compile_command="$compile_command $arg"
1523 finalize_command="$finalize_command $arg"
1524 continue
1525 ;;
1526
1527 -inst-prefix-dir)
1528 prev=inst_prefix
1529 continue
1530 ;;
1531
1532 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
1533 # so, if we see these flags be careful not to treat them like -L
1534 -L[A-Z][A-Z]*:*)
1535 case $with_gcc/$host in
1536 no/*-*-irix* | /*-*-irix*)
1537 compile_command="$compile_command $arg"
1538 finalize_command="$finalize_command $arg"
1539 ;;
1540 esac
1541 continue
1542 ;;
1543
1544 -L*)
1545 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
1546 # We need an absolute path.
1547 case $dir in
1548 [\\/]* | [A-Za-z]:[\\/]*) ;;
1549 *)
1550 absdir=`cd "$dir" && pwd`
1551 if test -z "$absdir"; then
1552 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1553 absdir="$dir"
1554 notinst_path="$notinst_path $dir"
1555 fi
1556 dir="$absdir"
1557 ;;
1558 esac
1559 case "$deplibs " in
1560 *" -L$dir "*) ;;
1561 *)
1562 deplibs="$deplibs -L$dir"
1563 lib_search_path="$lib_search_path $dir"
1564 ;;
1565 esac
1566 case $host in
1567 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1568 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
1569 case :$dllsearchpath: in
1570 *":$dir:"*) ;;
1571 *) dllsearchpath="$dllsearchpath:$dir";;
1572 esac
1573 case :$dllsearchpath: in
1574 *":$testbindir:"*) ;;
1575 *) dllsearchpath="$dllsearchpath:$testbindir";;
1576 esac
1577 ;;
1578 esac
1579 continue
1580 ;;
1581
1582 -l*)
1583 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
1584 case $host in
1585 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
1586 # These systems don't actually have a C or math library (as such)
1587 continue
1588 ;;
1589 *-*-os2*)
1590 # These systems don't actually have a C library (as such)
1591 test "X$arg" = "X-lc" && continue
1592 ;;
1593 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1594 # Do not include libc due to us having libc/libc_r.
1595 test "X$arg" = "X-lc" && continue
1596 ;;
1597 *-*-rhapsody* | *-*-darwin1.[012])
1598 # Rhapsody C and math libraries are in the System framework
1599 deplibs="$deplibs -framework System"
1600 continue
1601 ;;
1602 *-*-sco3.2v5* | *-*-sco5v6*)
1603 # Causes problems with __ctype
1604 test "X$arg" = "X-lc" && continue
1605 ;;
1606 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1607 # Compiler inserts libc in the correct place for threads to work
1608 test "X$arg" = "X-lc" && continue
1609 ;;
1610 esac
1611 elif test "X$arg" = "X-lc_r"; then
1612 case $host in
1613 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
1614 # Do not include libc_r directly, use -pthread flag.
1615 continue
1616 ;;
1617 esac
1618 fi
1619 deplibs="$deplibs $arg"
1620 continue
1621 ;;
1622
1623 # Tru64 UNIX uses -model [arg] to determine the layout of C++
1624 # classes, name mangling, and exception handling.
1625 -model)
1626 compile_command="$compile_command $arg"
1627 compiler_flags="$compiler_flags $arg"
1628 finalize_command="$finalize_command $arg"
1629 prev=xcompiler
1630 continue
1631 ;;
1632
1633 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1634 compiler_flags="$compiler_flags $arg"
1635 compile_command="$compile_command $arg"
1636 finalize_command="$finalize_command $arg"
1637 continue
1638 ;;
1639
1640 -module)
1641 module=yes
1642 continue
1643 ;;
1644
1645 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1646 # -r[0-9][0-9]* specifies the processor on the SGI compiler
1647 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1648 # +DA*, +DD* enable 64-bit mode on the HP compiler
1649 # -q* pass through compiler args for the IBM compiler
1650 # -m* pass through architecture-specific compiler args for GCC
1651 # -m*, -t[45]*, -txscale* pass through architecture-specific
1652 # compiler args for GCC
1653 # -pg pass through profiling flag for GCC
1654 # @file GCC response files
1655 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1656 -t[45]*|-txscale*|@*)
1657
1658 # Unknown arguments in both finalize_command and compile_command need
1659 # to be aesthetically quoted because they are evaled later.
1660 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1661 case $arg in
1662 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1663 arg="\"$arg\""
1664 ;;
1665 esac
1666 compile_command="$compile_command $arg"
1667 finalize_command="$finalize_command $arg"
1668 compiler_flags="$compiler_flags $arg"
1669 continue
1670 ;;
1671
1672 -shrext)
1673 prev=shrext
1674 continue
1675 ;;
1676
1677 -no-fast-install)
1678 fast_install=no
1679 continue
1680 ;;
1681
1682 -no-install)
1683 case $host in
1684 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1685 # The PATH hackery in wrapper scripts is required on Windows
1686 # in order for the loader to find any dlls it needs.
1687 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
1688 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
1689 fast_install=no
1690 ;;
1691 *) no_install=yes ;;
1692 esac
1693 continue
1694 ;;
1695
1696 -no-undefined)
1697 allow_undefined=no
1698 continue
1699 ;;
1700
1701 -objectlist)
1702 prev=objectlist
1703 continue
1704 ;;
1705
1706 -o) prev=output ;;
1707
1708 -precious-files-regex)
1709 prev=precious_regex
1710 continue
1711 ;;
1712
1713 -release)
1714 prev=release
1715 continue
1716 ;;
1717
1718 -rpath)
1719 prev=rpath
1720 continue
1721 ;;
1722
1723 -R)
1724 prev=xrpath
1725 continue
1726 ;;
1727
1728 -R*)
1729 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
1730 # We need an absolute path.
1731 case $dir in
1732 [\\/]* | [A-Za-z]:[\\/]*) ;;
1733 *)
1734 $echo "$modename: only absolute run-paths are allowed" 1>&2
1735 exit $EXIT_FAILURE
1736 ;;
1737 esac
1738 case "$xrpath " in
1739 *" $dir "*) ;;
1740 *) xrpath="$xrpath $dir" ;;
1741 esac
1742 continue
1743 ;;
1744
1745 -static | -static-libtool-libs)
1746 # The effects of -static are defined in a previous loop.
1747 # We used to do the same as -all-static on platforms that
1748 # didn't have a PIC flag, but the assumption that the effects
1749 # would be equivalent was wrong. It would break on at least
1750 # Digital Unix and AIX.
1751 continue
1752 ;;
1753
1754 -thread-safe)
1755 thread_safe=yes
1756 continue
1757 ;;
1758
1759 -version-info)
1760 prev=vinfo
1761 continue
1762 ;;
1763 -version-number)
1764 prev=vinfo
1765 vinfo_number=yes
1766 continue
1767 ;;
1768
1769 -Wc,*)
1770 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
1771 arg=
1772 save_ifs="$IFS"; IFS=','
1773 for flag in $args; do
1774 IFS="$save_ifs"
1775 case $flag in
1776 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1777 flag="\"$flag\""
1778 ;;
1779 esac
1780 arg="$arg $wl$flag"
1781 compiler_flags="$compiler_flags $flag"
1782 done
1783 IFS="$save_ifs"
1784 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1785 ;;
1786
1787 -Wl,*)
1788 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
1789 arg=
1790 save_ifs="$IFS"; IFS=','
1791 for flag in $args; do
1792 IFS="$save_ifs"
1793 case $flag in
1794 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1795 flag="\"$flag\""
1796 ;;
1797 esac
1798 arg="$arg $wl$flag"
1799 compiler_flags="$compiler_flags $wl$flag"
1800 linker_flags="$linker_flags $flag"
1801 done
1802 IFS="$save_ifs"
1803 arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
1804 ;;
1805
1806 -Xcompiler)
1807 prev=xcompiler
1808 continue
1809 ;;
1810
1811 -Xlinker)
1812 prev=xlinker
1813 continue
1814 ;;
1815
1816 -XCClinker)
1817 prev=xcclinker
1818 continue
1819 ;;
1820
1821 # Some other compiler flag.
1822 -* | +*)
1823 # Unknown arguments in both finalize_command and compile_command need
1824 # to be aesthetically quoted because they are evaled later.
1825 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1826 case $arg in
1827 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1828 arg="\"$arg\""
1829 ;;
1830 esac
1831 ;;
1832
1833 *.$objext)
1834 # A standard object.
1835 objs="$objs $arg"
1836 ;;
1837
1838 *.lo)
1839 # A libtool-controlled object.
1840
1841 # Check to see that this really is a libtool object.
1842 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
1843 pic_object=
1844 non_pic_object=
1845
1846 # Read the .lo file
1847 # If there is no directory component, then add one.
1848 case $arg in
1849 */* | *\\*) . $arg ;;
1850 *) . ./$arg ;;
1851 esac
1852
1853 if test -z "$pic_object" || \
1854 test -z "$non_pic_object" ||
1855 test "$pic_object" = none && \
1856 test "$non_pic_object" = none; then
1857 $echo "$modename: cannot find name of object for \`$arg'" 1>&2
1858 exit $EXIT_FAILURE
1859 fi
1860
1861 # Extract subdirectory from the argument.
1862 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1863 if test "X$xdir" = "X$arg"; then
1864 xdir=
1865 else
1866 xdir="$xdir/"
1867 fi
1868
1869 if test "$pic_object" != none; then
1870 # Prepend the subdirectory the object is found in.
1871 pic_object="$xdir$pic_object"
1872
1873 if test "$prev" = dlfiles; then
1874 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
1875 dlfiles="$dlfiles $pic_object"
1876 prev=
1877 continue
1878 else
1879 # If libtool objects are unsupported, then we need to preload.
1880 prev=dlprefiles
1881 fi
1882 fi
1883
1884 # CHECK ME: I think I busted this. -Ossama
1885 if test "$prev" = dlprefiles; then
1886 # Preload the old-style object.
1887 dlprefiles="$dlprefiles $pic_object"
1888 prev=
1889 fi
1890
1891 # A PIC object.
1892 libobjs="$libobjs $pic_object"
1893 arg="$pic_object"
1894 fi
1895
1896 # Non-PIC object.
1897 if test "$non_pic_object" != none; then
1898 # Prepend the subdirectory the object is found in.
1899 non_pic_object="$xdir$non_pic_object"
1900
1901 # A standard non-PIC object
1902 non_pic_objects="$non_pic_objects $non_pic_object"
1903 if test -z "$pic_object" || test "$pic_object" = none ; then
1904 arg="$non_pic_object"
1905 fi
1906 else
1907 # If the PIC object exists, use it instead.
1908 # $xdir was prepended to $pic_object above.
1909 non_pic_object="$pic_object"
1910 non_pic_objects="$non_pic_objects $non_pic_object"
1911 fi
1912 else
1913 # Only an error if not doing a dry-run.
1914 if test -z "$run"; then
1915 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
1916 exit $EXIT_FAILURE
1917 else
1918 # Dry-run case.
1919
1920 # Extract subdirectory from the argument.
1921 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
1922 if test "X$xdir" = "X$arg"; then
1923 xdir=
1924 else
1925 xdir="$xdir/"
1926 fi
1927
1928 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
1929 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
1930 libobjs="$libobjs $pic_object"
1931 non_pic_objects="$non_pic_objects $non_pic_object"
1932 fi
1933 fi
1934 ;;
1935
1936 *.$libext)
1937 # An archive.
1938 deplibs="$deplibs $arg"
1939 old_deplibs="$old_deplibs $arg"
1940 continue
1941 ;;
1942
1943 *.la)
1944 # A libtool-controlled library.
1945
1946 if test "$prev" = dlfiles; then
1947 # This library was specified with -dlopen.
1948 dlfiles="$dlfiles $arg"
1949 prev=
1950 elif test "$prev" = dlprefiles; then
1951 # The library was specified with -dlpreopen.
1952 dlprefiles="$dlprefiles $arg"
1953 prev=
1954 else
1955 deplibs="$deplibs $arg"
1956 fi
1957 continue
1958 ;;
1959
1960 # Some other compiler argument.
1961 *)
1962 # Unknown arguments in both finalize_command and compile_command need
1963 # to be aesthetically quoted because they are evaled later.
1964 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
1965 case $arg in
1966 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
1967 arg="\"$arg\""
1968 ;;
1969 esac
1970 ;;
1971 esac # arg
1972
1973 # Now actually substitute the argument into the commands.
1974 if test -n "$arg"; then
1975 compile_command="$compile_command $arg"
1976 finalize_command="$finalize_command $arg"
1977 fi
1978 done # argument parsing loop
1979
1980 if test -n "$prev"; then
1981 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
1982 $echo "$help" 1>&2
1983 exit $EXIT_FAILURE
1984 fi
1985
1986 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
1987 eval arg=\"$export_dynamic_flag_spec\"
1988 compile_command="$compile_command $arg"
1989 finalize_command="$finalize_command $arg"
1990 fi
1991
1992 oldlibs=
1993 # calculate the name of the file, without its directory
1994 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
1995 libobjs_save="$libobjs"
1996
1997 if test -n "$shlibpath_var"; then
1998 # get the directories listed in $shlibpath_var
1999 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
2000 else
2001 shlib_search_path=
2002 fi
2003 eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
2004 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
2005
2006 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
2007 if test "X$output_objdir" = "X$output"; then
2008 output_objdir="$objdir"
2009 else
2010 output_objdir="$output_objdir/$objdir"
2011 fi
2012 # Create the object directory.
2013 if test ! -d "$output_objdir"; then
2014 $show "$mkdir $output_objdir"
2015 $run $mkdir $output_objdir
2016 exit_status=$?
2017 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
2018 exit $exit_status
2019 fi
2020 fi
2021
2022 # Determine the type of output
2023 case $output in
2024 "")
2025 $echo "$modename: you must specify an output file" 1>&2
2026 $echo "$help" 1>&2
2027 exit $EXIT_FAILURE
2028 ;;
2029 *.$libext) linkmode=oldlib ;;
2030 *.lo | *.$objext) linkmode=obj ;;
2031 *.la) linkmode=lib ;;
2032 *) linkmode=prog ;; # Anything else should be a program.
2033 esac
2034
2035 case $host in
2036 *cygwin* | *mingw* | *pw32*)
2037 # don't eliminate duplications in $postdeps and $predeps
2038 duplicate_compiler_generated_deps=yes
2039 ;;
2040 *)
2041 duplicate_compiler_generated_deps=$duplicate_deps
2042 ;;
2043 esac
2044 specialdeplibs=
2045
2046 libs=
2047 # Find all interdependent deplibs by searching for libraries
2048 # that are linked more than once (e.g. -la -lb -la)
2049 for deplib in $deplibs; do
2050 if test "X$duplicate_deps" = "Xyes" ; then
2051 case "$libs " in
2052 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2053 esac
2054 fi
2055 libs="$libs $deplib"
2056 done
2057
2058 if test "$linkmode" = lib; then
2059 libs="$predeps $libs $compiler_lib_search_path $postdeps"
2060
2061 # Compute libraries that are listed more than once in $predeps
2062 # $postdeps and mark them as special (i.e., whose duplicates are
2063 # not to be eliminated).
2064 pre_post_deps=
2065 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
2066 for pre_post_dep in $predeps $postdeps; do
2067 case "$pre_post_deps " in
2068 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
2069 esac
2070 pre_post_deps="$pre_post_deps $pre_post_dep"
2071 done
2072 fi
2073 pre_post_deps=
2074 fi
2075
2076 deplibs=
2077 newdependency_libs=
2078 newlib_search_path=
2079 need_relink=no # whether we're linking any uninstalled libtool libraries
2080 notinst_deplibs= # not-installed libtool libraries
2081 case $linkmode in
2082 lib)
2083 passes="conv link"
2084 for file in $dlfiles $dlprefiles; do
2085 case $file in
2086 *.la) ;;
2087 *)
2088 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
2089 exit $EXIT_FAILURE
2090 ;;
2091 esac
2092 done
2093 ;;
2094 prog)
2095 compile_deplibs=
2096 finalize_deplibs=
2097 alldeplibs=no
2098 newdlfiles=
2099 newdlprefiles=
2100 passes="conv scan dlopen dlpreopen link"
2101 ;;
2102 *) passes="conv"
2103 ;;
2104 esac
2105 for pass in $passes; do
2106 if test "$linkmode,$pass" = "lib,link" ||
2107 test "$linkmode,$pass" = "prog,scan"; then
2108 libs="$deplibs"
2109 deplibs=
2110 fi
2111 if test "$linkmode" = prog; then
2112 case $pass in
2113 dlopen) libs="$dlfiles" ;;
2114 dlpreopen) libs="$dlprefiles" ;;
2115 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
2116 esac
2117 fi
2118 if test "$pass" = dlopen; then
2119 # Collect dlpreopened libraries
2120 save_deplibs="$deplibs"
2121 deplibs=
2122 fi
2123 for deplib in $libs; do
2124 lib=
2125 found=no
2126 case $deplib in
2127 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
2128 if test "$linkmode,$pass" = "prog,link"; then
2129 compile_deplibs="$deplib $compile_deplibs"
2130 finalize_deplibs="$deplib $finalize_deplibs"
2131 else
2132 compiler_flags="$compiler_flags $deplib"
2133 fi
2134 continue
2135 ;;
2136 -l*)
2137 if test "$linkmode" != lib && test "$linkmode" != prog; then
2138 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
2139 continue
2140 fi
2141 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
2142 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
2143 for search_ext in .la $std_shrext .so .a; do
2144 # Search the libtool library
2145 lib="$searchdir/lib${name}${search_ext}"
2146 if test -f "$lib"; then
2147 if test "$search_ext" = ".la"; then
2148 found=yes
2149 else
2150 found=no
2151 fi
2152 break 2
2153 fi
2154 done
2155 done
2156 if test "$found" != yes; then
2157 # deplib doesn't seem to be a libtool library
2158 if test "$linkmode,$pass" = "prog,link"; then
2159 compile_deplibs="$deplib $compile_deplibs"
2160 finalize_deplibs="$deplib $finalize_deplibs"
2161 else
2162 deplibs="$deplib $deplibs"
2163 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2164 fi
2165 continue
2166 else # deplib is a libtool library
2167 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
2168 # We need to do some special things here, and not later.
2169 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
2170 case " $predeps $postdeps " in
2171 *" $deplib "*)
2172 if (${SED} -e '2q' $lib |
2173 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
2174 library_names=
2175 old_library=
2176 case $lib in
2177 */* | *\\*) . $lib ;;
2178 *) . ./$lib ;;
2179 esac
2180 for l in $old_library $library_names; do
2181 ll="$l"
2182 done
2183 if test "X$ll" = "X$old_library" ; then # only static version available
2184 found=no
2185 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2186 test "X$ladir" = "X$lib" && ladir="."
2187 lib=$ladir/$old_library
2188 if test "$linkmode,$pass" = "prog,link"; then
2189 compile_deplibs="$deplib $compile_deplibs"
2190 finalize_deplibs="$deplib $finalize_deplibs"
2191 else
2192 deplibs="$deplib $deplibs"
2193 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
2194 fi
2195 continue
2196 fi
2197 fi
2198 ;;
2199 *) ;;
2200 esac
2201 fi
2202 fi
2203 ;; # -l
2204 -L*)
2205 case $linkmode in
2206 lib)
2207 deplibs="$deplib $deplibs"
2208 test "$pass" = conv && continue
2209 newdependency_libs="$deplib $newdependency_libs"
2210 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2211 ;;
2212 prog)
2213 if test "$pass" = conv; then
2214 deplibs="$deplib $deplibs"
2215 continue
2216 fi
2217 if test "$pass" = scan; then
2218 deplibs="$deplib $deplibs"
2219 else
2220 compile_deplibs="$deplib $compile_deplibs"
2221 finalize_deplibs="$deplib $finalize_deplibs"
2222 fi
2223 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
2224 ;;
2225 *)
2226 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
2227 ;;
2228 esac # linkmode
2229 continue
2230 ;; # -L
2231 -R*)
2232 if test "$pass" = link; then
2233 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
2234 # Make sure the xrpath contains only unique directories.
2235 case "$xrpath " in
2236 *" $dir "*) ;;
2237 *) xrpath="$xrpath $dir" ;;
2238 esac
2239 fi
2240 deplibs="$deplib $deplibs"
2241 continue
2242 ;;
2243 *.la) lib="$deplib" ;;
2244 *.$libext)
2245 if test "$pass" = conv; then
2246 deplibs="$deplib $deplibs"
2247 continue
2248 fi
2249 case $linkmode in
2250 lib)
2251 valid_a_lib=no
2252 case $deplibs_check_method in
2253 match_pattern*)
2254 set dummy $deplibs_check_method
2255 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
2256 if eval $echo \"$deplib\" 2>/dev/null \
2257 | $SED 10q \
2258 | $EGREP "$match_pattern_regex" > /dev/null; then
2259 valid_a_lib=yes
2260 fi
2261 ;;
2262 pass_all)
2263 valid_a_lib=yes
2264 ;;
2265 esac
2266 if test "$valid_a_lib" != yes; then
2267 $echo
2268 $echo "*** Warning: Trying to link with static lib archive $deplib."
2269 $echo "*** I have the capability to make that library automatically link in when"
2270 $echo "*** you link to this library. But I can only do this if you have a"
2271 $echo "*** shared version of the library, which you do not appear to have"
2272 $echo "*** because the file extensions .$libext of this argument makes me believe"
2273 $echo "*** that it is just a static archive that I should not used here."
2274 else
2275 $echo
2276 $echo "*** Warning: Linking the shared library $output against the"
2277 $echo "*** static library $deplib is not portable!"
2278 deplibs="$deplib $deplibs"
2279 fi
2280 continue
2281 ;;
2282 prog)
2283 if test "$pass" != link; then
2284 deplibs="$deplib $deplibs"
2285 else
2286 compile_deplibs="$deplib $compile_deplibs"
2287 finalize_deplibs="$deplib $finalize_deplibs"
2288 fi
2289 continue
2290 ;;
2291 esac # linkmode
2292 ;; # *.$libext
2293 *.lo | *.$objext)
2294 if test "$pass" = conv; then
2295 deplibs="$deplib $deplibs"
2296 elif test "$linkmode" = prog; then
2297 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
2298 # If there is no dlopen support or we're linking statically,
2299 # we need to preload.
2300 newdlprefiles="$newdlprefiles $deplib"
2301 compile_deplibs="$deplib $compile_deplibs"
2302 finalize_deplibs="$deplib $finalize_deplibs"
2303 else
2304 newdlfiles="$newdlfiles $deplib"
2305 fi
2306 fi
2307 continue
2308 ;;
2309 %DEPLIBS%)
2310 alldeplibs=yes
2311 continue
2312 ;;
2313 esac # case $deplib
2314 if test "$found" = yes || test -f "$lib"; then :
2315 else
2316 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
2317 exit $EXIT_FAILURE
2318 fi
2319
2320 # Check to see that this really is a libtool archive.
2321 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
2322 else
2323 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
2324 exit $EXIT_FAILURE
2325 fi
2326
2327 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
2328 test "X$ladir" = "X$lib" && ladir="."
2329
2330 dlname=
2331 dlopen=
2332 dlpreopen=
2333 libdir=
2334 library_names=
2335 old_library=
2336 # If the library was installed with an old release of libtool,
2337 # it will not redefine variables installed, or shouldnotlink
2338 installed=yes
2339 shouldnotlink=no
2340 avoidtemprpath=
2341
2342
2343 # Read the .la file
2344 case $lib in
2345 */* | *\\*) . $lib ;;
2346 *) . ./$lib ;;
2347 esac
2348
2349 if test "$linkmode,$pass" = "lib,link" ||
2350 test "$linkmode,$pass" = "prog,scan" ||
2351 { test "$linkmode" != prog && test "$linkmode" != lib; }; then
2352 test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
2353 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
2354 fi
2355
2356 if test "$pass" = conv; then
2357 # Only check for convenience libraries
2358 deplibs="$lib $deplibs"
2359 if test -z "$libdir"; then
2360 if test -z "$old_library"; then
2361 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2362 exit $EXIT_FAILURE
2363 fi
2364 # It is a libtool convenience library, so add in its objects.
2365 convenience="$convenience $ladir/$objdir/$old_library"
2366 old_convenience="$old_convenience $ladir/$objdir/$old_library"
2367 tmp_libs=
2368 for deplib in $dependency_libs; do
2369 deplibs="$deplib $deplibs"
2370 if test "X$duplicate_deps" = "Xyes" ; then
2371 case "$tmp_libs " in
2372 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2373 esac
2374 fi
2375 tmp_libs="$tmp_libs $deplib"
2376 done
2377 elif test "$linkmode" != prog && test "$linkmode" != lib; then
2378 $echo "$modename: \`$lib' is not a convenience library" 1>&2
2379 exit $EXIT_FAILURE
2380 fi
2381 continue
2382 fi # $pass = conv
2383
2384
2385 # Get the name of the library we link against.
2386 linklib=
2387 for l in $old_library $library_names; do
2388 linklib="$l"
2389 done
2390 if test -z "$linklib"; then
2391 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
2392 exit $EXIT_FAILURE
2393 fi
2394
2395 # This library was specified with -dlopen.
2396 if test "$pass" = dlopen; then
2397 if test -z "$libdir"; then
2398 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
2399 exit $EXIT_FAILURE
2400 fi
2401 if test -z "$dlname" ||
2402 test "$dlopen_support" != yes ||
2403 test "$build_libtool_libs" = no; then
2404 # If there is no dlname, no dlopen support or we're linking
2405 # statically, we need to preload. We also need to preload any
2406 # dependent libraries so libltdl's deplib preloader doesn't
2407 # bomb out in the load deplibs phase.
2408 dlprefiles="$dlprefiles $lib $dependency_libs"
2409 else
2410 newdlfiles="$newdlfiles $lib"
2411 fi
2412 continue
2413 fi # $pass = dlopen
2414
2415 # We need an absolute path.
2416 case $ladir in
2417 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
2418 *)
2419 abs_ladir=`cd "$ladir" && pwd`
2420 if test -z "$abs_ladir"; then
2421 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
2422 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
2423 abs_ladir="$ladir"
2424 fi
2425 ;;
2426 esac
2427 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
2428
2429 # Find the relevant object directory and library name.
2430 if test "X$installed" = Xyes; then
2431 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2432 $echo "$modename: warning: library \`$lib' was moved." 1>&2
2433 dir="$ladir"
2434 absdir="$abs_ladir"
2435 libdir="$abs_ladir"
2436 else
2437 dir="$libdir"
2438 absdir="$libdir"
2439 fi
2440 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
2441 else
2442 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
2443 dir="$ladir"
2444 absdir="$abs_ladir"
2445 # Remove this search path later
2446 notinst_path="$notinst_path $abs_ladir"
2447 else
2448 dir="$ladir/$objdir"
2449 absdir="$abs_ladir/$objdir"
2450 # Remove this search path later
2451 notinst_path="$notinst_path $abs_ladir"
2452 fi
2453 fi # $installed = yes
2454 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
2455
2456 # This library was specified with -dlpreopen.
2457 if test "$pass" = dlpreopen; then
2458 if test -z "$libdir"; then
2459 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
2460 exit $EXIT_FAILURE
2461 fi
2462 # Prefer using a static library (so that no silly _DYNAMIC symbols
2463 # are required to link).
2464 if test -n "$old_library"; then
2465 newdlprefiles="$newdlprefiles $dir/$old_library"
2466 # Otherwise, use the dlname, so that lt_dlopen finds it.
2467 elif test -n "$dlname"; then
2468 newdlprefiles="$newdlprefiles $dir/$dlname"
2469 else
2470 newdlprefiles="$newdlprefiles $dir/$linklib"
2471 fi
2472 fi # $pass = dlpreopen
2473
2474 if test -z "$libdir"; then
2475 # Link the convenience library
2476 if test "$linkmode" = lib; then
2477 deplibs="$dir/$old_library $deplibs"
2478 elif test "$linkmode,$pass" = "prog,link"; then
2479 compile_deplibs="$dir/$old_library $compile_deplibs"
2480 finalize_deplibs="$dir/$old_library $finalize_deplibs"
2481 else
2482 deplibs="$lib $deplibs" # used for prog,scan pass
2483 fi
2484 continue
2485 fi
2486
2487
2488 if test "$linkmode" = prog && test "$pass" != link; then
2489 newlib_search_path="$newlib_search_path $ladir"
2490 deplibs="$lib $deplibs"
2491
2492 linkalldeplibs=no
2493 if test "$link_all_deplibs" != no || test -z "$library_names" ||
2494 test "$build_libtool_libs" = no; then
2495 linkalldeplibs=yes
2496 fi
2497
2498 tmp_libs=
2499 for deplib in $dependency_libs; do
2500 case $deplib in
2501 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
2502 esac
2503 # Need to link against all dependency_libs?
2504 if test "$linkalldeplibs" = yes; then
2505 deplibs="$deplib $deplibs"
2506 else
2507 # Need to hardcode shared library paths
2508 # or/and link against static libraries
2509 newdependency_libs="$deplib $newdependency_libs"
2510 fi
2511 if test "X$duplicate_deps" = "Xyes" ; then
2512 case "$tmp_libs " in
2513 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2514 esac
2515 fi
2516 tmp_libs="$tmp_libs $deplib"
2517 done # for deplib
2518 continue
2519 fi # $linkmode = prog...
2520
2521 if test "$linkmode,$pass" = "prog,link"; then
2522 if test -n "$library_names" &&
2523 { { test "$prefer_static_libs" = no ||
2524 test "$prefer_static_libs,$installed" = "built,yes"; } ||
2525 test -z "$old_library"; }; then
2526 # We need to hardcode the library path
2527 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
2528 # Make sure the rpath contains only unique directories.
2529 case "$temp_rpath " in
2530 *" $dir "*) ;;
2531 *" $absdir "*) ;;
2532 *) temp_rpath="$temp_rpath $absdir" ;;
2533 esac
2534 fi
2535
2536 # Hardcode the library path.
2537 # Skip directories that are in the system default run-time
2538 # search path.
2539 case " $sys_lib_dlsearch_path " in
2540 *" $absdir "*) ;;
2541 *)
2542 case "$compile_rpath " in
2543 *" $absdir "*) ;;
2544 *) compile_rpath="$compile_rpath $absdir"
2545 esac
2546 ;;
2547 esac
2548 case " $sys_lib_dlsearch_path " in
2549 *" $libdir "*) ;;
2550 *)
2551 case "$finalize_rpath " in
2552 *" $libdir "*) ;;
2553 *) finalize_rpath="$finalize_rpath $libdir"
2554 esac
2555 ;;
2556 esac
2557 fi # $linkmode,$pass = prog,link...
2558
2559 if test "$alldeplibs" = yes &&
2560 { test "$deplibs_check_method" = pass_all ||
2561 { test "$build_libtool_libs" = yes &&
2562 test -n "$library_names"; }; }; then
2563 # We only need to search for static libraries
2564 continue
2565 fi
2566 fi
2567
2568 link_static=no # Whether the deplib will be linked statically
2569 use_static_libs=$prefer_static_libs
2570 if test "$use_static_libs" = built && test "$installed" = yes ; then
2571 use_static_libs=no
2572 fi
2573 if test -n "$library_names" &&
2574 { test "$use_static_libs" = no || test -z "$old_library"; }; then
2575 if test "$installed" = no; then
2576 notinst_deplibs="$notinst_deplibs $lib"
2577 need_relink=yes
2578 fi
2579 # This is a shared library
2580
2581 # Warn about portability, can't link against -module's on
2582 # some systems (darwin)
2583 if test "$shouldnotlink" = yes && test "$pass" = link ; then
2584 $echo
2585 if test "$linkmode" = prog; then
2586 $echo "*** Warning: Linking the executable $output against the loadable module"
2587 else
2588 $echo "*** Warning: Linking the shared library $output against the loadable module"
2589 fi
2590 $echo "*** $linklib is not portable!"
2591 fi
2592 if test "$linkmode" = lib &&
2593 test "$hardcode_into_libs" = yes; then
2594 # Hardcode the library path.
2595 # Skip directories that are in the system default run-time
2596 # search path.
2597 case " $sys_lib_dlsearch_path " in
2598 *" $absdir "*) ;;
2599 *)
2600 case "$compile_rpath " in
2601 *" $absdir "*) ;;
2602 *) compile_rpath="$compile_rpath $absdir"
2603 esac
2604 ;;
2605 esac
2606 case " $sys_lib_dlsearch_path " in
2607 *" $libdir "*) ;;
2608 *)
2609 case "$finalize_rpath " in
2610 *" $libdir "*) ;;
2611 *) finalize_rpath="$finalize_rpath $libdir"
2612 esac
2613 ;;
2614 esac
2615 fi
2616
2617 if test -n "$old_archive_from_expsyms_cmds"; then
2618 # figure out the soname
2619 set dummy $library_names
2620 realname="$2"
2621 shift; shift
2622 libname=`eval \\$echo \"$libname_spec\"`
2623 # use dlname if we got it. it's perfectly good, no?
2624 if test -n "$dlname"; then
2625 soname="$dlname"
2626 elif test -n "$soname_spec"; then
2627 # bleh windows
2628 case $host in
2629 *cygwin* | mingw*)
2630 major=`expr $current - $age`
2631 versuffix="-$major"
2632 ;;
2633 esac
2634 eval soname=\"$soname_spec\"
2635 else
2636 soname="$realname"
2637 fi
2638
2639 # Make a new name for the extract_expsyms_cmds to use
2640 soroot="$soname"
2641 soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
2642 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
2643
2644 # If the library has no export list, then create one now
2645 if test -f "$output_objdir/$soname-def"; then :
2646 else
2647 $show "extracting exported symbol list from \`$soname'"
2648 save_ifs="$IFS"; IFS='~'
2649 cmds=$extract_expsyms_cmds
2650 for cmd in $cmds; do
2651 IFS="$save_ifs"
2652 eval cmd=\"$cmd\"
2653 $show "$cmd"
2654 $run eval "$cmd" || exit $?
2655 done
2656 IFS="$save_ifs"
2657 fi
2658
2659 # Create $newlib
2660 if test -f "$output_objdir/$newlib"; then :; else
2661 $show "generating import library for \`$soname'"
2662 save_ifs="$IFS"; IFS='~'
2663 cmds=$old_archive_from_expsyms_cmds
2664 for cmd in $cmds; do
2665 IFS="$save_ifs"
2666 eval cmd=\"$cmd\"
2667 $show "$cmd"
2668 $run eval "$cmd" || exit $?
2669 done
2670 IFS="$save_ifs"
2671 fi
2672 # make sure the library variables are pointing to the new library
2673 dir=$output_objdir
2674 linklib=$newlib
2675 fi # test -n "$old_archive_from_expsyms_cmds"
2676
2677 if test "$linkmode" = prog || test "$mode" != relink; then
2678 add_shlibpath=
2679 add_dir=
2680 add=
2681 lib_linked=yes
2682 case $hardcode_action in
2683 immediate | unsupported)
2684 if test "$hardcode_direct" = no; then
2685 add="$dir/$linklib"
2686 case $host in
2687 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2688 *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2689 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2690 *-*-unixware7*) add_dir="-L$dir" ;;
2691 *-*-darwin* )
2692 # if the lib is a module then we can not link against
2693 # it, someone is ignoring the new warnings I added
2694 if /usr/bin/file -L $add 2> /dev/null |
2695 $EGREP ": [^:]* bundle" >/dev/null ; then
2696 $echo "** Warning, lib $linklib is a module, not a shared library"
2697 if test -z "$old_library" ; then
2698 $echo
2699 $echo "** And there doesn't seem to be a static archive available"
2700 $echo "** The link will probably fail, sorry"
2701 else
2702 add="$dir/$old_library"
2703 fi
2704 fi
2705 esac
2706 elif test "$hardcode_minus_L" = no; then
2707 case $host in
2708 *-*-sunos*) add_shlibpath="$dir" ;;
2709 esac
2710 add_dir="-L$dir"
2711 add="-l$name"
2712 elif test "$hardcode_shlibpath_var" = no; then
2713 add_shlibpath="$dir"
2714 add="-l$name"
2715 else
2716 lib_linked=no
2717 fi
2718 ;;
2719 relink)
2720 if test "$hardcode_direct" = yes; then
2721 add="$dir/$linklib"
2722 elif test "$hardcode_minus_L" = yes; then
2723 add_dir="-L$dir"
2724 # Try looking first in the location we're being installed to.
2725 if test -n "$inst_prefix_dir"; then
2726 case $libdir in
2727 [\\/]*)
2728 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2729 ;;
2730 esac
2731 fi
2732 add="-l$name"
2733 elif test "$hardcode_shlibpath_var" = yes; then
2734 add_shlibpath="$dir"
2735 add="-l$name"
2736 else
2737 lib_linked=no
2738 fi
2739 ;;
2740 *) lib_linked=no ;;
2741 esac
2742
2743 if test "$lib_linked" != yes; then
2744 $echo "$modename: configuration error: unsupported hardcode properties"
2745 exit $EXIT_FAILURE
2746 fi
2747
2748 if test -n "$add_shlibpath"; then
2749 case :$compile_shlibpath: in
2750 *":$add_shlibpath:"*) ;;
2751 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
2752 esac
2753 fi
2754 if test "$linkmode" = prog; then
2755 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
2756 test -n "$add" && compile_deplibs="$add $compile_deplibs"
2757 else
2758 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2759 test -n "$add" && deplibs="$add $deplibs"
2760 if test "$hardcode_direct" != yes && \
2761 test "$hardcode_minus_L" != yes && \
2762 test "$hardcode_shlibpath_var" = yes; then
2763 case :$finalize_shlibpath: in
2764 *":$libdir:"*) ;;
2765 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2766 esac
2767 fi
2768 fi
2769 fi
2770
2771 if test "$linkmode" = prog || test "$mode" = relink; then
2772 add_shlibpath=
2773 add_dir=
2774 add=
2775 # Finalize command for both is simple: just hardcode it.
2776 if test "$hardcode_direct" = yes; then
2777 add="$libdir/$linklib"
2778 elif test "$hardcode_minus_L" = yes; then
2779 add_dir="-L$libdir"
2780 add="-l$name"
2781 elif test "$hardcode_shlibpath_var" = yes; then
2782 case :$finalize_shlibpath: in
2783 *":$libdir:"*) ;;
2784 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
2785 esac
2786 add="-l$name"
2787 elif test "$hardcode_automatic" = yes; then
2788 if test -n "$inst_prefix_dir" &&
2789 test -f "$inst_prefix_dir$libdir/$linklib" ; then
2790 add="$inst_prefix_dir$libdir/$linklib"
2791 else
2792 add="$libdir/$linklib"
2793 fi
2794 else
2795 # We cannot seem to hardcode it, guess we'll fake it.
2796 add_dir="-L$libdir"
2797 # Try looking first in the location we're being installed to.
2798 if test -n "$inst_prefix_dir"; then
2799 case $libdir in
2800 [\\/]*)
2801 add_dir="$add_dir -L$inst_prefix_dir$libdir"
2802 ;;
2803 esac
2804 fi
2805 add="-l$name"
2806 fi
2807
2808 if test "$linkmode" = prog; then
2809 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
2810 test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
2811 else
2812 test -n "$add_dir" && deplibs="$add_dir $deplibs"
2813 test -n "$add" && deplibs="$add $deplibs"
2814 fi
2815 fi
2816 elif test "$linkmode" = prog; then
2817 # Here we assume that one of hardcode_direct or hardcode_minus_L
2818 # is not unsupported. This is valid on all known static and
2819 # shared platforms.
2820 if test "$hardcode_direct" != unsupported; then
2821 test -n "$old_library" && linklib="$old_library"
2822 compile_deplibs="$dir/$linklib $compile_deplibs"
2823 finalize_deplibs="$dir/$linklib $finalize_deplibs"
2824 else
2825 compile_deplibs="-l$name -L$dir $compile_deplibs"
2826 finalize_deplibs="-l$name -L$dir $finalize_deplibs"
2827 fi
2828 elif test "$build_libtool_libs" = yes; then
2829 # Not a shared library
2830 if test "$deplibs_check_method" != pass_all; then
2831 # We're trying link a shared library against a static one
2832 # but the system doesn't support it.
2833
2834 # Just print a warning and add the library to dependency_libs so
2835 # that the program can be linked against the static library.
2836 $echo
2837 $echo "*** Warning: This system can not link to static lib archive $lib."
2838 $echo "*** I have the capability to make that library automatically link in when"
2839 $echo "*** you link to this library. But I can only do this if you have a"
2840 $echo "*** shared version of the library, which you do not appear to have."
2841 if test "$module" = yes; then
2842 $echo "*** But as you try to build a module library, libtool will still create "
2843 $echo "*** a static module, that should work as long as the dlopening application"
2844 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
2845 if test -z "$global_symbol_pipe"; then
2846 $echo
2847 $echo "*** However, this would only work if libtool was able to extract symbol"
2848 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
2849 $echo "*** not find such a program. So, this module is probably useless."
2850 $echo "*** \`nm' from GNU binutils and a full rebuild may help."
2851 fi
2852 if test "$build_old_libs" = no; then
2853 build_libtool_libs=module
2854 build_old_libs=yes
2855 else
2856 build_libtool_libs=no
2857 fi
2858 fi
2859 else
2860 deplibs="$dir/$old_library $deplibs"
2861 link_static=yes
2862 fi
2863 fi # link shared/static library?
2864
2865 if test "$linkmode" = lib; then
2866 if test -n "$dependency_libs" &&
2867 { test "$hardcode_into_libs" != yes ||
2868 test "$build_old_libs" = yes ||
2869 test "$link_static" = yes; }; then
2870 # Extract -R from dependency_libs
2871 temp_deplibs=
2872 for libdir in $dependency_libs; do
2873 case $libdir in
2874 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
2875 case " $xrpath " in
2876 *" $temp_xrpath "*) ;;
2877 *) xrpath="$xrpath $temp_xrpath";;
2878 esac;;
2879 *) temp_deplibs="$temp_deplibs $libdir";;
2880 esac
2881 done
2882 dependency_libs="$temp_deplibs"
2883 fi
2884
2885 newlib_search_path="$newlib_search_path $absdir"
2886 # Link against this library
2887 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
2888 # ... and its dependency_libs
2889 tmp_libs=
2890 for deplib in $dependency_libs; do
2891 newdependency_libs="$deplib $newdependency_libs"
2892 if test "X$duplicate_deps" = "Xyes" ; then
2893 case "$tmp_libs " in
2894 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
2895 esac
2896 fi
2897 tmp_libs="$tmp_libs $deplib"
2898 done
2899
2900 if test "$link_all_deplibs" != no; then
2901 # Add the search paths of all dependency libraries
2902 for deplib in $dependency_libs; do
2903 case $deplib in
2904 -L*) path="$deplib" ;;
2905 *.la)
2906 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
2907 test "X$dir" = "X$deplib" && dir="."
2908 # We need an absolute path.
2909 case $dir in
2910 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
2911 *)
2912 absdir=`cd "$dir" && pwd`
2913 if test -z "$absdir"; then
2914 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
2915 absdir="$dir"
2916 fi
2917 ;;
2918 esac
2919 if grep "^installed=no" $deplib > /dev/null; then
2920 path="$absdir/$objdir"
2921 else
2922 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
2923 if test -z "$libdir"; then
2924 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
2925 exit $EXIT_FAILURE
2926 fi
2927 if test "$absdir" != "$libdir"; then
2928 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
2929 fi
2930 path="$absdir"
2931 fi
2932 depdepl=
2933 case $host in
2934 *-*-darwin*)
2935 # we do not want to link against static libs,
2936 # but need to link against shared
2937 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
2938 if test -n "$deplibrary_names" ; then
2939 for tmp in $deplibrary_names ; do
2940 depdepl=$tmp
2941 done
2942 if test -f "$path/$depdepl" ; then
2943 depdepl="$path/$depdepl"
2944 fi
2945 # do not add paths which are already there
2946 case " $newlib_search_path " in
2947 *" $path "*) ;;
2948 *) newlib_search_path="$newlib_search_path $path";;
2949 esac
2950 fi
2951 path=""
2952 ;;
2953 *)
2954 path="-L$path"
2955 ;;
2956 esac
2957 ;;
2958 -l*)
2959 case $host in
2960 *-*-darwin*)
2961 # Again, we only want to link against shared libraries
2962 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
2963 for tmp in $newlib_search_path ; do
2964 if test -f "$tmp/lib$tmp_libs.dylib" ; then
2965 eval depdepl="$tmp/lib$tmp_libs.dylib"
2966 break
2967 fi
2968 done
2969 path=""
2970 ;;
2971 *) continue ;;
2972 esac
2973 ;;
2974 *) continue ;;
2975 esac
2976 case " $deplibs " in
2977 *" $path "*) ;;
2978 *) deplibs="$path $deplibs" ;;
2979 esac
2980 case " $deplibs " in
2981 *" $depdepl "*) ;;
2982 *) deplibs="$depdepl $deplibs" ;;
2983 esac
2984 done
2985 fi # link_all_deplibs != no
2986 fi # linkmode = lib
2987 done # for deplib in $libs
2988 dependency_libs="$newdependency_libs"
2989 if test "$pass" = dlpreopen; then
2990 # Link the dlpreopened libraries before other libraries
2991 for deplib in $save_deplibs; do
2992 deplibs="$deplib $deplibs"
2993 done
2994 fi
2995 if test "$pass" != dlopen; then
2996 if test "$pass" != conv; then
2997 # Make sure lib_search_path contains only unique directories.
2998 lib_search_path=
2999 for dir in $newlib_search_path; do
3000 case "$lib_search_path " in
3001 *" $dir "*) ;;
3002 *) lib_search_path="$lib_search_path $dir" ;;
3003 esac
3004 done
3005 newlib_search_path=
3006 fi
3007
3008 if test "$linkmode,$pass" != "prog,link"; then
3009 vars="deplibs"
3010 else
3011 vars="compile_deplibs finalize_deplibs"
3012 fi
3013 for var in $vars dependency_libs; do
3014 # Add libraries to $var in reverse order
3015 eval tmp_libs=\"\$$var\"
3016 new_libs=
3017 for deplib in $tmp_libs; do
3018 # FIXME: Pedantically, this is the right thing to do, so
3019 # that some nasty dependency loop isn't accidentally
3020 # broken:
3021 #new_libs="$deplib $new_libs"
3022 # Pragmatically, this seems to cause very few problems in
3023 # practice:
3024 case $deplib in
3025 -L*) new_libs="$deplib $new_libs" ;;
3026 -R*) ;;
3027 *)
3028 # And here is the reason: when a library appears more
3029 # than once as an explicit dependence of a library, or
3030 # is implicitly linked in more than once by the
3031 # compiler, it is considered special, and multiple
3032 # occurrences thereof are not removed. Compare this
3033 # with having the same library being listed as a
3034 # dependency of multiple other libraries: in this case,
3035 # we know (pedantically, we assume) the library does not
3036 # need to be listed more than once, so we keep only the
3037 # last copy. This is not always right, but it is rare
3038 # enough that we require users that really mean to play
3039 # such unportable linking tricks to link the library
3040 # using -Wl,-lname, so that libtool does not consider it
3041 # for duplicate removal.
3042 case " $specialdeplibs " in
3043 *" $deplib "*) new_libs="$deplib $new_libs" ;;
3044 *)
3045 case " $new_libs " in
3046 *" $deplib "*) ;;
3047 *) new_libs="$deplib $new_libs" ;;
3048 esac
3049 ;;
3050 esac
3051 ;;
3052 esac
3053 done
3054 tmp_libs=
3055 for deplib in $new_libs; do
3056 case $deplib in
3057 -L*)
3058 case " $tmp_libs " in
3059 *" $deplib "*) ;;
3060 *) tmp_libs="$tmp_libs $deplib" ;;
3061 esac
3062 ;;
3063 *) tmp_libs="$tmp_libs $deplib" ;;
3064 esac
3065 done
3066 eval $var=\"$tmp_libs\"
3067 done # for var
3068 fi
3069 # Last step: remove runtime libs from dependency_libs
3070 # (they stay in deplibs)
3071 tmp_libs=
3072 for i in $dependency_libs ; do
3073 case " $predeps $postdeps $compiler_lib_search_path " in
3074 *" $i "*)
3075 i=""
3076 ;;
3077 esac
3078 if test -n "$i" ; then
3079 tmp_libs="$tmp_libs $i"
3080 fi
3081 done
3082 dependency_libs=$tmp_libs
3083 done # for pass
3084 if test "$linkmode" = prog; then
3085 dlfiles="$newdlfiles"
3086 dlprefiles="$newdlprefiles"
3087 fi
3088
3089 case $linkmode in
3090 oldlib)
3091 if test -n "$deplibs"; then
3092 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
3093 fi
3094
3095 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
3096 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
3097 fi
3098
3099 if test -n "$rpath"; then
3100 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
3101 fi
3102
3103 if test -n "$xrpath"; then
3104 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
3105 fi
3106
3107 if test -n "$vinfo"; then
3108 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
3109 fi
3110
3111 if test -n "$release"; then
3112 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
3113 fi
3114
3115 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
3116 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
3117 fi
3118
3119 # Now set the variables for building old libraries.
3120 build_libtool_libs=no
3121 oldlibs="$output"
3122 objs="$objs$old_deplibs"
3123 ;;
3124
3125 lib)
3126 # Make sure we only generate libraries of the form `libNAME.la'.
3127 case $outputname in
3128 lib*)
3129 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
3130 eval shared_ext=\"$shrext_cmds\"
3131 eval libname=\"$libname_spec\"
3132 ;;
3133 *)
3134 if test "$module" = no; then
3135 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
3136 $echo "$help" 1>&2
3137 exit $EXIT_FAILURE
3138 fi
3139 if test "$need_lib_prefix" != no; then
3140 # Add the "lib" prefix for modules if required
3141 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3142 eval shared_ext=\"$shrext_cmds\"
3143 eval libname=\"$libname_spec\"
3144 else
3145 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
3146 fi
3147 ;;
3148 esac
3149
3150 if test -n "$objs"; then
3151 if test "$deplibs_check_method" != pass_all; then
3152 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
3153 exit $EXIT_FAILURE
3154 else
3155 $echo
3156 $echo "*** Warning: Linking the shared library $output against the non-libtool"
3157 $echo "*** objects $objs is not portable!"
3158 libobjs="$libobjs $objs"
3159 fi
3160 fi
3161
3162 if test "$dlself" != no; then
3163 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
3164 fi
3165
3166 set dummy $rpath
3167 if test "$#" -gt 2; then
3168 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
3169 fi
3170 install_libdir="$2"
3171
3172 oldlibs=
3173 if test -z "$rpath"; then
3174 if test "$build_libtool_libs" = yes; then
3175 # Building a libtool convenience library.
3176 # Some compilers have problems with a `.al' extension so
3177 # convenience libraries should have the same extension an
3178 # archive normally would.
3179 oldlibs="$output_objdir/$libname.$libext $oldlibs"
3180 build_libtool_libs=convenience
3181 build_old_libs=yes
3182 fi
3183
3184 if test -n "$vinfo"; then
3185 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
3186 fi
3187
3188 if test -n "$release"; then
3189 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
3190 fi
3191 else
3192
3193 # Parse the version information argument.
3194 save_ifs="$IFS"; IFS=':'
3195 set dummy $vinfo 0 0 0
3196 IFS="$save_ifs"
3197
3198 if test -n "$8"; then
3199 $echo "$modename: too many parameters to \`-version-info'" 1>&2
3200 $echo "$help" 1>&2
3201 exit $EXIT_FAILURE
3202 fi
3203
3204 # convert absolute version numbers to libtool ages
3205 # this retains compatibility with .la files and attempts
3206 # to make the code below a bit more comprehensible
3207
3208 case $vinfo_number in
3209 yes)
3210 number_major="$2"
3211 number_minor="$3"
3212 number_revision="$4"
3213 #
3214 # There are really only two kinds -- those that
3215 # use the current revision as the major version
3216 # and those that subtract age and use age as
3217 # a minor version. But, then there is irix
3218 # which has an extra 1 added just for fun
3219 #
3220 case $version_type in
3221 darwin|linux|osf|windows|none)
3222 current=`expr $number_major + $number_minor`
3223 age="$number_minor"
3224 revision="$number_revision"
3225 ;;
3226 freebsd-aout|freebsd-elf|sunos)
3227 current="$number_major"
3228 revision="$number_minor"
3229 age="0"
3230 ;;
3231 irix|nonstopux)
3232 current=`expr $number_major + $number_minor - 1`
3233 age="$number_minor"
3234 revision="$number_minor"
3235 ;;
3236 esac
3237 ;;
3238 no)
3239 current="$2"
3240 revision="$3"
3241 age="$4"
3242 ;;
3243 esac
3244
3245 # Check that each of the things are valid numbers.
3246 case $current in
3247 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3248 *)
3249 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
3250 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3251 exit $EXIT_FAILURE
3252 ;;
3253 esac
3254
3255 case $revision in
3256 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3257 *)
3258 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
3259 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3260 exit $EXIT_FAILURE
3261 ;;
3262 esac
3263
3264 case $age in
3265 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
3266 *)
3267 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
3268 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3269 exit $EXIT_FAILURE
3270 ;;
3271 esac
3272
3273 if test "$age" -gt "$current"; then
3274 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
3275 $echo "$modename: \`$vinfo' is not valid version information" 1>&2
3276 exit $EXIT_FAILURE
3277 fi
3278
3279 # Calculate the version variables.
3280 major=
3281 versuffix=
3282 verstring=
3283 case $version_type in
3284 none) ;;
3285
3286 darwin)
3287 # Like Linux, but with the current version available in
3288 # verstring for coding it into the library header
3289 major=.`expr $current - $age`
3290 versuffix="$major.$age.$revision"
3291 # Darwin ld doesn't like 0 for these options...
3292 minor_current=`expr $current + 1`
3293 verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
3294 ;;
3295
3296 freebsd-aout)
3297 major=".$current"
3298 versuffix=".$current.$revision";
3299 ;;
3300
3301 freebsd-elf)
3302 major=".$current"
3303 versuffix=".$current";
3304 ;;
3305
3306 irix | nonstopux)
3307 major=`expr $current - $age + 1`
3308
3309 case $version_type in
3310 nonstopux) verstring_prefix=nonstopux ;;
3311 *) verstring_prefix=sgi ;;
3312 esac
3313 verstring="$verstring_prefix$major.$revision"
3314
3315 # Add in all the interfaces that we are compatible with.
3316 loop=$revision
3317 while test "$loop" -ne 0; do
3318 iface=`expr $revision - $loop`
3319 loop=`expr $loop - 1`
3320 verstring="$verstring_prefix$major.$iface:$verstring"
3321 done
3322
3323 # Before this point, $major must not contain `.'.
3324 major=.$major
3325 versuffix="$major.$revision"
3326 ;;
3327
3328 linux)
3329 major=.`expr $current - $age`
3330 versuffix="$major.$age.$revision"
3331 ;;
3332
3333 osf)
3334 major=.`expr $current - $age`
3335 versuffix=".$current.$age.$revision"
3336 verstring="$current.$age.$revision"
3337
3338 # Add in all the interfaces that we are compatible with.
3339 loop=$age
3340 while test "$loop" -ne 0; do
3341 iface=`expr $current - $loop`
3342 loop=`expr $loop - 1`
3343 verstring="$verstring:${iface}.0"
3344 done
3345
3346 # Make executables depend on our current version.
3347 verstring="$verstring:${current}.0"
3348 ;;
3349
3350 sunos)
3351 major=".$current"
3352 versuffix=".$current.$revision"
3353 ;;
3354
3355 windows)
3356 # Use '-' rather than '.', since we only want one
3357 # extension on DOS 8.3 filesystems.
3358 major=`expr $current - $age`
3359 versuffix="-$major"
3360 ;;
3361
3362 *)
3363 $echo "$modename: unknown library version type \`$version_type'" 1>&2
3364 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
3365 exit $EXIT_FAILURE
3366 ;;
3367 esac
3368
3369 # Clear the version info if we defaulted, and they specified a release.
3370 if test -z "$vinfo" && test -n "$release"; then
3371 major=
3372 case $version_type in
3373 darwin)
3374 # we can't check for "0.0" in archive_cmds due to quoting
3375 # problems, so we reset it completely
3376 verstring=
3377 ;;
3378 *)
3379 verstring="0.0"
3380 ;;
3381 esac
3382 if test "$need_version" = no; then
3383 versuffix=
3384 else
3385 versuffix=".0.0"
3386 fi
3387 fi
3388
3389 # Remove version info from name if versioning should be avoided
3390 if test "$avoid_version" = yes && test "$need_version" = no; then
3391 major=
3392 versuffix=
3393 verstring=""
3394 fi
3395
3396 # Check to see if the archive will have undefined symbols.
3397 if test "$allow_undefined" = yes; then
3398 if test "$allow_undefined_flag" = unsupported; then
3399 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
3400 build_libtool_libs=no
3401 build_old_libs=yes
3402 fi
3403 else
3404 # Don't allow undefined symbols.
3405 allow_undefined_flag="$no_undefined_flag"
3406 fi
3407 fi
3408
3409 if test "$mode" != relink; then
3410 # Remove our outputs, but don't remove object files since they
3411 # may have been created when compiling PIC objects.
3412 removelist=
3413 tempremovelist=`$echo "$output_objdir/*"`
3414 for p in $tempremovelist; do
3415 case $p in
3416 *.$objext)
3417 ;;
3418 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
3419 if test "X$precious_files_regex" != "X"; then
3420 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
3421 then
3422 continue
3423 fi
3424 fi
3425 removelist="$removelist $p"
3426 ;;
3427 *) ;;
3428 esac
3429 done
3430 if test -n "$removelist"; then
3431 $show "${rm}r $removelist"
3432 $run ${rm}r $removelist
3433 fi
3434 fi
3435
3436 # Now set the variables for building old libraries.
3437 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
3438 oldlibs="$oldlibs $output_objdir/$libname.$libext"
3439
3440 # Transform .lo files to .o files.
3441 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
3442 fi
3443
3444 # Eliminate all temporary directories.
3445 # for path in $notinst_path; do
3446 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3447 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3448 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
3449 # done
3450
3451 if test -n "$xrpath"; then
3452 # If the user specified any rpath flags, then add them.
3453 temp_xrpath=
3454 for libdir in $xrpath; do
3455 temp_xrpath="$temp_xrpath -R$libdir"
3456 case "$finalize_rpath " in
3457 *" $libdir "*) ;;
3458 *) finalize_rpath="$finalize_rpath $libdir" ;;
3459 esac
3460 done
3461 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
3462 dependency_libs="$temp_xrpath $dependency_libs"
3463 fi
3464 fi
3465
3466 # Make sure dlfiles contains only unique files that won't be dlpreopened
3467 old_dlfiles="$dlfiles"
3468 dlfiles=
3469 for lib in $old_dlfiles; do
3470 case " $dlprefiles $dlfiles " in
3471 *" $lib "*) ;;
3472 *) dlfiles="$dlfiles $lib" ;;
3473 esac
3474 done
3475
3476 # Make sure dlprefiles contains only unique files
3477 old_dlprefiles="$dlprefiles"
3478 dlprefiles=
3479 for lib in $old_dlprefiles; do
3480 case "$dlprefiles " in
3481 *" $lib "*) ;;
3482 *) dlprefiles="$dlprefiles $lib" ;;
3483 esac
3484 done
3485
3486 if test "$build_libtool_libs" = yes; then
3487 if test -n "$rpath"; then
3488 case $host in
3489 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
3490 # these systems don't actually have a c library (as such)!
3491 ;;
3492 *-*-rhapsody* | *-*-darwin1.[012])
3493 # Rhapsody C library is in the System framework
3494 deplibs="$deplibs -framework System"
3495 ;;
3496 *-*-netbsd*)
3497 # Don't link with libc until the a.out ld.so is fixed.
3498 ;;
3499 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
3500 # Do not include libc due to us having libc/libc_r.
3501 ;;
3502 *-*-sco3.2v5* | *-*-sco5v6*)
3503 # Causes problems with __ctype
3504 ;;
3505 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3506 # Compiler inserts libc in the correct place for threads to work
3507 ;;
3508 *)
3509 # Add libc to deplibs on all other systems if necessary.
3510 if test "$build_libtool_need_lc" = "yes"; then
3511 deplibs="$deplibs -lc"
3512 fi
3513 ;;
3514 esac
3515 fi
3516
3517 # Transform deplibs into only deplibs that can be linked in shared.
3518 name_save=$name
3519 libname_save=$libname
3520 release_save=$release
3521 versuffix_save=$versuffix
3522 major_save=$major
3523 # I'm not sure if I'm treating the release correctly. I think
3524 # release should show up in the -l (ie -lgmp5) so we don't want to
3525 # add it in twice. Is that correct?
3526 release=""
3527 versuffix=""
3528 major=""
3529 newdeplibs=
3530 droppeddeps=no
3531 case $deplibs_check_method in
3532 pass_all)
3533 # Don't check for shared/static. Everything works.
3534 # This might be a little naive. We might want to check
3535 # whether the library exists or not. But this is on
3536 # osf3 & osf4 and I'm not really sure... Just
3537 # implementing what was already the behavior.
3538 newdeplibs=$deplibs
3539 ;;
3540 test_compile)
3541 # This code stresses the "libraries are programs" paradigm to its
3542 # limits. Maybe even breaks it. We compile a program, linking it
3543 # against the deplibs as a proxy for the library. Then we can check
3544 # whether they linked in statically or dynamically with ldd.
3545 $rm conftest.c
3546 cat > conftest.c <<EOF
3547 int main() { return 0; }
3548 EOF
3549 $rm conftest
3550 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
3551 ldd_output=`ldd conftest`
3552 for i in $deplibs; do
3553 name=`expr $i : '-l\(.*\)'`
3554 # If $name is empty we are operating on a -L argument.
3555 if test "$name" != "" && test "$name" != "0"; then
3556 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3557 case " $predeps $postdeps " in
3558 *" $i "*)
3559 newdeplibs="$newdeplibs $i"
3560 i=""
3561 ;;
3562 esac
3563 fi
3564 if test -n "$i" ; then
3565 libname=`eval \\$echo \"$libname_spec\"`
3566 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3567 set dummy $deplib_matches
3568 deplib_match=$2
3569 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
3570 newdeplibs="$newdeplibs $i"
3571 else
3572 droppeddeps=yes
3573 $echo
3574 $echo "*** Warning: dynamic linker does not accept needed library $i."
3575 $echo "*** I have the capability to make that library automatically link in when"
3576 $echo "*** you link to this library. But I can only do this if you have a"
3577 $echo "*** shared version of the library, which I believe you do not have"
3578 $echo "*** because a test_compile did reveal that the linker did not use it for"
3579 $echo "*** its dynamic dependency list that programs get resolved with at runtime."
3580 fi
3581 fi
3582 else
3583 newdeplibs="$newdeplibs $i"
3584 fi
3585 done
3586 else
3587 # Error occurred in the first compile. Let's try to salvage
3588 # the situation: Compile a separate program for each library.
3589 for i in $deplibs; do
3590 name=`expr $i : '-l\(.*\)'`
3591 # If $name is empty we are operating on a -L argument.
3592 if test "$name" != "" && test "$name" != "0"; then
3593 $rm conftest
3594 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
3595 ldd_output=`ldd conftest`
3596 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
3597 case " $predeps $postdeps " in
3598 *" $i "*)
3599 newdeplibs="$newdeplibs $i"
3600 i=""
3601 ;;
3602 esac
3603 fi
3604 if test -n "$i" ; then
3605 libname=`eval \\$echo \"$libname_spec\"`
3606 deplib_matches=`eval \\$echo \"$library_names_spec\"`
3607 set dummy $deplib_matches